/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2011,2012,2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2011,2012,2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
// TODO: Make this a real enum; requires solving a TODO in StringOption.
int g_referenceDataMode = gmx::test::erefdataCompare;
+//! Returns the global reference data mode.
+gmx::test::ReferenceDataMode getReferenceDataMode()
+{
+ return static_cast<gmx::test::ReferenceDataMode>(g_referenceDataMode);
+}
+
} // namespace
namespace gmx
namespace test
{
-ReferenceDataMode getReferenceDataMode()
-{
- return static_cast<ReferenceDataMode>(g_referenceDataMode);
-}
-
-void setReferenceDataMode(ReferenceDataMode mode)
-{
- g_referenceDataMode = mode;
-}
-
-std::string getReferenceDataPath()
-{
- return TestFileManager::getInputFilePath("refdata");
-}
-
void initReferenceData(Options *options)
{
// Needs to correspond to the enum order in refdata.h.
TestReferenceData::Impl::Impl(ReferenceDataMode mode, bool bSelfTestMode)
: refDoc_(NULL), bWrite_(false), bSelfTestMode_(bSelfTestMode), bInUse_(false)
{
- std::string dirname = getReferenceDataPath();
- std::string filename = TestFileManager::getTestSpecificFileName(".xml");
- fullFilename_ = Path::join(dirname, filename);
+ const std::string dirname =
+ bSelfTestMode
+ ? TestFileManager::getGlobalOutputTempDirectory()
+ : TestFileManager::getInputDataDirectory();
+ const std::string filename = TestFileManager::getTestSpecificFileName(".xml");
+ fullFilename_ = Path::join(dirname, "refdata", filename);
bWrite_ = true;
if (mode != erefdataUpdateAll)
{
if (bWrite_ && bInUse_ && refDoc_ != NULL)
{
- std::string dirname = getReferenceDataPath();
+ std::string dirname = Path::getParentPath(fullFilename_);
if (!Directory::exists(dirname))
{
if (Directory::create(dirname) != 0)
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2011,2012,2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2011,2012,2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* Mode of operation for reference data handling.
*
* There should be no need to use this type outside the test utility module.
+ *
+ * \ingroup module_testutils
*/
enum ReferenceDataMode
{
erefdataUpdateAll
};
-/*! \libinternal \brief
- * Returns the global reference data mode.
- *
- * There should be no need to use this function outside the test utility module.
- */
-ReferenceDataMode getReferenceDataMode();
-/*! \libinternal \brief
- * Sets the global reference data mode.
- *
- * There should be no need to use this function outside the test utility module.
- */
-void setReferenceDataMode(ReferenceDataMode mode);
-/*! \libinternal \brief
- * Returns the directory where reference data files are stored.
- *
- * There should be no need to use this function outside the test utility module.
- */
-std::string getReferenceDataPath();
/*! \libinternal \brief
* Initializes reference data handling.
*
* Adds command-line options to \p options to set the reference data mode.
- * By default, ::erefdataCompare is used, but \c "--ref-data create" or
- * \c "--ref-data update" can be used to change it.
+ * By default, ::erefdataCompare is used, but ``--ref-data create`` or
+ * ``--ref-data update`` can be used to change it.
*
* This function is automatically called by initTestUtils().
+ *
+ * \ingroup module_testutils
*/
void initReferenceData(Options *options);
-
class TestReferenceChecker;
/*! \libinternal \brief
/*! \brief
* Initializes the reference data in a specific mode.
*
- * This function is mainly useful for self-testing the reference data
+ * This function is only useful for self-testing the reference data
* framework. As such, it also puts the framework in a state where it
* logs additional internal information for failures to help diagnosing
- * problems in the framework.
+ * problems in the framework, and stores the reference data in a
+ * temporary directory instead of the source tree.
* The default constructor should be used in tests utilizing this class.
*/
explicit TestReferenceData(ReferenceDataMode mode);