@@ -2373,6 +2373,8 @@ def test_toy_sanity_check_commands(self):
23732373 test_easyconfigs = os .path .join (os .path .dirname (os .path .abspath (__file__ )), 'easyconfigs' , 'test_ecs' )
23742374 toy_ec_txt = read_file (os .path .join (test_easyconfigs , 't' , 'toy' , 'toy-0.0.eb' ))
23752375
2376+ out_file = os .path .join (self .test_prefix , 'out.txt' )
2377+
23762378 toy_ec_txt = '\n ' .join ([
23772379 toy_ec_txt ,
23782380 "toolchain = {'name': 'foss', 'version': '2018a'}" ,
@@ -2388,6 +2390,8 @@ def test_toy_sanity_check_commands(self):
23882390 " True," ,
23892391 # test command to make sure that '-h' is not passed to commands specified as string ('env -h' fails)
23902392 " 'env',"
2393+ # print current working directory, should *not* be software install directory, but empty dir
2394+ f" '(pwd && ls | wc -l) > { out_file } '," ,
23912395 "]" ,
23922396 ])
23932397
@@ -2412,6 +2416,13 @@ def test_toy_sanity_check_commands(self):
24122416
24132417 self .assertExists (toy_modfile )
24142418
2419+ # check contents of output file created by sanity check commands
2420+ self .assertExists (out_file )
2421+ out_txt = read_file (out_file )
2422+ # working dir for sanity check command should be an empty custom temporary directory
2423+ regex = re .compile ('^.*/eb-[^/]+/eb-sanity-check-[^/]+\n [ ]*0$' )
2424+ self .assertTrue (regex .match (out_txt ), f"Pattern '{ regex .pattern } ' should match in: { out_txt } " )
2425+
24152426 def test_sanity_check_paths_lib64 (self ):
24162427 """Test whether fallback in sanity check for lib64/ equivalents of library files works."""
24172428 test_ecs_dir = os .path .join (os .path .abspath (os .path .dirname (__file__ )), 'easyconfigs' )
0 commit comments