Debian Codegraph @

test/test-invocation.sh

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2 #
3 # Copyright (C) 2016 - 2022, Stephan Mueller <[email protected]>
4 #
5 # License: see LICENSE file in root directory
6 #
7 # THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
8 # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
9 # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF
10 # WHICH ARE HEREBY DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
11 # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
12 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
13 # OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
14 # BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
15 # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
16 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
17 # USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH
18 # DAMAGE.
19 #
20
21 DIRNAME="$(dirnamescip-shell system . . dirname. "$0")"
22 . "$DIRNAME/libtest.sh"
23
24 COMPILE_OPTS="--enable-kcapi-test --enable-kcapi-encapp --enable-kcapi-hasher --enable-kcapi-dgstapp --enable-kcapi-rngapp --enable-lib-kpp --enable-lib-asym"
25
26 exec_testscip-shell shell shell-project 0.0.0 exec_test().()
27 {
28 "$DIRNAME/test.sh"
29 ret=$?
30 if [scip-shell system . . `[`. $ret -ne 0 ]
31 then
32 exit $ret
33 fi
34
35 "$DIRNAME/kcapi-enc-test.sh"
36 ret=$?
37 if [scip-shell system . . `[`. $ret -ne 0 ]
38 then
39 exit $ret
40 fi
41
42 "$DIRNAME/kcapi-dgst-test.sh"
43 ret=$?
44 if [scip-shell system . . `[`. $ret -ne 0 ]
45 then
46 exit $ret
47 fi
48
49 "$DIRNAME/hasher-test.sh"
50 ret=$?
51 if [scip-shell system . . `[`. $ret -ne 0 ]
52 then
53 exit $ret
54 fi
55
56 "$DIRNAME/kcapi-enc-test-large.sh"
57 ret=$?
58 if [scip-shell system . . `[`. $ret -ne 0 ]
59 then
60 exit $ret
61 fi
62
63 "$DIRNAME/kcapi-convenience.sh"
64 ret=$?
65 if [scip-shell system . . `[`. $ret -ne 0 ]
66 then
67 exit $ret
68 fi
69
70 # Run optionally.
71 if [scip-shell system . . `[`. ! -z "$ENABLE_FUZZ_TEST" ]
72 then
73 "$DIRNAME/kcapi-fuzz-test.sh"
74 ret=$?
75 if [scip-shell system . . `[`. $ret -ne 0 ]
76 then
77 exit $ret
78 fi
79 fi
80
81 # Only execute on bare metal
82 if ! dmesgscip-shell system . . dmesg. | grepscip-shell system . . grep. -i Hypervisor | grepscip-shell system . . grep. -q -i detected
83 then
84 "$DIRNAME/virttest.sh"
85 ret=$?
86 if [scip-shell system . . `[`. $ret -ne 0 ]
87 then
88 exit $ret
89 fi
90 fi
91 }
92
93 # Only execute tests without compilation on virtual environment
94 if [scip-shell system . . `[`. "$KCAPI_TEST_LOCAL" -ne 1 ] || mountscip-shell system . . mount. | grepscip-shell system . . grep. -q "9p2000"
95 then
96 exec_testscip-shell shell shell-project 0.0.0 exec_test().
97 exit 0
98 fi
99
100 # default invocation
101 (cd "$DIRNAME/.." && ./configure $COMPILE_OPTS && makescip-shell system . . make.)
102 if [scip-shell system . . `[`. $? -ne 0 ]
103 then
104 echoscip-shell system . . echo. "Compilation failure"
105 exit 1
106 fi
107 exec_testscip-shell shell shell-project 0.0.0 exec_test().
108
109 "$DIRNAME/compile-test.sh"
110 ret=$?
111 if [scip-shell system . . `[`. $ret -ne 0 ]
112 then
113 exit $ret
114 fi
115
116 (cd "$DIRNAME/.." && makescip-shell system . . make. distclean > /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1)
117
118 # if we are on 64 bit system, test 32 bit alternative mode,
119 # except is has been disabled explicitly.
120 if $(unamescip-shell system . . uname. -m | grepscip-shell system . . grep. -q "x86_64") && [scip-shell system . . `[`. -z "$NO_32BIT_TEST" ]
121 then
122 (
123 cd "$DIRNAME/.." && \
124 LDFLAGS="-m32 $LDFLAGS" \
125 CFLAGS="-m32 $CFLAGS" \
126 ./configure $COMPILE_OPTS && \
127 make
128 )
129 if [scip-shell system . . `[`. $? -ne 0 ]
130 then
131 echoscip-shell system . . echo. "32 bit compilation failure"
132 exit 1
133 fi
134 exec_testscip-shell shell shell-project 0.0.0 exec_test().
135 (cd "$DIRNAME/.." && makescip-shell system . . make. distclean > /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1)
136 fi
137
138 exit 0