Tests for grompp -f -po
authorMark Abraham <mark.j.abraham@gmail.com>
Mon, 13 Feb 2017 17:39:45 +0000 (18:39 +0100)
committerBerk Hess <hess@kth.se>
Mon, 13 Mar 2017 09:53:18 +0000 (10:53 +0100)
commit93c7f07bdc117a3d69c500ce93418083225b0acf
tree72f8c1a08e6ca77c3e26de7a7598dcd836a6353f
parenta6d9b79c30848065328d7c7a688e80b244035817
Tests for grompp -f -po

This requires slight refactoring so that when testing we can avoid
writing the header. The header has useful things embedded in it (date,
user name, etc.) but those are not reproducible in a test. All the old
callers of write_inpfile now pass a value that triggers the same
behaviour they used to have, of writing the helpful header. The new
testcase fixture avoids writing that header.

It would be preferable not to write files during testing, which will
be possible with some follow-up changes permit read_inpfile and
write_inputfile to use text stream interfaces.

A bug in the handling of mdp reading and handling was exposed and is
fixed. The use of inp_count is poorly designed, and does not work in
the edge case where there are no keys in the input file. Touching an
empty file to give to grompp for it to fill is something that people
actually do to get a full mdp file to edit, so we should make it work
soundly.

Fixes #2074

Change-Id: Ibd3901d39333eb601e716430dec65f0c290af858
15 files changed:
src/gromacs/fileio/readinp.cpp
src/gromacs/fileio/readinp.h
src/gromacs/gmxana/gmx_xpm2ps.cpp
src/gromacs/gmxpreprocess/grompp.cpp
src/gromacs/gmxpreprocess/readir.cpp
src/gromacs/gmxpreprocess/readir.h
src/gromacs/gmxpreprocess/tests/CMakeLists.txt
src/gromacs/gmxpreprocess/tests/readir.cpp [new file with mode: 0644]
src/gromacs/gmxpreprocess/tests/refdata/GetIrTest_EmptyInputWorks.xml [new file with mode: 0644]
src/gromacs/gmxpreprocess/tests/refdata/GetIrTest_HandlesDifferentKindsOfMdpLines.xml [new file with mode: 0644]
src/gromacs/gmxpreprocess/tests/refdata/GetIrTest_HandlesOnlyCutoffScheme.xml [new file with mode: 0644]
src/gromacs/gmxpreprocess/tests/refdata/GetIrTest_ProducesOutputFromElectricField.xml [new file with mode: 0644]
src/gromacs/gmxpreprocess/tests/refdata/GetIrTest_UserErrorsSilentlyTolerated.xml [new file with mode: 0644]
src/programs/mdrun/membed.cpp
src/programs/mdrun/tests/moduletest.cpp