Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nexus: enable command line and add user example tests #875

Merged
merged 3 commits into from
Jun 1, 2018

Conversation

jtkrogel
Copy link
Contributor

Currently Nexus user examples are run in generate only mode via ctest in the QMCPACK distribution. To do so, each user example input file was modified as a workaround to change the default setting of generate_only from "False" to "True".

This PR extends Nexus to accept command line inputs to override the settings present in any Nexus user script. This facility is used to run all user examples within ntest in generate_only mode without modification to the user-facing files.

In addition to checking for the existence of generated files, the new tests supersede those in ctest by checking that generated files match the contents of a set of reference files. This is done by comparing the nested contents of the Nexus object representation of reference and generated files, which includes comparison of floating point values within a tolerance. Future tests are needed to ensure the continued correct reading and writing of input files based on this object representation. Existing ctest tests for the user examples will be removed in a future PR as these are now duplicated with ctest running ntest directly.

The ntest testing script has been extended to generate and update reference data as needed via two new command line inputs (--generate_reference and --update_reference, see "ntest -h" for command line documentation). The idea here is to first check whether all tests pass. If the current tests fail due to an intentional change (e.g. what default fields are written to QMCPACK input files), then the reference files can be automatically updated to the newly intended reference state.

@jtkrogel jtkrogel requested a review from markdewing May 31, 2018 14:48
@ghost ghost assigned jtkrogel May 31, 2018
@ghost ghost added the in progress label May 31, 2018
@qmc-robot
Copy link

Can one of the maintainers verify this patch?

1 similar comment
@qmc-robot
Copy link

Can one of the maintainers verify this patch?

@ye-luo
Copy link
Contributor

ye-luo commented May 31, 2018

Okay to test

@jtkrogel jtkrogel mentioned this pull request May 31, 2018
56 tasks
if verbose:
print 'Executing:\n '+command
#end if
out,err = Popen(command,shell=True,stdout=PIPE,stderr=PIPE,close_fds=True).communicate()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The return value of the executed command should be checked for success or failure (or at least passed to the caller so that function can check)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Return value added, see commit.

#end if

# copy over nexus user examples into reference generation directory
execute('rsync -av {0}/* {1}/'.format(example_dir,refgen_example_dir))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checking for success would be good here. A failure to copy the files here will lead to cascading failures that are harder to track down.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. Added a check both here and where a similar command is executed within the testing environment.

@jtkrogel
Copy link
Contributor Author

Better?

@jtkrogel
Copy link
Contributor Author

jtkrogel commented Jun 1, 2018

Is anything else needed here? I am preparing another PR that depends on this one.

@ghost ghost assigned prckent Jun 1, 2018
@prckent
Copy link
Contributor

prckent commented Jun 1, 2018

I believe that this is ready, so we will merge unless anyone objects before the CI completes...

Copy link
Contributor

@ye-luo ye-luo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the points of @markdewing are addressed.

@ye-luo ye-luo merged commit c057b6a into QMCPACK:develop Jun 1, 2018
@ghost ghost removed the in progress label Jun 1, 2018
@jtkrogel jtkrogel deleted the nx_example_tests branch August 30, 2018 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants