aboutsummaryrefslogtreecommitdiffstats
path: root/service/src/test.sh
blob: 4627d81d4ca8771c59672490258111622b4e4d59 (plain) (blame)
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
#!/bin/sh

set -e

announce() {
	count=$(echo "$1" | wc -c)
	python3 -c "
import math
s = '$1'
c = 80
print()
print('#'*c)
print('#' + ' '*math.floor((c - len(s))/2-1) + s + ' '*math.ceil((c - len(s))/2-1) + '#')
print('#'*c)
print()
	"
}

checkleaks() {
	valgrind --leak-check=full ./printdoc 2>&1 | tee /tmp/testlog
	if [ -z "$(grep "no leaks are possible" /tmp/testlog)" ]; then
		echo "Valgrind exited with errors!"
		exit 1
	fi
}

announce "Trying ASCII STL"
(
	echo "submit"
	cat tests/sample-ascii.stl | wc -c
	cat tests/sample-ascii.stl
) | checkleaks

announce "Trying BIN STL"
(
	echo "submit"
	cat tests/sample-binary.stl | wc -c
	cat tests/sample-binary.stl
) | checkleaks