Skip to content

Commit

Permalink
Feel like I'm getting into hacking territory
Browse files Browse the repository at this point in the history
It turns out that there are some baked in assumptions of where the App is located
relative to the testroot. There are some nasty hacks to locate it in a normal
installation location, but this doesn't work if you install elsewhere (like we have
to for the test). In order to get the TestHarness to behave, it's easiest to just
link the executable to the fake test hierarchy. This part isn't a hack ;)

Next Problem, the TestHarness currently checks for the working directory to exist
in the Runnable phase, which occurs asyncronously to the scheduled launch of the
test. This is a no go, since we are trying to copy the directory structure in the test
so it won't exist for latter tests. So... I moved the working directory check to
the place where we actually launch the test. This would be OK, but apparently there
are other assumptions baked into the Job class. I had to start/stop the timer to
avoid an index out of range.

Now the tests are running properly.

refs idaholab#19022
  • Loading branch information
permcody authored and grmnptr committed Mar 28, 2022
1 parent 16abc72 commit 0975e7d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 8 deletions.
12 changes: 9 additions & 3 deletions python/TestHarness/testers/Tester.py
Expand Up @@ -315,6 +315,14 @@ def runCommand(self, cmd, cwd, timer, options):
cmd = self.getCommand(options)
cwd = self.getTestDir()

# Verify that the working directory is available right before we execute.
if not os.path.exists(cwd):
# Timers must be used since they are directly indexed in the Job class
timer.start()
self.setStatus(self.fail, 'WORKING DIRECTORY NOT FOUND')
timer.stop()
return

self.process = None
try:
f = SpooledTemporaryFile(max_size=1000000) # 1M character buffer
Expand Down Expand Up @@ -637,12 +645,10 @@ def checkRunnableBase(self, options):
if missing:
reasons['requires'] = ', '.join(['no {}'.format(p) for p in missing])

# Verify working_directory is relative and available
# Verify working_directory is relative. We'll check to make sure it's available just in time.
if self.specs['working_directory']:
if self.specs['working_directory'][:1] == os.path.sep:
self.setStatus(self.fail, 'ABSOLUTE PATH DETECTED')
elif not os.path.exists(self.getTestDir()):
self.setStatus(self.fail, 'WORKING DIRECTORY NOT FOUND')

##### The below must be performed last to register all above caveats #####
# Remove any matching user supplied caveats from accumulated checkRunnable caveats that
Expand Down
23 changes: 18 additions & 5 deletions test/tests/make_install/tests
Expand Up @@ -14,16 +14,16 @@
requirement = 'The system shall support the ability to "install" inputs:'
[setup_fake_test_structure]
type = 'RunCommand'
command = 'rm -rf moose_test_tests; rm -rf ../../../share/moose_test; mkdir -p ../../../share/moose_test/tests; cp -R ../kernels/2d_diffusion ../../../share/moose_test/tests/; cp ../../testroot ../../../share/moose_test/tests/'
command = 'rm -rf moose_test_tests; rm -rf ../../../share/moose_test; mkdir -p ../../../share/moose_test/tests/version; cp ../misc/version/tests ../../../share/moose_test/tests/version; cp ../../testroot ../../../share/moose_test/tests/'
installed = False

detail = 'from a pre-determined user-readable location;'
[]

[copy_tests]
type = 'RunApp'
input = 'DUMMY'
cli_args = "--copy-inputs tests"
no_additional_cli_args = True
expect_out = 'Directory successfully copied'
installed = False
prereq = 'test_copy_install/setup_fake_test_structure'
Expand All @@ -35,7 +35,7 @@
type = 'CheckFiles'
input = 'DUMMY'
should_execute = False
check_files = 'moose_test_tests/testroot moose_test_tests/2d_diffusion/tests'
check_files = 'moose_test_tests/testroot moose_test_tests/version/tests'
installed = False
prereq = 'test_copy_install/copy_tests'

Expand All @@ -44,21 +44,34 @@

[copy_warn_overwrite]
type = 'RunException'
input = 'DUMMY'
cli_args = "--copy-inputs tests"
no_additional_cli_args = True
expect_err = 'The directory \S+ already exists.'
installed = False
prereq = 'test_copy_install/check_files'

detail = 'able to report an error if overwriting may occur using a MOOSE-based binary;'
[]

[link_exec_installed]
type = 'RunCommand'
command = 'ln -s ../../../moose_test-opt .'
working_directory = "./moose_test_tests"
installed = False
method = opt
prereq = 'test_copy_install/copy_warn_overwrite'

detail = 'able to link a binary to an installed location;'
[]

[run]
type = 'RunApp'
cli_args = "--run tests"
working_directory = "./moose_test_tests"
no_additional_cli_args = True
installed = False
prereq = 'test_copy_install/copy_warn_overwrite'
method = opt
prereq = 'test_copy_install/link_exec_installed'

detail = 'able to successfully launch the TestHarness using a MOOSE-based binary;'
[]
Expand Down

0 comments on commit 0975e7d

Please sign in to comment.