Commit Graph

8 Commits

Author SHA1 Message Date
Eric Blake
9693e29395 tests: simplify formatting
The shell version would output 40 extra spaces for a test with
a multiple of 40 sub-tests, and the C version can use the same
printf optimization for avoiding a loop over single space output
as the shell version.

* tests/testutils.c (virtTestMain): Avoid loop for alignment.
* tests/test-lib.sh: Fix formatting when counter is multiple of 40.
2011-07-11 09:21:37 -06:00
Matthias Bolte
b1c9bf27cb tests: Fix compressed test output padding logic
The current logic tries to count from 1 to 40 and ignores paddings
of 0 and 1 to 40. This doesn't work for counter + 1 mod 40 == 0
like here for counter value 159

TEST: virsh-all
      ........................................ 40
      ........................................ 80
      ........................................ 120
      ....................................... 159 OK
PASS: virsh-all

Also seq isn't portable. Therefore, calculate the correct padding
length directly and use printf to output it at once.
2011-07-09 15:40:23 +02:00
Eric Blake
e07cf19fe5 build: don't use "test cond1 -o cond2": it's not portable
* configure.ac: Use "test cond1 || test cond2" instead.
* m4/compiler-flags.m4 (gl_COMPILER_FLAGS): Likewise.
* tests/test-lib.sh (verbose): Likewise.
2010-03-25 09:28:24 +01:00
Jim Meyering
ca7db6cb80 tests: shell script portability and clean-up
* tests/test-lib.sh: "echo -n" is not portable.  Use printf instead.
Remove unnecessary uses of "eval-in-subshell" (subshell is sufficient).
Remove uses of tests' -a operator; it is not portable.
Instead, use "test cond && test cond2".
* tests/schematestutils.sh: Replace use of test's -a.
2010-03-24 09:23:01 +01:00
Matthias Bolte
8a7783c163 tests: Don't add extra padding if counter mod 40 is 0
This change only affects the output of tests that have an exact
multiple of 40 test cases. For example the domainschematest currently:

TEST: domainschematest
      ........................................ 40
      ........................................ 80
      ........................................ 120
      ........................................ 160
      ........................................                                         200 OK
PASS: domainschematest

It outputs additional 40 spaces on the last line.

The domainschematest output is fixed by the change in test-lib.sh. The
change in testutils.c fixes this for tests written in C. Currently no
C test has an exact multiple of 40 test cases, but I checked it and
the same problem exists there.

This patch stops that in both cases.
2010-03-24 01:07:57 +01:00
Daniel P. Berrange
e8ac4a79f1 Make test suite output less verbose
Only print out '.' for each test case, full test output can be
re-enabled with VIR_TEST_VERBOSE=1, or VIR_TEST_DEBUG=XXXX

Sample output now looks like

  TEST: statstest
        ........................................ 40
        ...................................      75  OK
  PASS: statstest
  TEST: qparamtest
        ................................         32  OK
  PASS: qparamtest
  TEST:
        ............                             12  OK
2010-01-15 16:28:05 +00:00
Jim Meyering
3ce465f819 Don't fail to read a file because it's non-seekable (e.g., a pipe).
* src/util.c (fread_file_lim): New function.
(__virFileReadAll): Use fread_file_lim, rather than requiring
that stat.st_size provide a usable file size.
* tests/read-non-seekable: New test, for the above.
* tests/Makefile.am (test_scripts): Add read-non-seekable.
* tests/test-lib.sh (mkfifo_or_skip_): New helper function.
2008-04-08 15:33:16 +00:00
Jim Meyering
f15efcdf27 Add new testing framework and the first test to use it.
* tests/Makefile.am (test_scripts): Add vcpupin.
(EXTRA_DIST): Add test-lib.sh.
* tests/test-lib.sh: Testing framework, from coreutils.
* tests/vcpupin: New file.
* build-aux/mktempd: New file, from gnulib.
* bootstrap: Add posix-shell and mktempd to the list of imported modules.
* gnulib/m4/posix-shell.m4: New file, from gnulib.
2008-03-24 10:19:36 +00:00