Example #1
0
void CommandLine::merge(const CommandLine &args)
{
    // Skip first argument if it is the module name.
    const int firstArg = (args.arg(0)[0] == '-' ? 0 : 1);
    for (int i = firstArg; i < args.argc(); ++i)
    {
        append(args.arg(i));
    }
}
void CommandLineModuleManagerTestBase::initManager(
        const CommandLine &args, const char *realBinaryName)
{
    impl_->manager_.reset();
    impl_->programContext_.reset(
            new gmx::CommandLineProgramContext(args.argc(), args.argv()));
    impl_->manager_.reset(new gmx::CommandLineModuleManager(
                                  realBinaryName, impl_->programContext_.get()));
    impl_->manager_->setQuiet(true);
    impl_->manager_->setOutputRedirector(&impl_->redirector_);
}
Example #3
0
void
AbstractTrajectoryAnalysisModuleTestFixture::runTest(const CommandLine &args)
{
    TrajectoryAnalysisModule &module = impl_->module();
    // Skip first argument if it is the module name.
    int firstArg = (args.arg(0)[0] == '-' ? 0 : 1);
    for (int i = firstArg; i < args.argc(); ++i)
    {
        impl_->cmdline_.append(args.arg(i));
    }

    TestReferenceChecker rootChecker(impl_->data_.rootChecker());

    rootChecker.checkString(args.toString(), "CommandLine");

    if (!impl_->outputDatasets_.empty())
    {
        TestReferenceChecker               dataChecker(
                rootChecker.checkCompound("OutputData", "Data"));
        Impl::DatasetNames::const_iterator dataset;
        for (dataset = impl_->outputDatasets_.begin();
             dataset != impl_->outputDatasets_.end();
             ++dataset)
        {
            const char           *name    = dataset->c_str();
            AbstractAnalysisData &dataset = module.datasetFromName(name);
            AnalysisDataTestFixture::addReferenceCheckerModule(
                    dataChecker, name, &dataset);
        }
    }

    TrajectoryAnalysisCommandLineRunner runner(&module);
    runner.setPrintCopyright(false);
    int rc = 0;
    EXPECT_NO_THROW_GMX(rc = runner.run(impl_->cmdline_.argc(), impl_->cmdline_.argv()));
    EXPECT_EQ(0, rc);

    if (!impl_->outputFiles_.empty())
    {
        TestReferenceChecker                 outputChecker(
                rootChecker.checkCompound("OutputFiles", "Files"));
        Impl::OutputFileList::const_iterator outfile;
        for (outfile = impl_->outputFiles_.begin();
             outfile != impl_->outputFiles_.end();
             ++outfile)
        {
            std::string output = File::readToString(outfile->path);
            outputChecker.checkStringBlock(output, outfile->option.c_str());
        }
    }
}
Example #4
0
int
SimulationRunner::callGromppOnThisRank()
{
    CommandLine caller;
    caller.append("grompp");
    caller.addOption("-f", mdpInputFileName_);
    caller.addOption("-n", ndxFileName_);
    caller.addOption("-p", topFileName_);
    caller.addOption("-c", groFileName_);

    caller.addOption("-po", mdpOutputFileName_);
    caller.addOption("-o", tprFileName_);

    return gmx_grompp(caller.argc(), caller.argv());
}
Example #5
0
CommandLine::CommandLine(const CommandLine &other)
    : impl_(new Impl(other.argv(), other.argc()))
{
}