forked from fede1024/rust-rdkafka
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_suite.sh
executable file
·77 lines (61 loc) · 1.72 KB
/
test_suite.sh
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/usr/bin/env bash
GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m' # No Color
set -euo pipefail
echo_good() {
tput setaf 2
echo "$@"
tput sgr0
}
echo_bad() {
tput setaf 1
echo "$@"
tput sgr0
}
run_with_valgrind() {
if ! valgrind --error-exitcode=100 --suppressions=rdkafka.suppressions --gen-suppressions=all --leak-check=full "$1" --nocapture --test-threads=1
then
echo_bad "*** Failure in $1 ***"
exit 1
fi
}
# Initialize.
git submodule update --init
docker compose up -d --wait
# Run integration tests
RUST_LOG=1 RUST_BACKTRACE=1 cargo test
# Run unit tests.
#echo_good "*** Run unit tests ***"
#for test_file in target/debug/deps/rdkafka-*
#do
# if [[ -x "$test_file" ]]
# then
# echo_good "Executing "$test_file""
# run_with_valgrind "$test_file"
# fi
#done
#echo_good "*** Unit tests succeeded ***"
#
## Run integration tests.
#
#echo_good "*** Run integration tests ***"
#for test_file in target/debug/deps/test_*
#do
# if [[ -x "$test_file" ]]
# then
# #echo_good "*** Restarting kafka/zk ***"
# #docker-compose restart --timeout 30
# echo_good "Executing "$test_file""
# run_with_valgrind "$test_file"
# fi
#done
#echo_good "*** Integration tests succeeded ***"
# Run smol runtime example.
echo_good "*** Run runtime_smol example ***"
cargo run --example runtime_smol --no-default-features --features cmake-build -- --topic smol
echo_good "*** runtime_smol example succeeded ***"
# Run async-std runtime example.
echo_good "*** Run runtime_async_std example ***"
cargo run --example runtime_async_std --no-default-features --features cmake-build -- --topic async-std
echo_good "*** runtime_async_std example succeeded ***"