@@ -301,13 +301,8 @@ TEST(acl_hal, debugging) {
301
301
const char test_str[] = " hal debug printf test\n " ;
302
302
CHECK (acl_set_hal (&simple_hal));
303
303
const acl_hal_t *hal = acl_get_hal ();
304
- char env[] = " ACL_DEBUG=0" ;
305
304
306
- #ifdef _WIN32
307
- _putenv (env);
308
- #else
309
- putenv (env);
310
- #endif
305
+ acl_test_setenv (" ACL_DEBUG" , " 0" );
311
306
char *acl_debug_env = getenv (" ACL_DEBUG" );
312
307
CHECK (acl_debug_env);
313
308
debug_mode = atoi (acl_debug_env);
@@ -318,32 +313,17 @@ TEST(acl_hal, debugging) {
318
313
CHECK_EQUAL (0 , acl_print_debug_msg (" " ));
319
314
320
315
// Now start debugging.
321
- env[10 ] = ' 4' ;
322
- #ifdef _WIN32
323
- _putenv (env);
324
- #else
325
- putenv (env);
326
- #endif
316
+ acl_test_setenv (" ACL_DEBUG" , " 4" );
327
317
acl_debug_env = getenv (" ACL_DEBUG" );
328
318
CHECK (acl_debug_env);
329
319
debug_mode = atoi (acl_debug_env);
330
320
CHECK_EQUAL (4 , debug_mode);
331
- env[10 ] = ' 3' ;
332
- #ifdef _WIN32
333
- _putenv (env);
334
- #else
335
- putenv (env);
336
- #endif
321
+ acl_test_setenv (" ACL_DEBUG" , " 3" );
337
322
acl_debug_env = getenv (" ACL_DEBUG" );
338
323
CHECK (acl_debug_env);
339
324
debug_mode = atoi (acl_debug_env);
340
325
CHECK_EQUAL (3 , debug_mode);
341
- env[10 ] = ' 2' ;
342
- #ifdef _WIN32
343
- _putenv (env);
344
- #else
345
- putenv (env);
346
- #endif
326
+ acl_test_setenv (" ACL_DEBUG" , " 2" );
347
327
acl_debug_env = getenv (" ACL_DEBUG" );
348
328
CHECK (acl_debug_env);
349
329
debug_mode = atoi (acl_debug_env);
@@ -353,17 +333,13 @@ TEST(acl_hal, debugging) {
353
333
acl_print_debug_msg (test_str)); // -1 because source array includes a NUL
354
334
// char, but we don't print it.
355
335
CHECK_EQUAL (0 , acl_print_debug_msg (" " ));
356
- env[10 ] = ' 0' ;
357
- #ifdef _WIN32
358
- _putenv (env);
359
- #else
360
- putenv (env);
361
- #endif
336
+ acl_test_setenv (" ACL_DEBUG" , " 0" );
362
337
acl_debug_env = getenv (" ACL_DEBUG" );
363
338
CHECK (acl_debug_env);
364
339
debug_mode = atoi (acl_debug_env);
365
340
CHECK_EQUAL (0 , debug_mode);
366
341
CHECK_EQUAL (0 , acl_print_debug_msg (test_str));
342
+ acl_test_unsetenv (" ACL_DEBUG" );
367
343
368
344
cl_int temp;
369
345
CHECK_EQUAL (1 , hal->query_temperature (0 , &temp));
0 commit comments