Skip to content

Commit 76b44be

Browse files
committed
Loosen test deadlines to reduce spurious failures in Swift CI
Add build flag that defaults to true when building with Swift support enabled (like when in Swift CI) that relaxes the passing criteria for timing-sensitive dispatch tests. We continue to see occasional spurious failures of dispatch tests in the Swift CI caused by test machine load; this is an attempt to reduce the frequency of load-induced failures without removing the test cases entirely.
1 parent 0b6c22e commit 76b44be

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

tests/Makefile.am

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ TESTS= \
7474
dispatch_select \
7575
$(ADDITIONAL_TESTS)
7676

77+
# For testing in swift.org CI system; make deadlines lenient by default
78+
# to reduce probability of test failures due to machine load.
79+
if HAVE_SWIFT
80+
CI_CFLAGS=-DLENIENT_DEADLINES=1
81+
endif
7782

7883
dispatch_c99_CFLAGS=$(DISPATCH_TESTS_CFLAGS) $(CBLOCKS_FLAGS) -std=c99
7984
dispatch_plusplus_SOURCES=dispatch_plusplus.cpp
@@ -82,7 +87,7 @@ dispatch_priority2_CPPFLAGS=$(AM_CPPFLAGS) -DUSE_SET_TARGET_QUEUE=1
8287

8388
AM_CPPFLAGS=-I$(top_builddir) -I$(top_srcdir)
8489

85-
DISPATCH_TESTS_CFLAGS=-Wall -Wno-deprecated-declarations $(MARCH_FLAGS)
90+
DISPATCH_TESTS_CFLAGS=-Wall -Wno-deprecated-declarations $(MARCH_FLAGS) $(CI_CFLAGS)
8691
AM_CFLAGS=$(DISPATCH_TESTS_CFLAGS) $(CBLOCKS_FLAGS) $(BSD_OVERLAY_CFLAGS)
8792
AM_OBJCFLAGS=$(DISPATCH_TESTS_CFLAGS) $(CBLOCKS_FLAGS)
8893
AM_CXXFLAGS=$(DISPATCH_TESTS_CFLAGS) $(CXXBLOCKS_FLAGS) $(BSD_OVERLAY_CFLAGS)

tests/dispatch_drift.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@
3232
#include <bsdtests.h>
3333
#include "dispatch_test.h"
3434

35+
#if LENIENT_DEADLINES
36+
#define ACCEPTABLE_DRIFT 0.1
37+
#else
3538
#define ACCEPTABLE_DRIFT 0.001
39+
#endif
3640

3741
int
3842
main(int argc __attribute__((unused)), char* argv[] __attribute__((unused)))

tests/dispatch_starfish.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@
3737
#define COUNT 1000ul
3838
#define LAPS 10ul
3939

40-
#if TARGET_OS_EMBEDDED
40+
#if LENIENT_DEADLINES
41+
#define ACCEPTABLE_LATENCY 10000
42+
#elif TARGET_OS_EMBEDDED
4143
#define ACCEPTABLE_LATENCY 3000
4244
#else
4345
#define ACCEPTABLE_LATENCY 1000

0 commit comments

Comments
 (0)