blob: cf3c3db1c3fb84393ecd24224220859ddb88541c (
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
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
78
79
80
81
82
83
84
85
86
87
88
89
|
#!/bin/bash
#
# A script to run a BuildStream test case.
TEST_DIR="elements/"
RESULTS="results/"
EXPECTED="expected/"
set -eu
# run_test
#
# Run tests for this test case.
#
# This test has more manual intervention since it creates binary files
# which may change.
#
run_test () {
local bst_file
local tar_file
local successes=0
local total=2
local exit
source ../lib.sh
###############################################################
### Setup
###############################################################
tar_file="$(dirname "$(readlink -f "$0")")/src/step7.tar.gz"
bst_file="$(dirname "$(readlink -f "$0")")/elements/step7.bst"
patch_file_location "$bst_file" "$tar_file"
mkdir -p "$TEST_DIR"
###############################################################
### Run tests
###############################################################
## Test step7
echo "Running test 'step7'"
bst_with_flags build "step7.bst"
bst_with_flags checkout "step7.bst" "results/step7"
# Remove changing binary file
rm results/step7/usr/bin/libMathFunctions.a
exit=0
diff -r "$RESULTS/step7" "$EXPECTED/step7" || exit=$?
if [ $exit == 0 ]
then
successes=$((successes + 1))
printf "%-34s ${GREEN}%9s${END}\n" "step7" "succeeded"
else
echo "Error: Unexpected or missing file in 'results/step7'"
printf "%-34s ${RED}%9s${END}\n" "step7" "failed"
fi
## Test step7-run
echo "Running test 'step7-run'"
bst_with_flags build "step7-run.bst"
bst_with_flags checkout "step7-run.bst" "results/step7-run"
exit=0
compare_results "step7-run" "results" "expected" || exit=$?
if [ $exit == 0 ]
then
successes=$((successes + 1))
else
echo "Error: Unexpected or missing file in 'results/step7'"
fi
###############################################################
### Check results
###############################################################
if [ $total != $successes ]
then
return 1
fi
}
run_test "$@"
|