From 1e6116cf15d03745b2f1d8667b8c06a3fe1cce3d Mon Sep 17 00:00:00 2001 From: netblue30 Date: Tue, 31 Jan 2023 11:15:21 -0500 Subject: testing sysutils --- test/sysutils/curl.exp | 34 ++++++++++++++++++++++++++++++++++ test/sysutils/less.exp | 9 +++++---- test/sysutils/man.exp | 4 ++-- test/sysutils/sysutils.sh | 31 +++++++++++++++++++++++-------- test/sysutils/wget.exp | 34 ++++++++++++++++++++++++++++++++++ 5 files changed, 98 insertions(+), 14 deletions(-) create mode 100755 test/sysutils/curl.exp create mode 100755 test/sysutils/wget.exp (limited to 'test') diff --git a/test/sysutils/curl.exp b/test/sysutils/curl.exp new file mode 100755 index 000000000..29c9883a4 --- /dev/null +++ b/test/sysutils/curl.exp @@ -0,0 +1,34 @@ +#!/usr/bin/expect -f +# This file is part of Firejail project +# Copyright (C) 2014-2022 Firejail Authors +# License GPL v2 + +set timeout 10 +spawn $env(SHELL) +match_max 100000 + +send -- "rm index.html*\r" +after 500 + +send -- "firejail --ignore=quiet curl -s -o index.html debian.org\r" +expect { + timeout {puts "TESTING ERROR 1\n";exit} + "Child process initialized" +} +expect { + timeout {puts "TESTING ERROR 2\n";exit} + "Parent is shutting down" +} +after 100 + +send -- "ls -l index.html\r" +expect { + timeout {puts "TESTING ERROR 3\n";exit} + "No such file or directory" {puts "TESTING ERROR 4\n";exit} + "rw" +} +after 100 +send -- "rm index.html*\r" +after 500 + +puts "\nall done\n" diff --git a/test/sysutils/less.exp b/test/sysutils/less.exp index 01a298fe0..7bbd76942 100755 --- a/test/sysutils/less.exp +++ b/test/sysutils/less.exp @@ -10,13 +10,14 @@ match_max 100000 send -- "firejail less sysutils.sh\r" expect { timeout {puts "TESTING ERROR 1\n";exit} - "(press RETURN)" {puts "TESTING SKIP 1.1\n";exit} - "Press RETURN to continue" {puts "TESTING SKIP 1.2\n";exit} - "MALLOC_CHECK" + "(press RETURN)" {puts "TESTING SKIP: terminal is not fully functional - 1.1\n";exit} + "Press RETURN to continue" {puts "TESTING SKIP: terminal is not fully functional - 1.2\n";exit} + "Firejail Authors" } expect { timeout {puts "TESTING ERROR 2\n";exit} - "./cpio.exp" + "MALLOC_CHECK" } +after 100 puts "\nall done\n" diff --git a/test/sysutils/man.exp b/test/sysutils/man.exp index a263180b5..c569653c6 100755 --- a/test/sysutils/man.exp +++ b/test/sysutils/man.exp @@ -10,8 +10,8 @@ match_max 100000 send -- "firejail man firejail\r" expect { timeout {puts "TESTING ERROR 0\n";exit} - "(press RETURN)" {puts "TESTING SKIP 1.1\n";exit} - "Press RETURN to continue" {puts "TESTING SKIP 1.2\n";exit} + "(press RETURN)" {puts "TESTING SKIP: terminal is not fully functional - 1.1\n";exit} + "Press RETURN to continue" {puts "TESTING SKIP: terminal is not fully functional - 1.2\n";exit} "NAME" } after 100 diff --git a/test/sysutils/sysutils.sh b/test/sysutils/sysutils.sh index a46cfb1ad..bab243c4b 100755 --- a/test/sysutils/sysutils.sh +++ b/test/sysutils/sysutils.sh @@ -15,14 +15,6 @@ else echo "TESTING SKIP: cpio not found" fi -#if command -v strings -#then -# echo "TESTING: strings" -# ./strings.exp -#else -# echo "TESTING SKIP: strings not found" -#fi - if command -v gzip then echo "TESTING: gzip" @@ -111,4 +103,27 @@ else echo "TESTING SKIP: man not found" fi +if command -v wget +then + echo "TESTING: wget" + ./wget.exp +else + echo "TESTING SKIP: wget not found" +fi + +if command -v curl +then + echo "TESTING: curl" + ./curl.exp +else + echo "TESTING SKIP: curl not found" +fi + +if command -v strings +then + echo "TESTING: strings" + ./strings.exp +else + echo "TESTING SKIP: strings not found" +fi diff --git a/test/sysutils/wget.exp b/test/sysutils/wget.exp new file mode 100755 index 000000000..c6d2765c7 --- /dev/null +++ b/test/sysutils/wget.exp @@ -0,0 +1,34 @@ +#!/usr/bin/expect -f +# This file is part of Firejail project +# Copyright (C) 2014-2022 Firejail Authors +# License GPL v2 + +set timeout 10 +spawn $env(SHELL) +match_max 100000 + +send -- "rm index.html*\r" +after 500 + +send -- "firejail --ignore=quiet wget -q debian.org\r" +expect { + timeout {puts "TESTING ERROR 1\n";exit} + "Child process initialized" +} +expect { + timeout {puts "TESTING ERROR 2\n";exit} + "Parent is shutting down" +} +after 100 + +send -- "ls -l index.html\r" +expect { + timeout {puts "TESTING ERROR 3\n";exit} + "No such file or directory" {puts "TESTING ERROR 4\n";exit} + "rw" +} +after 100 +send -- "rm index.html*\r" +after 500 + +puts "\nall done\n" -- cgit v1.2.3-54-g00ecf