@@ -410,33 +410,54 @@ if {[info exists tclextlib_file]} {
410410# test tcl ext lib procedures against a failed closedir call
411411if {[info exists closedirlib_file] && [file exists $closedirlib_file]} {
412412 setenv_var TESTSUITE_ENABLE_SITECONFIG_TCLEXTLIBFAILEDCLOSEDIR 1
413- setenv_var LD_PRELOAD $closedirlib_file
413+ if {$tcl_platform(os) ne "Darwin"} {
414+ setenv_var LD_PRELOAD $closedirlib_file
415+ } else {
416+ setenv_var DYLD_INSERT_LIBRARIES $closedirlib_file
417+ }
414418 set ans [list]
415- lappend ans "$error_msgs: couldn't close directory \"$modpathre\": Success "
419+ lappend ans "$error_msgs: couldn't close directory \"$modpathre\": .* "
416420 lappend ans $vers_reportre
417421 testouterr_cmd_re sh -V OK [join $ans \n]
418422
419423 unsetenv_var TESTSUITE_ENABLE_SITECONFIG_TCLEXTLIBFAILEDCLOSEDIR
420- unsetenv_var LD_PRELOAD
424+ if {$tcl_platform(os) ne "Darwin"} {
425+ unsetenv_var LD_PRELOAD
426+ } else {
427+ unsetenv_var DYLD_INSERT_LIBRARIES
428+ }
421429} elseif {$verbose} {
422430 send_user "\tSkip tcl ext lib erroneous procedure calls as closedir test lib is not available\n"
423431}
424432
425433# test tcl ext lib procedures against a failed getpwuid call
426434if {[info exists getpwuidlib_file] && [file exists $getpwuidlib_file]} {
427435 setenv_var TESTSUITE_ENABLE_SITECONFIG_TCLEXTLIBFAILEDGETPWUID 1
428- setenv_var LD_PRELOAD $getpwuidlib_file
436+ if {$tcl_platform(os) ne "Darwin"} {
437+ setenv_var LD_PRELOAD $getpwuidlib_file
438+ } else {
439+ setenv_var DYLD_INSERT_LIBRARIES $getpwuidlib_file
440+ }
429441 set ans [list]
430442 lappend ans "$error_msgs: couldn't find name for user id \"$userid\": .*"
443+ if {$tcl_platform(os) eq "Darwin"} {
444+ lappend ans "$error_msgs: couldn't find name for user id \"$userid\": .*"
445+ }
431446 lappend ans $vers_reportre
432447 testouterr_cmd_re sh -V OK [join $ans \n]
433448
434449 unsetenv_var TESTSUITE_ENABLE_SITECONFIG_TCLEXTLIBFAILEDGETPWUID
435- unsetenv_var LD_PRELOAD
450+ if {$tcl_platform(os) ne "Darwin"} {
451+ unsetenv_var LD_PRELOAD
452+ } else {
453+ unsetenv_var DYLD_INSERT_LIBRARIES
454+ }
436455} elseif {$verbose} {
437456 send_user "\tSkip tcl ext lib erroneous procedure calls as getpwuid test lib is not available\n"
438457}
439458
459+ # getgroups syscall is not used on Darwin
460+ if {$tcl_platform(os) ne "Darwin"} {
440461# test tcl ext lib procedures against a failed getgroups call
441462if {[info exists getgroupslib_file] && [file exists $getgroupslib_file]} {
442463 setenv_var TESTSUITE_ENABLE_SITECONFIG_TCLEXTLIBFAILEDGETGROUPS 1
@@ -481,18 +502,27 @@ if {[info exists dupgetgroupslib_file] && [file exists $dupgetgroupslib_file]} {
481502} elseif {$verbose} {
482503 send_user "\tSkip tcl ext lib erroneous procedure calls as dupgetgroups test lib is not available\n"
483504}
505+ }
484506
485507# test tcl ext lib procedures against a failed time call
486508if {[info exists timelib_file] && [file exists $timelib_file]} {
487509 setenv_var TESTSUITE_ENABLE_SITECONFIG_TCLEXTLIBFAILEDTIME 1
488- setenv_var LD_PRELOAD $timelib_file
510+ if {$tcl_platform(os) ne "Darwin"} {
511+ setenv_var LD_PRELOAD $timelib_file
512+ } else {
513+ setenv_var DYLD_INSERT_LIBRARIES $timelib_file
514+ }
489515 set ans [list]
490516 lappend ans "$error_msgs: couldn't get Epoch time: .*"
491517 lappend ans $vers_reportre
492518 testouterr_cmd_re sh -V OK [join $ans \n]
493519
494520 unsetenv_var TESTSUITE_ENABLE_SITECONFIG_TCLEXTLIBFAILEDTIME
495- unsetenv_var LD_PRELOAD
521+ if {$tcl_platform(os) ne "Darwin"} {
522+ unsetenv_var LD_PRELOAD
523+ } else {
524+ unsetenv_var DYLD_INSERT_LIBRARIES
525+ }
496526} elseif {$verbose} {
497527 send_user "\tSkip tcl ext lib erroneous procedure calls as time test lib is not available\n"
498528}
@@ -508,14 +538,22 @@ unsetenv_var TESTSUITE_ENABLE_SITECONFIG_PARSEDATETIMEARG_NOARG
508538# test tcl ext lib procedures against a failed mktime call
509539if {[info exists mktimelib_file] && [file exists $mktimelib_file]} {
510540 setenv_var TESTSUITE_ENABLE_SITECONFIG_TCLEXTLIBFAILEDMKTIME 1
511- setenv_var LD_PRELOAD $mktimelib_file
541+ if {$tcl_platform(os) ne "Darwin"} {
542+ setenv_var LD_PRELOAD $mktimelib_file
543+ } else {
544+ setenv_var DYLD_INSERT_LIBRARIES $mktimelib_file
545+ }
512546 set ans [list]
513547 lappend ans "$error_msgs: couldn't convert to Epoch time: .*"
514548 lappend ans $vers_reportre
515549 testouterr_cmd_re sh -V OK [join $ans \n]
516550
517551 unsetenv_var TESTSUITE_ENABLE_SITECONFIG_TCLEXTLIBFAILEDMKTIME
518- unsetenv_var LD_PRELOAD
552+ if {$tcl_platform(os) ne "Darwin"} {
553+ unsetenv_var LD_PRELOAD
554+ } else {
555+ unsetenv_var DYLD_INSERT_LIBRARIES
556+ }
519557} elseif {$verbose} {
520558 send_user "\tSkip tcl ext lib erroneous procedure calls as mktime test lib is not available\n"
521559}
0 commit comments