Skip to content

Commit 079b935

Browse files
committed
Enable Jepsen tests for RR
Run nemesis tests serially Signed-off-by: Mark Hannum <[email protected]>
1 parent d18b3cc commit 079b935

File tree

21 files changed

+582
-66
lines changed

21 files changed

+582
-66
lines changed

cdb2jdbc/Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# shortcut for building jdbc driver via make
22
BASEDIR:=$(realpath ..)
33
VERSION?=$(shell grep ^comdb2 ../pkg/changelog | sed 's/^comdb2 .//; s/-.*//g')
4+
MVNFLAGS?=$(shell echo "${COMDB2_MVN_FLAGS}")
45

56
.PHONY: jdbc
67
MAVEN_VER := $(shell mvn -version 2>/dev/null)
@@ -9,21 +10,21 @@ envSkipTests?='true'
910

1011
jdbc:
1112
ifdef MAVEN_VER
12-
+mvn package
13+
+mvn $(MVNFLAGS) package
1314
else
1415
$(error "Could not find maven")
1516
endif
1617

1718
clean:
1819
ifdef MAVEN_VER
19-
+mvn clean
20+
+mvn $(MVNFLAGS) clean
2021
else
2122
$(error "Could not find maven")
2223
endif
2324

2425
install: jdbc
2526
ifdef MAVEN_VER
26-
+mvn install
27+
+mvn $(MVNFLAGS) install
2728
else
2829
$(error "Could not find maven")
2930
endif

tests/Makefile

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ endif
1313
include $(TESTSROOTDIR)/Makefile.common
1414

1515
# List of disabled tests
16-
DISABLED_TESTS:=$(shell awk '/^DISABLED/{f=1;next};/<END>/{f=0}f' TODO | cut -d' ' -f1)
16+
DISABLED_TESTS:=$(shell awk '/^DISABLED TESTS/{f=1;next};/^END DISABLED/{f=0}f' TODO | cut -d' ' -f1)
17+
18+
# List of serial tests
19+
SERIAL_TESTS:=$(shell awk '/^SERIAL TESTS/{f=1;next};/^END SERIAL/{f=0}f' TODO | cut -d' ' -f1)
1720

1821
# When SKIPSSL is on, skip running tests which rely on SSL
1922
ifeq ($(SKIPSSL),1)
@@ -41,41 +44,56 @@ ifeq ($(subst all,,$(MAKECMDGOALS)),) #if cmdgoals empty or 'all'
4144
DOALL:=1
4245
endif
4346

44-
# List of all tests that need to run.
47+
.PHONY: all all_tests all_nonserial_tests all_serial_tests
48+
49+
all_tests: all_nonserial_tests all_serial_tests
50+
all: init basicops all_tests
51+
52+
CANON_SERIAL := $(patsubst %.test,%, $(SERIAL_TESTS))
53+
54+
# Read alltests.txt if present
4555
ifeq ($(wildcard alltests.txt),alltests.txt)
46-
# If file alltests.txt exists, only run the tests in that file (one line per test)
47-
export ALL_TESTS:=$(patsubst %.test, %, $(shell sort -u alltests.txt) )
56+
SELECTED := $(patsubst %.test,%, \
57+
$(shell awk 'NF && $$1 !~ /^#/' alltests.txt | sed 's/[[:space:]]\+.*//' ))
58+
# Ignore DISABLED if using alltests.txt
59+
ALL_SERIAL_TESTS := $(filter $(CANON_SERIAL),$(SELECTED)) # preserves order of SELECTED
60+
ALL_TESTS := $(filter-out $(ALL_SERIAL_TESTS),$(SELECTED))
4861
else
49-
ifneq ($(DISABLED_TESTS),)
50-
DISABLED_TESTS:=" $(shell echo $(DISABLED_TESTS) | tr ' ' '\n' | sort -u) "
51-
endif
52-
62+
DISABLED_TESTS := $(strip $(sort $(DISABLED_TESTS)))
63+
CANON_DISABLED := $(patsubst %.test,%, $(DISABLED_TESTS))
5364
ifeq ($(INCLUDE_LONG_RUNNING),1)
5465
FLG=
5566
else
5667
# by default exclude all tests which run longer than 1 hour
5768
FLG=--skip-long-running
5869
endif
70+
ALL_CANDIDATES := $(patsubst %.test,%, $(shell $(TESTSROOTDIR)/tools/get_tests_inorder.sh $(FLG)))
5971

60-
# This is the list of all non-disabled tests.
61-
export ALL_TESTS:=$(patsubst %.test, %, $(filter-out $(DISABLED_TESTS), \
62-
$(shell $(TESTSROOTDIR)/tools/get_tests_inorder.sh $(FLG))))
72+
ALL_SERIAL_TESTS := $(filter-out $(CANON_DISABLED), $(CANON_SERIAL))
73+
ALL_TESTS := $(filter-out $(ALL_SERIAL_TESTS) $(CANON_DISABLED), $(ALL_CANDIDATES))
6374
endif
6475

76+
# ----- execution -----
77+
all_nonserial_tests: $(ALL_TESTS)
78+
@echo "Non-serial tests complete"
79+
80+
all_serial_tests: all_nonserial_tests
81+
@echo "Running serial tests: $(ALL_SERIAL_TESTS)"
82+
@set -e; \
83+
for t in $(ALL_SERIAL_TESTS); do \
84+
$(MAKE) --no-print-directory $$t; \
85+
done
86+
6587
# get number of TOTAL tests running: used for printing progress report of tests
6688
TOTAL=$(words $(MAKECMDGOALS) )
6789
ifeq ($(DOALL),1)
6890
TOTAL=$(words $(ALL_TESTS) )
6991
endif
7092

71-
all: init basicops all_tests
7293

7394
init:
7495
@mkdir -p ${TESTDIR}
7596

76-
# Run all non-disabled tests.
77-
all_tests: $(ALL_TESTS)
78-
7997
basicops_nokey: init
8098
$(shell which git > /dev/null 2>&1 && git rev-parse --abbrev-ref HEAD | xargs echo "Branch" >> ${TESTDIR}/test.log)
8199
$(shell which git > /dev/null 2>&1 && git rev-parse --short HEAD | xargs echo "SHA " >> ${TESTDIR}/test.log)

tests/TODO

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,24 +53,23 @@ sc_swapfields
5353
sc_versmistmatch
5454
sc_resume
5555

56+
# The tests listed in this section can't run in parallel- they
57+
# modify the environment in a way which will break other tests
58+
SERIAL TESTS:
59+
register_linearizable.test -- nemesis.c partitions the network
60+
cinsert_linearizable.test
61+
jepsen_a6_nemesis.test -- nemesis partitions network
62+
jepsen_bank_nemesis.test
63+
jepsen_register_nemesis.test
64+
jepsen_sets_nemesis.test
65+
END SERIAL
5666

5767
# The tests listed below will be skipped when ran as part of
5868
# 'make all'. These tests however can be run individually.
5969

6070
DISABLED TESTS:
6171
async_sc_bench.test -- benchmark for paper
6272
halt_processor_tds.test -- requires a cluster
63-
jepsen_a6.test -- jepsen tests require java & root access
64-
jepsen_a6_nemesis.test
65-
jepsen_atomic_writes.test
66-
jepsen_bank_nemesis.test
67-
jepsen_bank.test
68-
jepsen_dirty_reads.test
69-
jepsen_g2.test
70-
jepsen_register_nemesis.test
71-
jepsen_register.test
72-
jepsen_sets_nemesis.test
73-
jepsen_sets.test
7473
killcluster.test
7574
netloss.test -- does not pass most of the time; requires kernel 4.x & docker 17.x
7675
overflowblobs.test -- timesout
@@ -82,5 +81,6 @@ sc_async_constraints.test
8281
sigstopcluster.test
8382
weighted_standing_queue.test -- failing in rhel8 + podman
8483
sc_resume_partition.test
84+
END DISABLED
8585

8686
# vim: set sw=4 ts=4 et:

tests/docker/Dockerfile.db

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ FROM comdb2test:${REVISION}
44
RUN mkdir /var/run/sshd && \
55
echo 'root:bigsecret' | chpasswd && \
66
sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config && \
7+
sed -i 's/^#\?PasswordAuthentication.*/PasswordAuthentication yes/' &&
78
echo "StrictHostKeyChecking no" > /etc/ssh/ssh_config && \
89
sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd && \
910
echo "export VISIBLE=now" >> /etc/profile

tests/docker/Dockerfile.install

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ RUN apt-get update && \
1212
gdb \
1313
git \
1414
iproute2 \
15+
iptables \
1516
iputils-ping \
1617
jq \
1718
libevent-dev \
@@ -29,10 +30,12 @@ RUN apt-get update && \
2930
libz-dev \
3031
lsof \
3132
make \
33+
maven \
3234
ncurses-dev \
3335
netcat-openbsd \
3436
net-tools \
3537
openssh-server \
38+
openjdk-11-jdk \
3639
protobuf-c-compiler \
3740
psmisc \
3841
pstack \
@@ -50,14 +53,18 @@ RUN apt-get update && \
5053

5154
COPY . /comdb2
5255

53-
RUN cd /comdb2 && \
56+
RUN export JAVA_HOME=$(dirname $(dirname $(readlink -f $(which java)))) && \
57+
export COMDB2_MVN_FLAGS="-Dhttp.proxyHost=devproxy.bloomberg.com -Dhttp.proxyPort=82 -Dhttps.proxyHost=devproxy.bloomberg.com -Dhttps.proxyPort=82" && \
58+
cd /comdb2/cdb2jdbc && \
59+
make install && \
60+
cd /comdb2 && \
5461
rm -rf build && \
5562
mkdir build && \
5663
cd build && \
5764
cmake -DWITH_TCL=1 -DCOMDB2_TEST=1 .. && \
5865
make -j4 && \
5966
make -j4 test-tools && \
60-
make install && \
67+
make install && \
6168
cp /comdb2/tests/docker/client / && \
6269
cp /comdb2/tests/docker/server / && \
6370
apt-get clean

tests/docker/runit

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ services:
8686
dockerfile: tests/docker/Dockerfile.db
8787
args:
8888
- REVISION=$prefix
89+
ports:
90+
- "3333:22"
8991
volumes:
9092
- ./common:/common
9193
- ./common/c1:/dedicated
@@ -100,6 +102,10 @@ cat >> $compose <<EOF
100102
command: /client $commands
101103
cap_add:
102104
- SYS_PTRACE
105+
- SYS_RESOURCE
106+
- NET_ADMIN
107+
- NET_RAW
108+
- SYS_ADMIN
103109
EOF
104110

105111
for node in $containers; do
@@ -136,6 +142,9 @@ cat >> $compose <<EOF
136142
command: /server
137143
cap_add:
138144
- SYS_PTRACE
145+
- NET_ADMIN
146+
- NET_RAW
147+
- SYS_ADMIN
139148
EOF
140149
done
141150

tests/jepsen_a6.test/runit

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
# Runs the register linearizability test
44
#debug=1
55
#debug_trace="-D"
6-
export CDB2JDBC_STATEMENT_QUERYEFFECTS=1
7-
export CDB2JDBC_VERIFY_RETRY=0
6+
7+
. ${TESTSROOTDIR}/tools/jepsen_setup.sh
88

99
[[ "$debug" == 1 ]] && set -x
1010
needcluster=0
@@ -98,7 +98,7 @@ function runtestwithoptions
9898
export CDB2_CONFIG_FILE=${CDB2_CONFIG}
9999
(
100100
cd ${TESTSROOTDIR}/tools/linearizable/jepsen
101-
lein run test $testargs > $outfile 2>&1 < /dev/null
101+
$LEIN run test $testargs > $outfile 2>&1 < /dev/null
102102
r=$? ; [[ $r != 0 ]] && echo "XXX JEPSEN ERROR Lein test returns $r" >> $outfile
103103
)
104104
cat $outfile

tests/jepsen_a6_nemesis.test/runit

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
# Runs the register linearizability test
44
#debug=1
55
#debug_trace="-D"
6-
export CDB2JDBC_STATEMENT_QUERYEFFECTS=1
7-
export CDB2JDBC_VERIFY_RETRY=0
6+
7+
. ${TESTSROOTDIR}/tools/jepsen_setup.sh
88

99
[[ "$debug" == 1 ]] && set -x
1010
needcluster=0
@@ -98,7 +98,7 @@ function runtestwithoptions
9898
export CDB2_CONFIG_FILE=${CDB2_CONFIG}
9999
(
100100
cd ${TESTSROOTDIR}/tools/linearizable/jepsen
101-
lein run test $testargs > $outfile 2>&1 < /dev/null
101+
$LEIN run test $testargs > $outfile 2>&1 < /dev/null
102102
r=$? ; [[ $r != 0 ]] && echo "XXX JEPSEN ERROR Lein test returns $r" >> $outfile
103103
)
104104
cat $outfile

tests/jepsen_atomic_writes.test/runit

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
# Runs the register linearizability test
44
#debug=1
55
#debug_trace="-D"
6-
export CDB2JDBC_STATEMENT_QUERYEFFECTS=1
7-
export CDB2JDBC_VERIFY_RETRY=0
6+
7+
. ${TESTSROOTDIR}/tools/jepsen_setup.sh
88

99
[[ "$debug" == 1 ]] && set -x
1010
needcluster=0
@@ -98,7 +98,7 @@ function runtestwithoptions
9898
export CDB2_CONFIG_FILE=${CDB2_CONFIG}
9999
(
100100
cd ${TESTSROOTDIR}/tools/linearizable/jepsen
101-
lein run test $testargs > $outfile 2>&1 < /dev/null
101+
$LEIN run test $testargs > $outfile 2>&1 < /dev/null
102102
r=$? ; [[ $r != 0 ]] && echo "XXX JEPSEN ERROR Lein test returns $r" >> $outfile
103103
)
104104
cat $outfile

tests/jepsen_bank.test/runit

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
# Runs the register linearizability test
44
#debug=1
55
#debug_trace="-D"
6-
export CDB2JDBC_STATEMENT_QUERYEFFECTS=1
7-
export CDB2JDBC_VERIFY_RETRY=0
6+
7+
. ${TESTSROOTDIR}/tools/jepsen_setup.sh
88

99
[[ "$debug" == 1 ]] && set -x
1010
needcluster=0
@@ -97,7 +97,7 @@ function runtestwithoptions
9797
export CDB2_CONFIG_FILE=${CDB2_CONFIG}
9898
(
9999
cd ${TESTSROOTDIR}/tools/linearizable/jepsen
100-
lein run test $testargs > $outfile 2>&1 < /dev/null
100+
$LEIN run test $testargs > $outfile 2>&1 < /dev/null
101101
r=$? ; [[ $r != 0 ]] && echo "XXX JEPSEN ERROR Lein test returns $r" >> $outfile
102102
)
103103
cat $outfile

0 commit comments

Comments
 (0)