Skip to content

Add qmtexec command for running QMT tests directly

Chris Burr requested to merge add-qmtexec into master

This adds a new command qmtexec which can be used to run QMT files. It only runs the basic command and doesn't include any validation of the result.

This was originally going to just be qmtlbexec for lbexec QMT tests however it's trivial to allow it to run all qmt files. Hopefully this also makes it more discoverable as I know when I first saw a qmt file the first thing I tried was qmt<TAB>.

Closes #240 (closed)

Usage

There are two modes of operation, one which actually runs the command immediately:

$ /LHCb/run qmtexec LHCb/GaudiConf/python/GaudiConf/QMTest/tests/basic.qmt
Hello world⏎
$ ./Moore/run qmtexec Moore/Hlt/RecoConf/tests/qmtest/hlt2_fast_reco.qmt
# Truncated
$ ./DaVinci/run qmtexec DaVinci/DaVinciTutorials/tests/qmtest/test_tutorial7_multiple_sel_lines.qmt
# Truncated

Or just print the command that would have been run (including any quoting you might need):

$ ./LHCb/run qmtexec --prepare-only LHCb/GaudiConf/python/GaudiConf/QMTest/tests/basic.qmt
echo -n 'Hello world'

$ ./Moore/run qmtexec --prepare-only Moore/Hlt/RecoConf/tests/qmtest/hlt2_fast_reco.qmt
gaudirun.py '$MOOREROOT/tests/options/mdf_input_and_conds_hlt2.py' '$MOOREROOT/tests/options/download_mdf_input.py' '$RECOCONFROOT/options/hlt2_fast_reco.py'

$ ./LHCb/run qmtexec --prepare-only -C LHCb/CaloFuture/CaloFutureDAQ/tests/qmtest/raw-to-digit.qmt
cd LHCb/CaloFuture/CaloFutureDAQ/tests/qmtest
/home/cburr/stack/Gaudi/InstallArea/x86_64_v2-centos7-gcc11-opt/bin/gaudirun.py /tmp/cburr/qmtexec-pcwq5fos.py

$ ./DaVinci/run qmtexec --prepare-only DaVinci/DaVinciTutorials/tests/qmtest/test_tutorial7_multiple_sel_lines.qmt
lbexec DaVinciTutorials.tutorial7_multiple_sel_lines:main /tmp/cburr/lbexec-hh9l43bv.yaml

Caveats

The only caveat I currently know of is that some tests depend on the current working directory being as expected, though I'm not convinced that's a desirable feature to add. If it's a problem we can always add a warning to stderr if the directory looks like it might be a problem. This has now been implemented as a --chdir and -C flag.

Example:

$ ./LHCb/run qmtexec --prepare-only LHCb/GaudiConf/tests/qmtest/gaudiconf.qms/iohelper.qmt
python ../test_iohelper.py
$ ./LHCb/run qmtexec LHCb/GaudiConf/tests/qmtest/gaudiconf.qms/iohelper.qmt
python: cant open file '/home/cburr/stack/../test_iohelper.py': [Errno 2] No such file or directory
$ cd LHCb/GaudiConf/tests/qmtest
$ ../../../run qmtexec gaudiconf.qms/iohelper.qmt
# Test runs sucessfully
Edited by Chris Burr

Merge request reports