Commit ab01045bcdb6ec7555fe0364d75139fcfa361991

Authored by Jay Berkenbilt
1 parent 72e5c734

qtest: don't run coverage when TESTS is given

manual/installation.rst
@@ -144,7 +144,17 @@ Run ``ctest`` to run the test suite. Since the real tests are @@ -144,7 +144,17 @@ Run ``ctest`` to run the test suite. Since the real tests are
144 implemented with `qtest <https://qtest.sourceforge.io/>`__, you will 144 implemented with `qtest <https://qtest.sourceforge.io/>`__, you will
145 want to pass ``--verbose`` to ``cmake`` so you can see the individual 145 want to pass ``--verbose`` to ``cmake`` so you can see the individual
146 test outputs. Otherwise, you will see a small number of ``ctest`` 146 test outputs. Otherwise, you will see a small number of ``ctest``
147 -commands that take a very long to run. 147 +commands that take a very long to run. If you want to run only a
  148 +specific test file in a specific test suite, you can set the ``TESTS``
  149 +environment variable (used by ``qtest-driver``) and pass the ``-R``
  150 +parameter to ``ctest``. For example:
  151 +
  152 +::
  153 +
  154 + TESTS=qutil ctest --verbose -R libtests
  155 +
  156 +would run only ``qutil.test`` from the ``libtests`` test suite.
  157 +
148 158
149 .. _installation: 159 .. _installation:
150 160
run-qtest
@@ -58,8 +58,16 @@ while (@ARGV) @@ -58,8 +58,16 @@ while (@ARGV)
58 { 58 {
59 # On Windows, a literal glob in quotes is expanded by the 59 # On Windows, a literal glob in quotes is expanded by the
60 # shell, so we have to handle globs when expanded by the 60 # shell, so we have to handle globs when expanded by the
61 - # shell.  
62 - push(@tc, shift(@ARGV)); 61 + # shell by consuming arguments until the next --.
  62 +
  63 + my $t = shift(@ARGV);
  64 + if (exists $ENV{'TESTS'})
  65 + {
  66 + # No point enabling coverage if we're intentionally
  67 + # running only a subset of tests.
  68 + next;
  69 + }
  70 + push(@tc, $t);
63 } 71 }
64 } 72 }
65 elsif ($arg eq '--env') 73 elsif ($arg eq '--env')