source: branches/samhain_3_1/test/testrun_1a.sh@ 514

Last change on this file since 514 was 155, checked in by katerina, 17 years ago

Skip stealth test if convert is missing.

File size: 4.2 KB
Line 
1#! /bin/sh
2
3#
4# Copyright Rainer Wichmann (2006)
5#
6# License Information:
7# This program is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 2 of the License, or
10# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program; if not, write to the Free Software
19# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20#
21
22PREBUILDOPTS="--quiet $TRUST --enable-debug --enable-static --enable-xml-log --enable-login-watch --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$RCFILE --with-log-file=$LOGFILE --with-pid-file=$PW_DIR/.samhain_lock --with-data-file=$PW_DIR/.samhain_file"
23export PREBUILDOPTS
24
25MAXTEST=1; export MAXTEST
26
27testrun_stealth ()
28{
29 tcount=14
30
31 if test -r "Makefile"; then
32 $MAKE distclean >/dev/null
33 fi
34
35 ${TOP_SRCDIR}/configure ${BUILDOPTS}
36
37 if test x$? = x0; then
38 [ -z "$verbose" ] || log_msg_ok "configure...";
39 $MAKE >/dev/null 2>>test_log
40 if test x$? = x0; then
41 [ -z "$verbose" ] || log_msg_ok "make...";
42 else
43 [ -z "$quiet" ] && log_msg_fail "make...";
44 return 1
45 fi
46
47 else
48 [ -z "$quiet" ] && log_msg_fail "configure...";
49 return 1
50 fi
51
52 CONVERT=`find_path convert`
53 if [ x"$CONVERT" = x ]; then
54 [ -z "$verbose" ] || log_msg_fail "ImageMagick convert not found";
55 return 1
56 fi
57 "$CONVERT" --help | grep ImageMagick >/dev/null 2>&1
58 if [ $? -ne 0 ]; then
59 [ -z "$verbose" ] || log_msg_fail "Convert utility is not ImageMagick convert";
60 return 1
61 fi
62 "${CONVERT}" +compress stealth_template.jpg stealth_template.ps
63 if [ $? -ne 0 ]; then
64 [ -z "$verbose" ] || log_msg_fail "Converting stealth_template.jpg failed";
65 return 1
66 fi
67
68 $MAKE samhain_stealth >/dev/null 2>>test_log
69 if [ $? -ne 0 ]; then
70 [ -z "$verbose" ] || log_msg_fail "make samhain_stealth";
71 return 1
72 fi
73 capacity=`./samhain_stealth -i stealth_template.ps | awk '{ print $7 }'`
74
75 prep_init
76 check_err $? ${tcount}; errval=$?
77 if [ $errval -eq 0 ]; then
78 prep_testdata
79 check_err $? ${tcount}; errval=$?
80 fi
81 if [ $errval -eq 0 ]; then
82 prep_testpolicy 1
83 check_err $? ${tcount}; errval=$?
84 fi
85
86 if [ $errval -eq 0 ]; then
87 fill=`cat "${RCFILE}" | wc -c`
88 check_err $? ${tcount}; errval=$?
89 fi
90 if [ $errval -eq 0 ]; then
91 let "capacity = capacity - fill" >/dev/null
92 let "capacity = capacity - 100" >/dev/null
93 until [ "$capacity" -le 0 ]
94 do
95 echo "###############################" >>"${RCFILE}"
96 let "capacity = capacity - 32" >/dev/null
97 done
98
99 ./samhain_stealth -s stealth_template.ps "${RCFILE}" >/dev/null
100 check_err $? ${tcount}; errval=$?
101 fi
102 if [ $errval -eq 0 ]; then
103 cp stealth_template.ps "${RCFILE}"
104 check_err $? ${tcount}; errval=$?
105 fi
106
107 if [ $errval -eq 0 ]; then
108 run_init
109 check_err $? ${tcount}; errval=$?
110 fi
111 if [ $errval -eq 0 ]; then
112 eval mod_testdata_1
113 check_err $? ${tcount}; errval=$?
114 fi
115 if [ $errval -eq 0 ]; then
116 run_check
117 check_err $? ${tcount}; errval=$?
118 fi
119 if [ $errval -eq 0 ]; then
120 eval chk_testdata_1
121 check_err $? ${tcount}; errval=$?
122 fi
123 if [ $testrun1_setup -eq 0 ]; then
124 if [ $errval -eq 0 ]; then
125 run_update
126 check_err $? ${tcount}; errval=$?
127 fi
128 if [ $errval -eq 0 ]; then
129 run_check_after_update
130 check_err $? ${tcount}; errval=$?
131 fi
132 fi
133
134 if [ $errval -eq 0 ]; then
135 [ -z "$quiet" ] && log_ok ${tcount} ${MAXTEST};
136 fi
137 return 0
138}
139
140testrun1a ()
141{
142 log_start "RUN STANDALONE W/STEALTH"
143 #
144 # micro-stealth
145 #
146 #BUILDOPTS="$PREBUILDOPTS --enable-micro-stealth=137"; export BUILDOPTS
147 #testrun_internal
148
149 CONVERT=`find_path convert`
150 if [ x"$CONVERT" = x ]; then
151 log_skip 1 ${MAXTEST} "ImageMagick convert not found";
152 return 0
153 fi
154 BUILDOPTS="$PREBUILDOPTS --enable-stealth=137"; export BUILDOPTS
155 testrun_stealth
156 check_err $? ${tcount};
157 log_end "RUN STANDALONE W/STEALTH"
158 return 0
159}
160
Note: See TracBrowser for help on using the repository browser.