From 4ece607b8f833cf0974bcf2a5e41f0504cbbff59 Mon Sep 17 00:00:00 2001 From: netblue30 Date: Tue, 28 Jun 2016 07:58:20 -0400 Subject: sysutils --- test/sysutils/cpio.exp | 26 ++++++++++++++++++++++++++ test/sysutils/gzip.exp | 26 ++++++++++++++++++++++++++ test/sysutils/strings.exp | 26 ++++++++++++++++++++++++++ test/sysutils/sysutils.sh | 44 ++++++++++++++++++++++++++++++++++++++++++++ test/sysutils/xzdec.exp | 29 +++++++++++++++++++++++++++++ 5 files changed, 151 insertions(+) create mode 100755 test/sysutils/cpio.exp create mode 100755 test/sysutils/gzip.exp create mode 100755 test/sysutils/strings.exp create mode 100755 test/sysutils/sysutils.sh create mode 100755 test/sysutils/xzdec.exp (limited to 'test/sysutils') diff --git a/test/sysutils/cpio.exp b/test/sysutils/cpio.exp new file mode 100755 index 000000000..9755d8737 --- /dev/null +++ b/test/sysutils/cpio.exp @@ -0,0 +1,26 @@ +#!/usr/bin/expect -f +# This file is part of Firejail project +# Copyright (C) 2014-2016 Firejail Authors +# License GPL v2 + +set timeout 10 +spawn $env(SHELL) +match_max 100000 + +send -- "find /usr/share/doc/firejail | /bin/cpio -ov > firejail_t1\r" +sleep 1 + +send -- "find /usr/share/doc/firejail | firejail /bin/cpio -ov > firejail_t2\r" +sleep 1 + +send -- "diff -s firejail_t1 firejail_t2\r" +expect { + timeout {puts "TESTING ERROR 1\n";exit} + "firejail_t1 and firejail_t2 are identical" +} + +send -- "rm firejail_t*\r" +sleep 1 + + +puts "\nall done\n" diff --git a/test/sysutils/gzip.exp b/test/sysutils/gzip.exp new file mode 100755 index 000000000..ab0e727de --- /dev/null +++ b/test/sysutils/gzip.exp @@ -0,0 +1,26 @@ +#!/usr/bin/expect -f +# This file is part of Firejail project +# Copyright (C) 2014-2016 Firejail Authors +# License GPL v2 + +set timeout 10 +spawn $env(SHELL) +match_max 100000 + +send -- "/bin/gzip -c /usr/bin/firejail > firejail_t1\r" +sleep 1 + +send -- "firejail /bin/gzip -c /usr/bin/firejail > firejail_t2\r" +sleep 1 + +send -- "diff -s firejail_t1 firejail_t2\r" +expect { + timeout {puts "TESTING ERROR 1\n";exit} + "firejail_t1 and firejail_t2 are identical" +} + +send -- "rm firejail_t*\r" +sleep 1 + + +puts "\nall done\n" diff --git a/test/sysutils/strings.exp b/test/sysutils/strings.exp new file mode 100755 index 000000000..1fd0f5dc0 --- /dev/null +++ b/test/sysutils/strings.exp @@ -0,0 +1,26 @@ +#!/usr/bin/expect -f +# This file is part of Firejail project +# Copyright (C) 2014-2016 Firejail Authors +# License GPL v2 + +set timeout 10 +spawn $env(SHELL) +match_max 100000 + +send -- "/usr/bin/strings /usr/bin/firejail > firejail_t1\r" +sleep 1 + +send -- "firejail /usr/bin/strings /usr/bin/firejail > firejail_t2\r" +sleep 1 + +send -- "diff -s firejail_t1 firejail_t2\r" +expect { + timeout {puts "TESTING ERROR 1\n";exit} + "firejail_t1 and firejail_t2 are identical" +} + +send -- "rm firejail_t*\r" +sleep 1 + + +puts "\nall done\n" diff --git a/test/sysutils/sysutils.sh b/test/sysutils/sysutils.sh new file mode 100755 index 000000000..f230c9a6b --- /dev/null +++ b/test/sysutils/sysutils.sh @@ -0,0 +1,44 @@ +#!/bin/bash +# This file is part of Firejail project +# Copyright (C) 2014-2016 Firejail Authors +# License GPL v2 + +export MALLOC_CHECK_=3 +export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) + +which cpio +if [ "$?" -eq 0 ]; +then + echo "TESTING: cpio" + ./cpio.exp +else + echo "TESTING SKIP: cpio not found" +fi + +which strings +if [ "$?" -eq 0 ]; +then + echo "TESTING: strings" + ./strings.exp +else + echo "TESTING SKIP: strings not found" +fi + +which gzip +if [ "$?" -eq 0 ]; +then + echo "TESTING: gzip" + ./gzip.exp +else + echo "TESTING SKIP: gzip not found" +fi + +which xzdec +if [ "$?" -eq 0 ]; +then + echo "TESTING: xzdec" + ./xzdec.exp +else + echo "TESTING SKIP: xzdec not found" +fi + diff --git a/test/sysutils/xzdec.exp b/test/sysutils/xzdec.exp new file mode 100755 index 000000000..0ea6f5fb0 --- /dev/null +++ b/test/sysutils/xzdec.exp @@ -0,0 +1,29 @@ +#!/usr/bin/expect -f +# This file is part of Firejail project +# Copyright (C) 2014-2016 Firejail Authors +# License GPL v2 + +set timeout 10 +spawn $env(SHELL) +match_max 100000 + +send -- "/usr/bin/xz -c /usr/bin/firejail > firejail_t3\r" +sleep 1 + +send -- "/usr/bin/xzdec -c firejail_t3 > firejail_t1\r" +sleep 1 + +send -- "firejail /usr/bin/xzdec -c firejail_t3 > firejail_t2\r" +sleep 1 + +send -- "diff -s firejail_t1 firejail_t2\r" +expect { + timeout {puts "TESTING ERROR 1\n";exit} + "firejail_t1 and firejail_t2 are identical" +} + +send -- "rm firejail_t*\r" +sleep 1 + + +puts "\nall done\n" -- cgit v1.2.3-54-g00ecf