Checkout
stefan2
committed
on 25 Nov 13
Add "--parallel" option to our C tests.

Besides shaving off a few seconds off our total test execution time,
parallel execution also stress… Show more
Add "--parallel" option to our C tests.

Besides shaving off a few seconds off our total test execution time,

parallel execution also stresses our code and the tests themselves

harder.  It uncovers things like improperly separated working sets

that make post-failure analysis harder.

Parallel mode is only available with APR 1.3+ and threads enabled.

The option will simply be ignored in other configurations. Further

limitations are cleanups being delayed to after all tests completed

and segfaults not being intercepted.

Some tests can't be executed in parallel.  Therefore, we introduce

svn_test_max_threads a simple upper limit to the number of threads

supported that each test must define alongside the test_funcs array.

This patch sets it to "1" in many cases because the tests are so

small that multi-threaded execution is simply not worth it.

* build/run_tests.py

 (TestHarness._run_c_test): Pass --parallel option to the individual

                            test applications.

* subversion/tests/svn_test.h

 (svn_test_max_threads): Declare new external setting to be set by

                         every test application.

* subversion/tests/svn_test_main.c

 (parallel): New command line option presence flag.

 (parallel_opt,

  cl_options): Declare the new "--parallel" option.

 (svn_test_add_dir_cleanup): Synchronize shared pool access since

                             this might be called from multiple

                             threads at the same time.

 (log_results): Result logger function factored out from do_test_num

                to be shared between serialized and parallel test

                execution code.

 (do_test_num): Use that new function.

 (test_params_t,

  test_thread,

  do_tests_concurrently): Threads, their parameter and the thread

                          starter for thread-pooled test execution.

 (main): Handle the new option.

         Call concurrent execution when in PARALLEL mode.

* subversion/tests/libsvn_delta/random-test.c

 subversion/tests/libsvn_subr/named_atomic-test.c

 (svn_test_max_threads): These tests don't support concurrent execution.

* subversion/tests/libsvn_delta/random-test.c

 subversion/tests/libsvn_delta/window-test.c

 subversion/tests/libsvn_diff/parse-diff-test.c

 subversion/tests/libsvn_ra_local/ra-local-test.c

 subversion/tests/libsvn_ra/ra-test.c

 subversion/tests/libsvn_subr/auth-test.c

 subversion/tests/libsvn_subr/cache-test.c

 subversion/tests/libsvn_subr/checksum-test.c

 subversion/tests/libsvn_subr/compat-test.c

 subversion/tests/libsvn_subr/config-test.c

 subversion/tests/libsvn_subr/crypto-test.c

 subversion/tests/libsvn_subr/dirent_uri-test.c

 subversion/tests/libsvn_subr/error-code-test.c

 subversion/tests/libsvn_subr/error-test.c

 subversion/tests/libsvn_subr/hashdump-test.c

 subversion/tests/libsvn_subr/mergeinfo-test.c

 subversion/tests/libsvn_subr/named_atomic-test.c

 subversion/tests/libsvn_subr/opt-test.c

 subversion/tests/libsvn_subr/packed-data-test.c

 subversion/tests/libsvn_subr/path-test.c

 subversion/tests/libsvn_subr/prefix-string-test.c

 subversion/tests/libsvn_subr/priority-queue-test.c

 subversion/tests/libsvn_subr/revision-test.c

 subversion/tests/libsvn_subr/root-pools-test.c

 subversion/tests/libsvn_subr/skel-test.c

 subversion/tests/libsvn_subr/spillbuf-test.c

 subversion/tests/libsvn_subr/sqlite-test.c

 subversion/tests/libsvn_subr/stream-test.c

 subversion/tests/libsvn_subr/string-test.c

 subversion/tests/libsvn_subr/subst_translate-test.c

 subversion/tests/libsvn_subr/time-test.c

 subversion/tests/libsvn_subr/utf-test.c

 subversion/tests/libsvn_wc/conflict-data-test.c

 subversion/tests/libsvn_wc/wc-queries-test.c:

 (svn_test_max_threads): These are too small to benefit from multi-threading.

* subversion/tests/libsvn_client/client-test.c

 subversion/tests/libsvn_diff/diff-diff3-test.c

 subversion/tests/libsvn_fs_base/changes-test.c

 subversion/tests/libsvn_fs_base/fs-base-test.c

 subversion/tests/libsvn_fs_base/strings-reps-test.c

 subversion/tests/libsvn_fs_fs/fs-fs-pack-test.c

 subversion/tests/libsvn_fs/fs-test.c

 subversion/tests/libsvn_fs/locks-test.c

 subversion/tests/libsvn_fs_x/fs-x-pack-test.c

 subversion/tests/libsvn_fs_x/string-table-test.c

 subversion/tests/libsvn_repos/repos-test.c

 subversion/tests/libsvn_subr/io-test.c

 subversion/tests/libsvn_subr/translate-test.c

 subversion/tests/libsvn_wc/db-test.c

 subversion/tests/libsvn_wc/op-depth-test.c

 subversion/tests/libsvn_wc/wc-test.c

 (svn_test_max_threads): Set concurrency limit to whatever various test

                         runs suggested as the most efficient value.

* subversion/tests/libsvn_wc/entries-compat.c

 subversion/tests/libsvn_wc/pristine-store-test.c

 (svn_test_max_threads): Set concurrency limit to "unbounded".

Show less