Gentoo Archives: gentoo-commits

From: "Anthony G. Basile" <blueness@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/elfix:elfix-0.8.x commit in: tests/gnustack/, tests/paxmodule/, tests/revdeppaxtest/, tests/pxtpax/
Date: Sat, 29 Dec 2012 12:52:18
Message-Id: 1356785474.2f9f67644524fdfa73a4ec56458cf7bf02ae52ca.blueness@gentoo
1 commit: 2f9f67644524fdfa73a4ec56458cf7bf02ae52ca
2 Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
3 AuthorDate: Sat Dec 29 05:49:33 2012 +0000
4 Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
5 CommitDate: Sat Dec 29 12:51:14 2012 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/elfix.git;a=commit;h=2f9f6764
7
8 tests/*: pretify the code and output
9
10 ---
11 tests/gnustack/gnustacktest.sh | 36 ++++----
12 tests/paxmodule/paxmodtest.sh | 60 +++++++-----
13 tests/pxtpax/daemontest.sh | 31 ++++---
14 tests/pxtpax/init.sh | 68 +++++++-------
15 tests/revdeppaxtest/revdeptest.sh | 192 ++++++++++++++++++------------------
16 5 files changed, 202 insertions(+), 185 deletions(-)
17
18 diff --git a/tests/gnustack/gnustacktest.sh b/tests/gnustack/gnustacktest.sh
19 index 8a4c6e7..84d8b69 100755
20 --- a/tests/gnustack/gnustacktest.sh
21 +++ b/tests/gnustack/gnustacktest.sh
22 @@ -1,20 +1,20 @@
23 #!/bin/bash
24 #
25 -# gnustacktest.sh: this file is part of the elfix package
26 -# Copyright (C) 2011 Anthony G. Basile
27 +# gnustacktest.sh: this file is part of the elfix package
28 +# Copyright (C) 2011, 2012 Anthony G. Basile
29 #
30 -# This program is free software: you can redistribute it and/or modify
31 -# it under the terms of the GNU General Public License as published by
32 -# the Free Software Foundation, either version 3 of the License, or
33 -# (at your option) any later version.
34 +# This program is free software: you can redistribute it and/or modify
35 +# it under the terms of the GNU General Public License as published by
36 +# the Free Software Foundation, either version 3 of the License, or
37 +# (at your option) any later version.
38 #
39 -# This program is distributed in the hope that it will be useful,
40 -# but WITHOUT ANY WARRANTY; without even the implied warranty of
41 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
42 -# GNU General Public License for more details.
43 +# This program is distributed in the hope that it will be useful,
44 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
45 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
46 +# GNU General Public License for more details.
47 #
48 -# You should have received a copy of the GNU General Public License
49 -# along with this program. If not, see <http://www.gnu.org/licenses/>.
50 +# You should have received a copy of the GNU General Public License
51 +# along with this program. If not, see <http://www.gnu.org/licenses/>.
52 #
53
54 verbose=${1-0}
55 @@ -28,15 +28,15 @@ after=$(../../src/fix-gnustack bad-gnustack)
56 after=$(echo ${after} | awk '{ print $2 }')
57 rm bad-gnustack
58 if [ "${verbose}" != 0 ]; then
59 - echo " BEFRE=${before}"
60 - echo " AFTER=${after}"
61 + echo " BEFRE=${before}"
62 + echo " AFTER=${after}"
63 fi
64 if [ "${before}" = "RWX" -a "${after}" = "RW" ]; then
65 - echo " OK"
66 - ret=0
67 + echo " OK"
68 + ret=0
69 else
70 - echo " NOT OKAY"
71 - ret=1
72 + echo " NOT OKAY"
73 + ret=1
74 fi
75 echo
76 echo "================================================================================"
77
78 diff --git a/tests/paxmodule/paxmodtest.sh b/tests/paxmodule/paxmodtest.sh
79 index 9398f29..fb0b280 100755
80 --- a/tests/paxmodule/paxmodtest.sh
81 +++ b/tests/paxmodule/paxmodtest.sh
82 @@ -1,20 +1,20 @@
83 #!/bin/bash
84 #
85 -# paxmodtest.sh: this file is part of the elfix package
86 -# Copyright (C) 2011 Anthony G. Basile
87 +# paxmodtest.sh: this file is part of the elfix package
88 +# Copyright (C) 2011, 2012 Anthony G. Basile
89 #
90 -# This program is free software: you can redistribute it and/or modify
91 -# it under the terms of the GNU General Public License as published by
92 -# the Free Software Foundation, either version 3 of the License, or
93 -# (at your option) any later version.
94 +# This program is free software: you can redistribute it and/or modify
95 +# it under the terms of the GNU General Public License as published by
96 +# the Free Software Foundation, either version 3 of the License, or
97 +# (at your option) any later version.
98 #
99 -# This program is distributed in the hope that it will be useful,
100 -# but WITHOUT ANY WARRANTY; without even the implied warranty of
101 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
102 -# GNU General Public License for more details.
103 +# This program is distributed in the hope that it will be useful,
104 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
105 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
106 +# GNU General Public License for more details.
107 #
108 -# You should have received a copy of the GNU General Public License
109 -# along with this program. If not, see <http://www.gnu.org/licenses/>.
110 +# You should have received a copy of the GNU General Public License
111 +# along with this program. If not, see <http://www.gnu.org/licenses/>.
112 #
113
114 echo "================================================================================"
115 @@ -36,19 +36,19 @@ pythonversion=${pythonversion%\.*}
116 PYTHONPATH="../../scripts/build/lib.linux-${unamem}-${pythonversion}"
117
118 if [ ! -d ${PYTHONPATH} ]; then
119 - echo " (Re)building pax module"
120 -
121 - #NOTE: the last -D or -U wins as it does for gcc $CFLAGS
122 - for f in $@; do
123 - [ $f = "-UXTPAX" ] && unset XTPAX
124 - [ $f = "-DXTPAX" ] && XTPAX=1
125 - [ $f = "-UPTPAX" ] && unset PTPAX
126 - [ $f = "-DPTPAX" ] && PTPAX=1
127 - done
128 - export XTPAX
129 - export PTPAX
130 -
131 - ( cd ../../scripts; exec ./setup.py build ) >/dev/null
132 + echo " (Re)building pax module"
133 +
134 + #NOTE: the last -D or -U wins as it does for gcc $CFLAGS
135 + for f in $@; do
136 + [ $f = "-UXTPAX" ] && unset XTPAX
137 + [ $f = "-DXTPAX" ] && XTPAX=1
138 + [ $f = "-UPTPAX" ] && unset PTPAX
139 + [ $f = "-DPTPAX" ] && PTPAX=1
140 + done
141 + export XTPAX
142 + export PTPAX
143 +
144 + ( cd ../../scripts; exec ./setup.py build ) >/dev/null
145 fi
146
147 count=0
148 @@ -82,6 +82,8 @@ for pf in "p" "P" "-"; do
149
150 if [ "${verbose}" != 0 ] ;then
151 echo
152 + else
153 + echo -n "."
154 fi
155
156 done
157 @@ -90,6 +92,8 @@ for pf in "p" "P" "-"; do
158 done
159 done
160
161 +echo
162 +
163 for pf in "p" "P" "-"; do
164 for ef in "e" "E" "-"; do
165 for mf in "m" "M" "-"; do
166 @@ -120,6 +124,8 @@ for pf in "p" "P" "-"; do
167
168 if [ "${verbose}" != 0 ] ;then
169 echo
170 + else
171 + echo -n "."
172 fi
173
174 done
175 @@ -128,6 +134,10 @@ for pf in "p" "P" "-"; do
176 done
177 done
178
179 +if [ "${verbose}" = 0 ] ;then
180 + echo
181 + echo
182 +fi
183 echo " Mismatches = ${count}"
184 echo
185 echo "================================================================================"
186
187 diff --git a/tests/pxtpax/daemontest.sh b/tests/pxtpax/daemontest.sh
188 index 7e19038..66ec946 100755
189 --- a/tests/pxtpax/daemontest.sh
190 +++ b/tests/pxtpax/daemontest.sh
191 @@ -1,20 +1,20 @@
192 #!/bin/bash
193 #
194 -# daemontest.sh: this file is part of the elfix package
195 -# Copyright (C) 2011 Anthony G. Basile
196 +# daemontest.sh: this file is part of the elfix package
197 +# Copyright (C) 2011, 2012 Anthony G. Basile
198 #
199 -# This program is free software: you can redistribute it and/or modify
200 -# it under the terms of the GNU General Public License as published by
201 -# the Free Software Foundation, either version 3 of the License, or
202 -# (at your option) any later version.
203 +# This program is free software: you can redistribute it and/or modify
204 +# it under the terms of the GNU General Public License as published by
205 +# the Free Software Foundation, either version 3 of the License, or
206 +# (at your option) any later version.
207 #
208 -# This program is distributed in the hope that it will be useful,
209 -# but WITHOUT ANY WARRANTY; without even the implied warranty of
210 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
211 -# GNU General Public License for more details.
212 +# This program is distributed in the hope that it will be useful,
213 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
214 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
215 +# GNU General Public License for more details.
216 #
217 -# You should have received a copy of the GNU General Public License
218 -# along with this program. If not, see <http://www.gnu.org/licenses/>.
219 +# You should have received a copy of the GNU General Public License
220 +# along with this program. If not, see <http://www.gnu.org/licenses/>.
221 #
222
223 # dotest = 0 -> do only XATTR_PAX or PT_PAX test
224 @@ -119,8 +119,11 @@ for pf in "p" "P" "-"; do
225 fi
226 fi
227 done
228 +
229 if [ "${verbose}" != 0 ] ;then
230 echo
231 + else
232 + echo -n "."
233 fi
234
235 done
236 @@ -129,6 +132,10 @@ for pf in "p" "P" "-"; do
237 done
238 done
239
240 +if [ "${verbose}" = 0 ] ;then
241 + echo
242 + echo
243 +fi
244 echo " Mismatches = ${count}"
245 echo
246 echo "================================================================================"
247
248 diff --git a/tests/pxtpax/init.sh b/tests/pxtpax/init.sh
249 index 3d41305..85f66ba 100755
250 --- a/tests/pxtpax/init.sh
251 +++ b/tests/pxtpax/init.sh
252 @@ -1,20 +1,20 @@
253 #!/bin/bash
254 #
255 -# init.sh: this file is part of the elfix package
256 -# Copyright (C) 2011 Anthony G. Basile
257 +# init.sh: this file is part of the elfix package
258 +# Copyright (C) 2011, 2012 Anthony G. Basile
259 #
260 -# This program is free software: you can redistribute it and/or modify
261 -# it under the terms of the GNU General Public License as published by
262 -# the Free Software Foundation, either version 3 of the License, or
263 -# (at your option) any later version.
264 +# This program is free software: you can redistribute it and/or modify
265 +# it under the terms of the GNU General Public License as published by
266 +# the Free Software Foundation, either version 3 of the License, or
267 +# (at your option) any later version.
268 #
269 -# This program is distributed in the hope that it will be useful,
270 -# but WITHOUT ANY WARRANTY; without even the implied warranty of
271 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
272 -# GNU General Public License for more details.
273 +# This program is distributed in the hope that it will be useful,
274 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
275 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
276 +# GNU General Public License for more details.
277 #
278 -# You should have received a copy of the GNU General Public License
279 -# along with this program. If not, see <http://www.gnu.org/licenses/>.
280 +# You should have received a copy of the GNU General Public License
281 +# along with this program. If not, see <http://www.gnu.org/licenses/>.
282 #
283
284 PATH=/sbin:/bin
285 @@ -25,33 +25,33 @@ PIDFILE="${PWD}"/daemon.pid
286
287 start()
288 {
289 - rm -f ${PIDFILE}
290 - if [ -e ${DAEMON} ]
291 - then
292 - PID=$(${DAEMON})
293 - if [ "x${PID}" != "x" ]
294 - then
295 - echo $PID >> ${PIDFILE}
296 - fi
297 - else
298 - echo "No daemon"
299 - fi
300 + rm -f ${PIDFILE}
301 + if [ -e ${DAEMON} ]
302 + then
303 + PID=$(${DAEMON})
304 + if [ "x${PID}" != "x" ]
305 + then
306 + echo $PID >> ${PIDFILE}
307 + fi
308 + else
309 + echo "No daemon"
310 + fi
311 }
312
313 stop()
314 {
315 - kill $(cat ${PIDFILE})
316 - rm -f ${PIDFILE}
317 + kill $(cat ${PIDFILE})
318 + rm -f ${PIDFILE}
319 }
320
321 case "$1" in
322 - start)
323 - start
324 - ;;
325 - stop)
326 - stop
327 - ;;
328 - *)
329 - echo "Usage: $0 start | stop"
330 - ;;
331 + start)
332 + start
333 + ;;
334 + stop)
335 + stop
336 + ;;
337 + *)
338 + echo "Usage: $0 start | stop"
339 + ;;
340 esac
341
342 diff --git a/tests/revdeppaxtest/revdeptest.sh b/tests/revdeppaxtest/revdeptest.sh
343 index 6512959..84e67b6 100755
344 --- a/tests/revdeppaxtest/revdeptest.sh
345 +++ b/tests/revdeppaxtest/revdeptest.sh
346 @@ -1,20 +1,20 @@
347 #!/bin/bash
348 #
349 -# revdeptest.sh: this file is part of the elfix package
350 -# Copyright (C) 2011 Anthony G. Basile
351 +# revdeptest.sh: this file is part of the elfix package
352 +# Copyright (C) 2011 Anthony G. Basile
353 #
354 -# This program is free software: you can redistribute it and/or modify
355 -# it under the terms of the GNU General Public License as published by
356 -# the Free Software Foundation, either version 3 of the License, or
357 -# (at your option) any later version.
358 +# This program is free software: you can redistribute it and/or modify
359 +# it under the terms of the GNU General Public License as published by
360 +# the Free Software Foundation, either version 3 of the License, or
361 +# (at your option) any later version.
362 #
363 -# This program is distributed in the hope that it will be useful,
364 -# but WITHOUT ANY WARRANTY; without even the implied warranty of
365 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
366 -# GNU General Public License for more details.
367 +# This program is distributed in the hope that it will be useful,
368 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
369 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
370 +# GNU General Public License for more details.
371 #
372 -# You should have received a copy of the GNU General Public License
373 -# along with this program. If not, see <http://www.gnu.org/licenses/>.
374 +# You should have received a copy of the GNU General Public License
375 +# along with this program. If not, see <http://www.gnu.org/licenses/>.
376 #
377
378 echo "================================================================================"
379 @@ -27,10 +27,10 @@ shift
380
381 ID=$(id -u)
382 if [ "$ID" != 0 ]; then
383 - echo " MUST BE ROOT"
384 - echo
385 - echo "================================================================================"
386 - exit 1
387 + echo " MUST BE ROOT"
388 + echo
389 + echo "================================================================================"
390 + exit 1
391 fi
392
393 PAXCTLNG="../../src/paxctl-ng"
394 @@ -58,7 +58,7 @@ XYZ;${LIBSPATH}/${LIBRARY};${SONAME};;
395 EOF
396
397 if [ "${verbose}" = 0 ] ;then
398 - echo -n " "
399 + echo -n " "
400 fi
401
402 unamem=$(uname -m)
403 @@ -70,89 +70,89 @@ PYTHONPATH="../../scripts/build/lib.linux-${unamem}-${pythonversion}"
404 # Assume the pax.so module is built if the path exists
405 # otherwise build it ourselves!
406 if [ ! -d ${PYTHONPATH} ]; then
407 - echo " (Re)building pax module"
408 -
409 - #NOTE: the last -D or -U wins as it does for gcc $CFLAGS
410 - for f in $@; do
411 - [ $f = "-UXTPAX" ] && unset XTPAX
412 - [ $f = "-DXTPAX" ] && XTPAX=1
413 - [ $f = "-UPTPAX" ] && unset PTPAX
414 - [ $f = "-DPTPAX" ] && PTPAX=1
415 - done
416 - export XTPAX
417 - export PTPAX
418 -
419 - ( cd ../../scripts; exec ./setup.py build ) >/dev/null
420 + echo " (Re)building pax module"
421 +
422 + #NOTE: the last -D or -U wins as it does for gcc $CFLAGS
423 + for f in $@; do
424 + [ $f = "-UXTPAX" ] && unset XTPAX
425 + [ $f = "-DXTPAX" ] && XTPAX=1
426 + [ $f = "-UPTPAX" ] && unset PTPAX
427 + [ $f = "-DPTPAX" ] && PTPAX=1
428 + done
429 + export XTPAX
430 + export PTPAX
431 +
432 + ( cd ../../scripts; exec ./setup.py build ) >/dev/null
433 fi
434
435 count=0
436
437 for bf in "R" "r" "Rr"
438 do
439 - for lf in "R" "r" "Rr"
440 - do
441 - $PAXCTLNG -z "${LIBSPATH}/${BINARY}"
442 - $PAXCTLNG -e${bf} "${LIBSPATH}/${BINARY}"
443 - $PAXCTLNG -z "${LIBSPATH}/${LIBRARY}"
444 - $PAXCTLNG -m${lf} "${LIBSPATH}/${LIBRARY}"
445 -
446 - p=$($PAXCTLNG -v ${LIBSPATH}/${BINARY})
447 - p=$(echo $p | awk '{ print $4 }')
448 - if [ "${verbose}" != 0 ] ;then
449 - echo " BEFORE: "
450 - echo " Binary: $p"
451 - fi
452 -
453 - p=$($PAXCTLNG -v ${LIBSPATH}/${LIBRARY})
454 - p=$(echo $p | awk '{ print $4 }')
455 - if [ "${verbose}" != 0 ] ;then
456 - echo " Library: $p"
457 - fi
458 -
459 - $REVDEPPAX -m -y -s ${SONAME} >/dev/null 2>&1
460 -
461 - ba=$($PAXCTLNG -v ${LIBSPATH}/${BINARY})
462 - ba=$(echo $ba | awk '{ print $4 }')
463 - if [ "${verbose}" != 0 ] ;then
464 - echo " AFTER: "
465 - echo " Binary: $ba"
466 - fi
467 -
468 - p=$($PAXCTLNG -v ${LIBSPATH}/${LIBRARY})
469 - p=$(echo $p | awk '{ print $4 }')
470 - if [ "${verbose}" != 0 ] ;then
471 - echo " Library: $p"
472 - fi
473 -
474 - be="-em"
475 - unset x
476 -
477 - if [ "$bf" != "$lf" -a "$bf" != "Rr" ]; then
478 - x="$bf"
479 - elif [ "$bf" = "$lf" ]; then
480 - x="$bf"
481 - elif [ "$lf" = "Rr" ]; then
482 - x="$bf"
483 - elif [ "$bf" = "Rr" ]; then
484 - x="$lf"
485 - fi
486 -
487 - be+="${x/Rr/-}-"
488 -
489 - if [ "$be" != "$ba" ]; then
490 - (( count = count + 1 ))
491 - if [ "${verbose}" != 0 ] ;then
492 - echo " Mismatch: Expected Binary: ${be}"
493 - fi
494 - fi
495 -
496 - if [ "${verbose}" != 0 ] ;then
497 - echo
498 - echo
499 - else
500 - echo -n "."
501 - fi
502 - done
503 + for lf in "R" "r" "Rr"
504 + do
505 + $PAXCTLNG -z "${LIBSPATH}/${BINARY}"
506 + $PAXCTLNG -e${bf} "${LIBSPATH}/${BINARY}"
507 + $PAXCTLNG -z "${LIBSPATH}/${LIBRARY}"
508 + $PAXCTLNG -m${lf} "${LIBSPATH}/${LIBRARY}"
509 +
510 + p=$($PAXCTLNG -v ${LIBSPATH}/${BINARY})
511 + p=$(echo $p | awk '{ print $4 }')
512 + if [ "${verbose}" != 0 ] ;then
513 + echo " BEFORE: "
514 + echo " Binary: $p"
515 + fi
516 +
517 + p=$($PAXCTLNG -v ${LIBSPATH}/${LIBRARY})
518 + p=$(echo $p | awk '{ print $4 }')
519 + if [ "${verbose}" != 0 ] ;then
520 + echo " Library: $p"
521 + fi
522 +
523 + $REVDEPPAX -m -y -s ${SONAME} >/dev/null 2>&1
524 +
525 + ba=$($PAXCTLNG -v ${LIBSPATH}/${BINARY})
526 + ba=$(echo $ba | awk '{ print $4 }')
527 + if [ "${verbose}" != 0 ] ;then
528 + echo " AFTER: "
529 + echo " Binary: $ba"
530 + fi
531 +
532 + p=$($PAXCTLNG -v ${LIBSPATH}/${LIBRARY})
533 + p=$(echo $p | awk '{ print $4 }')
534 + if [ "${verbose}" != 0 ] ;then
535 + echo " Library: $p"
536 + fi
537 +
538 + be="-em"
539 + unset x
540 +
541 + if [ "$bf" != "$lf" -a "$bf" != "Rr" ]; then
542 + x="$bf"
543 + elif [ "$bf" = "$lf" ]; then
544 + x="$bf"
545 + elif [ "$lf" = "Rr" ]; then
546 + x="$bf"
547 + elif [ "$bf" = "Rr" ]; then
548 + x="$lf"
549 + fi
550 +
551 + be+="${x/Rr/-}-"
552 +
553 + if [ "$be" != "$ba" ]; then
554 + (( count = count + 1 ))
555 + if [ "${verbose}" != 0 ] ;then
556 + echo " Mismatch: Expected Binary: ${be}"
557 + fi
558 + fi
559 +
560 + if [ "${verbose}" != 0 ] ;then
561 + echo
562 + echo
563 + else
564 + echo -n "."
565 + fi
566 + done
567 done
568 #
569 # do test here
570 @@ -164,8 +164,8 @@ ${RMDIR} ${VARDBPKG}/${CAT}/${PKG}
571 ${RMDIR} ${VARDBPKG}/${CAT}
572
573 if [ "${verbose}" = 0 ] ;then
574 - echo
575 - echo
576 + echo
577 + echo
578 fi
579 echo " Mismatches = ${count}"
580 echo