mirror of
https://github.com/textmate/textmate.git
synced 2026-04-28 03:00:34 -04:00
Run tests synchronously by default
Running tests in parallel (which is the default)
results in spurious failures in the `scm` git tests,
probably due to an undiagnosed race condition.
This change lets tests run serially by default,
but provides a flag `-p` (or `--parallel`)
which enables running them in parallel again.
It also adds a variable `test_flags`
which is passed to each test run,
and which can be set by running
env test="-v" ./configure
This commit is contained in:
committed by
Allan Odgaard
parent
bbced5c3f3
commit
597a49015d
@@ -860,11 +860,11 @@ rule link_oak_test
|
||||
description = Link test ‘$out’…
|
||||
|
||||
rule run_test
|
||||
command = $in && touch $out
|
||||
command = $in $test_flags && touch $out
|
||||
description = Run test ‘$in’…
|
||||
|
||||
rule always_run_test
|
||||
command = $in
|
||||
command = $in $test_flags
|
||||
description = Run test ‘$in’…
|
||||
|
||||
rule skip_test
|
||||
|
||||
20
bin/gen_test
20
bin/gen_test
@@ -139,7 +139,8 @@ static void write_usage (FILE* io)
|
||||
fprintf(io, "Usage: %s [-b|--benchmark] [-m|--measure] [-r|--repeat] [-v|--verbose] [-h|--help] [-V|--version]\n", getprogname());
|
||||
fprintf(io, "Options:\n");
|
||||
fprintf(io, " -b/--benchmark Run benchmarks instead of tests.\n");
|
||||
fprintf(io, " -m/--measure Measure time of each test. This disables concurrency.\n");
|
||||
fprintf(io, " -m/--measure Measure time of each test.\n");
|
||||
fprintf(io, " -p/--parallel Run tests in parallel.\n");
|
||||
fprintf(io, " -r/--repeat <n> Number of times to repeat each test/benchmark.\n");
|
||||
fprintf(io, " -v/--verbose Be verbose.\n");
|
||||
fprintf(io, " -h/--help Show this help.\n");
|
||||
@@ -152,6 +153,7 @@ int main (int argc, char const* argv[])
|
||||
{
|
||||
{ "benchmark", no_argument, 0, 'b' },
|
||||
{ "measure", no_argument, 0, 'm' },
|
||||
{ "parallel", no_argument, 0, 'p' },
|
||||
{ "repeat", required_argument, 0, 'r' },
|
||||
{ "verbose", no_argument, 0, 'v' },
|
||||
{ "help", no_argument, 0, 'h' },
|
||||
@@ -160,18 +162,20 @@ int main (int argc, char const* argv[])
|
||||
};
|
||||
|
||||
bool measure = false;
|
||||
bool parallel = false;
|
||||
bool run_benchmarks = false;
|
||||
bool verbose = false;
|
||||
size_t repeat = 1;
|
||||
|
||||
unsigned int ch;
|
||||
while((ch = getopt_long(argc, (char* const*)argv, "bmr:vhV", options, NULL)) != -1)
|
||||
while((ch = getopt_long(argc, (char* const*)argv, "bmpr:vhV", options, NULL)) != -1)
|
||||
{
|
||||
extern char* optarg;
|
||||
switch(ch)
|
||||
{
|
||||
case 'b': run_benchmarks = true; break;
|
||||
case 'm': measure = true; break;
|
||||
case 'p': parallel = true; break;
|
||||
case 'r': repeat = atoi(optarg); break;
|
||||
case 'v': verbose = true; break;
|
||||
case 'h': write_usage(stdout); return 0;
|
||||
@@ -221,17 +225,17 @@ int main (int argc, char const* argv[])
|
||||
if(!run_benchmarks)
|
||||
{
|
||||
dispatch_group_async(group, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||
if(measure)
|
||||
{
|
||||
for(auto test : tests)
|
||||
test.execute(measure, repeat);
|
||||
}
|
||||
else
|
||||
if(parallel)
|
||||
{
|
||||
dispatch_apply(tests.size(), dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(size_t n){
|
||||
tests[n].execute(measure, repeat);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
for(auto test : tests)
|
||||
test.execute(measure, repeat);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
2
configure
vendored
2
configure
vendored
@@ -93,7 +93,7 @@ done
|
||||
mkdir -p "$builddir/Frameworks/SoftwareUpdate/fixtures"
|
||||
DST=$(cd >/dev/null "$builddir/Frameworks/SoftwareUpdate/fixtures"; pwd) make -C Frameworks/SoftwareUpdate/fixtures
|
||||
|
||||
bin/gen_build -o build.ninja -C "$builddir" -dAPP_NAME="$name" -dAPP_VERSION="$ver" -dAPP_MIN_OS="$min_os" -dCC="$CC" -dCXX="$CXX" -didentity="$identity" -drest_api="$rest_api" -dbzip2_flag="$bzip2_flag" -dcapnp_prefix="$capnp_prefix" -dlibressl_prefix="$libressl_prefix" target
|
||||
bin/gen_build -o build.ninja -C "$builddir" -dAPP_NAME="$name" -dAPP_VERSION="$ver" -dAPP_MIN_OS="$min_os" -dCC="$CC" -dCXX="$CXX" -didentity="$identity" -drest_api="$rest_api" -dbzip2_flag="$bzip2_flag" -dtest_flags="$test" -dcapnp_prefix="$capnp_prefix" -dlibressl_prefix="$libressl_prefix" target
|
||||
|
||||
ninja Frameworks/encoding/src/frequencies.capnp.h
|
||||
ninja Frameworks/plist/src/cache.capnp.h
|
||||
|
||||
Reference in New Issue
Block a user