Skip to content

Commit ba43f98

Browse files
committed
Add tests for multiline batches
Some related tests for generic c2s batches were shoved in here as well for lack of a better spot to put them. This change required actually bringing extension modules into the unit test runtime. This was easier for meson since we could just update the existing shell script, but for autotools I brought dependencies specifically on the extension .so files needed for tests (as relying on everything in patsubst like we do for core/autoload modules would attempt to depend on filter.so even on systems where libhs isn't available, which would fail the build).
1 parent 3d7e2ea commit ba43f98

5 files changed

Lines changed: 970 additions & 2 deletions

File tree

tests/Makefile.am

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ check_PROGRAMS = runtests \
44
misc \
55
msgbuf_parse1 \
66
msgbuf_unparse1 \
7+
multiline1 \
78
hostmask1 \
89
labeled_response1 \
910
privilege1 \
@@ -15,6 +16,7 @@ check_PROGRAMS = runtests \
1516
send_multiline1 \
1617
serv_connect1 \
1718
substitution1
19+
test_extensions = multiline
1820
AM_CFLAGS=$(WARNFLAGS)
1921
AM_CPPFLAGS = $(DEFAULT_INCLUDES) -I../librb/include -I..
2022
AM_LDFLAGS = -no-install
@@ -41,11 +43,13 @@ check-local: $(check_PROGRAMS) \
4143
../bandb/bandb \
4244
../ssld/ssld \
4345
$(patsubst ../modules/%.c,../modules/.libs/%.so,$(wildcard ../modules/*.c)) \
44-
$(patsubst ../modules/core/%.c,../modules/core/.libs/%.so,$(wildcard ../modules/core/*.c))
46+
$(patsubst ../modules/core/%.c,../modules/core/.libs/%.so,$(wildcard ../modules/core/*.c)) \
47+
$(patsubst %,../extensions/.libs/%.so,$(test_extensions))
4548

46-
rm -rf runtime/modules && mkdir -p runtime/modules/autoload
49+
rm -rf runtime/modules && mkdir -p runtime/modules/autoload runtime/modules/extensions
4750
for f in ../modules/core/.libs/*.so; do ln -s "../../../modules/core/.libs/$${f##*/}" "runtime/modules/$${f##*/}"; done
4851
for f in ../modules/.libs/*.so; do ln -s "../../../../modules/.libs/$${f##*/}" "runtime/modules/autoload/$${f##*/}"; done
52+
for f in ../extensions/.libs/*.so; do ln -s "../../../../extensions/.libs/$${f##*/}" "runtime/modules/extensions/$${f##*/}"; done
4953

5054
ASAN_OPTIONS="${ASAN_OPTIONS}:detect_leaks=false" ./runtests -l $(abs_top_srcdir)/tests/TESTS
5155

tests/make_test_runtime.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ OUTPUT=$(realpath -s $3)/runtime
1010

1111
rm -rf $OUTPUT
1212
mkdir -p $OUTPUT/modules/autoload
13+
mkdir -p $OUTPUT/modules/extensions
1314
mkdir $OUTPUT/bin
1415
mkdir $OUTPUT/help
1516

@@ -35,5 +36,12 @@ echo $modules | tr ' ' '\n' | while read link; do
3536
ln -s "$BUILDROOT/modules/$link.so" "$OUTPUT/modules/autoload/$link.so"
3637
done
3738

39+
extensions=$(grep -Pazo '(?s)extension_modules = \[.*?\]' $SOURCEROOT/extensions/meson.build | grep -Pao "(?<=')[^']+(?=')")
40+
echo $extensions | tr ' ' '\n' | while read link; do
41+
if test -e "$BUILDROOT/extensions/$link.so"; then
42+
ln -s "$BUILDROOT/extensions/$link.so" "$OUTPUT/modules/extensions/$link.so"
43+
fi
44+
done
45+
3846
cp $SOURCEROOT/tests/*.conf $3
3947
echo "Hello World!" > $OUTPUT/motd

tests/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ test_programs = {
3333
'misc': 'misc.c',
3434
'msgbuf_parse1': 'msgbuf_parse1.c',
3535
'msgbuf_unparse1': 'msgbuf_unparse1.c',
36+
'multiline1': 'multiline1.c',
3637
'hostmask1': 'hostmask1.c',
3738
'labeled_response1': 'labeled_response1.c',
3839
'privilege1': 'privilege1.c',

0 commit comments

Comments
 (0)