@@ -443,6 +443,14 @@ def test_toy_download_sources(self):
443443 def test_toy_permissions (self ):
444444 """Test toy build with custom umask settings."""
445445 toy_ec_file = os .path .join (os .path .dirname (__file__ ), 'easyconfigs' , 'test_ecs' , 't' , 'toy' , 'toy-0.0.eb' )
446+ test_ec_txt = read_file (toy_ec_file )
447+
448+ # remove exec perms on bin subdirectory for others, to check whether correct dir permissions are set
449+ test_ec_txt += "\n postinstallcmds += ['chmod o-x %(installdir)s/bin']"
450+
451+ test_ec = os .path .join (self .test_prefix , 'test.eb' )
452+ write_file (test_ec , test_ec_txt )
453+
446454 args = [
447455 '--sourcepath=%s' % self .test_sourcepath ,
448456 '--buildpath=%s' % self .test_buildpath ,
@@ -456,7 +464,7 @@ def test_toy_permissions(self):
456464 orig_umask = os .umask (0o022 )
457465
458466 # test specifying a non-existing group
459- allargs = [toy_ec_file ] + args + ['--group=thisgroupdoesnotexist' ]
467+ allargs = [test_ec ] + args + ['--group=thisgroupdoesnotexist' ]
460468 outtxt , err = self .eb_main (allargs , logfile = self .dummylogfn , do_build = True , return_error = True )
461469 err_regex = re .compile ("Failed to get group ID .* group does not exist" )
462470 self .assertTrue (err_regex .search (outtxt ), "Pattern '%s' found in '%s'" % (err_regex .pattern , outtxt ))
@@ -479,10 +487,10 @@ def test_toy_permissions(self):
479487 shutil .rmtree (self .test_installpath )
480488
481489 if cfg_group is None and ec_group is None :
482- allargs = [toy_ec_file ]
490+ allargs = [test_ec ]
483491 elif ec_group is not None :
484- shutil .copy2 (toy_ec_file , self .test_buildpath )
485- tmp_ec_file = os .path .join (self .test_buildpath , os .path .basename (toy_ec_file ))
492+ shutil .copy2 (test_ec , self .test_buildpath )
493+ tmp_ec_file = os .path .join (self .test_buildpath , os .path .basename (test_ec ))
486494 write_file (tmp_ec_file , "\n group = '%s'" % ec_group , append = True )
487495 allargs = [tmp_ec_file ]
488496 allargs .extend (args )
@@ -527,7 +535,7 @@ def test_toy_permissions(self):
527535 perms = os .stat (fullpath ).st_mode & 0o777
528536 tup = (fullpath , oct (correct_perms ), oct (perms ), umask , cfg_group , ec_group )
529537 msg = "Path %s has %s permissions: %s (umask: %s, group: %s - %s)" % tup
530- self .assertEqual (perms , correct_perms , msg )
538+ self .assertEqual (oct ( perms ), oct ( correct_perms ) , msg )
531539 if group is not None :
532540 path_gid = os .stat (fullpath ).st_gid
533541 self .assertEqual (path_gid , grp .getgrnam (group ).gr_gid )
0 commit comments