aboutsummaryrefslogtreecommitdiff
path: root/contrib/ci/jobs/2-test/test.sh
blob: 7cc8b8a9de6e963f409b818d467d626a990b3fc9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
set -evu

apt-get update
apt-get upgrade -yqq

./bootstrap
./configure CFLAGS="-ggdb -O0" \
	    --enable-logging=verbose \
	    --disable-doc

nump=$(grep processor /proc/cpuinfo | wc -l)
make clean
make -j$(( $nump / 2 ))
make install

sudo -u postgres /usr/lib/postgresql/15/bin/postgres -D /etc/postgresql/15/main -h localhost -p 5432 &
sleep 10
sudo -u postgres createuser -p 5432 root
sudo -u postgres createdb -p 5432 -O root talercheck

check_command()
{
	# Set LD_LIBRARY_PATH so tests can find the installed libs
	LD_LIBRARY_PATH=/usr/local/lib PGPORT=5432 make check
}

print_logs()
{
	for i in src/*/test-suite.log
	do
		for FAILURE in $(grep '^FAIL:' ${i} | cut -d' ' -f2)
		do
			echo "Printing ${FAILURE}.log"
			cat "$(dirname $i)/${FAILURE}.log"
		done
	done
}

if ! check_command ; then
	print_logs
	exit 1
fi