Skip to content

Commit

Permalink
Remove sinfo dependency
Browse files Browse the repository at this point in the history
Remove the dependency on sinfo so that the tests can run on a system without
slurm. Also, fixed the wording of a few error messages.

Signed-off-by: John H. Hartman <[email protected]>
  • Loading branch information
jhh67 committed Mar 7, 2024
1 parent f985290 commit 360189b
Showing 1 changed file with 3 additions and 21 deletions.
24 changes: 3 additions & 21 deletions test/runtime/configMatters/launch/jhh/co-locales/co-locales.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,24 +62,11 @@ def setup():
class ColocaleArgs(unittest.TestCase):
@classmethod
def setUpClass(cls):
global numSockets
# Should not be set by default
if 'CHPL_RT_LOCALES_PER_NODE' in os.environ:
del os.environ['CHPL_RT_LOCALES_PER_NODE']

# Determine the number of sockets per node
cmd = ["sinfo", "--format=%X", "--noheader", "--exact"]
partition = os.environ.get('CHPL_LAUNCHER_PARTITION', None)
partition = os.environ.get('SLURM_PARTITION', partition)
if partition is not None:
cmd += ["--partition", partition]
if verbose:
print("Partition: ", partition)

numSockets = int(runCmd(cmd))
if numSockets == 1:
self.skipTest("Node has only one socket.")

os.environ['CHPL_LAUNCHER_SLURM_VERSION'] = 'slurm'
os.environ['CHPL_LAUNCHER_CORES_PER_LOCALE'] = '256'
def setUp(self):
if skipReason is not None:
self.skipTest(skipReason)
Expand Down Expand Up @@ -196,7 +183,6 @@ def test_15_env_override(self):
"""Arg overrides CHPL_RT_LOCALES_PER_NODE"""
self.env['CHPL_RT_LOCALES_PER_NODE'] = '4'
output = self.runCmd("./hello -nl 3x2 -v --dry-run")
print(output)
self.assertTrue('--nodes=3' in output or '-N 3' in output)
self.assertIn('--ntasks=6', output)

Expand All @@ -213,7 +199,7 @@ def test_17_invalid_suffix(self):
with self.assertRaises(subprocess.CalledProcessError) as cm:
output = self.runCmd("./hello -nl -3x2z -v --dry-run")
self.assertEqual(cm.exception.stdout.strip(),
'<command-line arg>:1: error: "z" is not a valid suffix.')
'<command-line arg>:1: error: "2z" is not a valid number of co-locales.')

def test_18_invalid_suffix2(self):
"""Reject invalid suffix that starts with a valid character"""
Expand Down Expand Up @@ -312,10 +298,6 @@ def main(argv):
name = os.path.join(getDir(compiler), argv[0])
del argv[1]

# Add sbatch and srun to our path
path = os.environ['PATH']
os.environ['PATH'] = os.path.join(os.getcwd(), "bin") + ":" + path

if skipReason is None:
# Compile the test program
cmd = compiler + ' hello.chpl'
Expand Down

0 comments on commit 360189b

Please sign in to comment.