Skip to content

why many tests fail when run in parallel #359

Description

@jepler

A build that should do nothing occasionaly does something:

This is an example of how cmake is invoked during the ctest process:

$ /usr/bin/cmake "--build" "." "--target" "lazy_sdai_ap210e3" "--config" "Debug"
[  0%] Built target express_verify
[  3%] Generating ver_string
-- sc_version_string.h is up-to-date.
[  3%] Built target version_string
[  6%] Built target base
[ 21%] Built target express
[ 30%] Built target libexppp
[ 45%] Built target exp2cxx
[ 45%] Built target generate_cpp_sdai_ap210e3
[ 51%] Built target steputils
[ 57%] Built target stepdai
[ 87%] Built target stepcore
[ 90%] Built target stepeditor
[ 96%] Built target sdai_ap210e3
[100%] Built target steplazyfile
[100%] Built target lazy_sdai_ap210e3

as you can see, it has the chance to rebuild lots of targets, such as shared libraries. In fact, sometimes it will. After making sure to wait at least one minute, I ran the same command that didn't do anything before:

$ /usr/bin/cmake "--build" "." "--target" "lazy_sdai_ap210e3" "--config" "Debug"
[  0%] Built target express_verify
[  3%] Generating ver_string
-- sc_version_string.h is up-to-date.
[  3%] Built target version_string
[  6%] Built target base
Scanning dependencies of target express
[  6%] Building C object src/express/CMakeFiles/express.dir/info.c.o
[  9%] Linking CXX shared library ../../lib/libexpress.so
[ 21%] Built target express
Scanning dependencies of target libexppp
[ 21%] Building C object src/exppp/CMakeFiles/libexppp.dir/pretty_schema.c.o
[ 21%] Linking C shared library ../../lib/libexppp.so
[ 30%] Built target libexppp
Scanning dependencies of target exp2cxx
[ 30%] Building C object src/exp2cxx/CMakeFiles/exp2cxx.dir/classes_misc.c.o
[ 33%] Building C object src/exp2cxx/CMakeFiles/exp2cxx.dir/__/express/fedex.c.o
[ 36%] Linking CXX executable ../../bin/exp2cxx
[ 45%] Built target exp2cxx
[ 45%] Built target generate_cpp_sdai_ap210e3
[ 51%] Built target steputils
[ 57%] Built target stepdai
[ 87%] Built target stepcore
[ 90%] Built target stepeditor
[ 96%] Built target sdai_ap210e3
[100%] Built target steplazyfile
[100%] Built target lazy_sdai_ap210e3

The cause for this is: the generated header file ./include/sc_version_string.h was modified. This, in turn, is because of the decision to include the date and time (with hours and minutes):

static char sc_version[512] = {
    "git commit id: v0.8-185-gb24680d7, build timestamp 15 Aug 2017 17:45"
};

so if the ctests happen to

  • run for more than one minute
  • run with parallelism enabled
    then you encounter the situation that both ctests are trying to update the same targets at the same time, such as CXX shared library ../../lib/libexpress.so (and its symlink, libexpress.so.2.0.0), which can lead to errors such as
make[3]: *** No rule to make target 'lib/libexpress.so.2.0.0', needed by 'lib/libexppp.so.2.0.0'.  Stop.
CMakeFiles/Makefile2:1445: recipe for target 'src/exppp/CMakeFiles/libexppp.dir/all' failed

and failed tests reported by ctests.

I recommend dropping the "build timestamp" from the version string as the easiest way to resolve this class of problems.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions