From f094521fe8d4eda1d5074aa14e2200f624adcdaf Mon Sep 17 00:00:00 2001 From: netblue30 Date: Tue, 11 Jan 2022 20:57:49 -0500 Subject: fix fcopy testing --- test/fcopy/dircopy.exp | 14 +++++ test/fcopy/fcopy.sh | 7 ++- test/fcopy/linkcopy.exp | 14 ++++- test/fcopy/src/dircopy.exp | 139 --------------------------------------------- 4 files changed, 29 insertions(+), 145 deletions(-) delete mode 100755 test/fcopy/src/dircopy.exp (limited to 'test/fcopy') diff --git a/test/fcopy/dircopy.exp b/test/fcopy/dircopy.exp index 0882561e5..a779f80cd 100755 --- a/test/fcopy/dircopy.exp +++ b/test/fcopy/dircopy.exp @@ -12,9 +12,21 @@ match_max 100000 send -- "rm -fr dest/*\r" after 100 +send -- "cd src\r" +after 100 +send -- "ln -s ../dircopy.exp dircopy.exp\r" +after 100 +send -- "cd ..\r" +after 100 send -- "fcopy src dest\r" after 100 +send -- "cd src\r" +after 100 +send -- "ln -s ../dircopy.exp dircopy.exp\r" +after 100 +send -- "cd ..\r" +after 100 send -- "find dest\r" expect { @@ -135,5 +147,7 @@ expect { send -- "rm -fr dest/*\r" after 100 +send -- "rm -f src/dircopy.exp\r" +after 100 puts "\nall done\n" diff --git a/test/fcopy/fcopy.sh b/test/fcopy/fcopy.sh index cdfc424a3..fca599889 100755 --- a/test/fcopy/fcopy.sh +++ b/test/fcopy/fcopy.sh @@ -19,13 +19,14 @@ mkdir dest echo "TESTING: fcopy cmdline (test/fcopy/cmdline.exp)" ./cmdline.exp -echo "TESTING: fcopy directory (test/fcopy/dircopy.exp)" -./dircopy.exp - echo "TESTING: fcopy file (test/fcopy/filecopy.exp)" ./filecopy.exp echo "TESTING: fcopy link (test/fcopy/linkcopy.exp)" ./linkcopy.exp +echo "TESTING: fcopy directory (test/fcopy/dircopy.exp)" +./dircopy.exp + rm -fr dest/* +rm -f src/dircopy.exp \ No newline at end of file diff --git a/test/fcopy/linkcopy.exp b/test/fcopy/linkcopy.exp index dd91ac26f..7c085e552 100755 --- a/test/fcopy/linkcopy.exp +++ b/test/fcopy/linkcopy.exp @@ -12,6 +12,12 @@ match_max 100000 send -- "rm -fr dest/*\r" after 100 +send -- "cd src\r" +after 100 +send -- "ln -s ../dircopy.exp dircopy.exp\r" +after 100 +send -- "cd ..\r" +after 100 send -- "fcopy src/dircopy.exp dest\r" after 100 @@ -19,7 +25,7 @@ after 100 send -- "find dest\r" expect { timeout {puts "TESTING ERROR 0\n";exit} - "dest/" + "dest" } expect { timeout {puts "TESTING ERROR 1\n";exit} @@ -27,11 +33,11 @@ expect { } after 100 - send -- "ls -al dest\r" expect { timeout {puts "TESTING ERROR 2\n";exit} - "lrwxrwxrwx" + "rwxr-xr-x" { puts "umask 0022\n" } + "rwxrwxr-x" { puts "umask 0002\n" } } after 100 send -- "stty -echo\r" @@ -52,5 +58,7 @@ expect { send -- "rm -fr dest/*\r" after 100 +send -- "rm -f src/dircopy.exp\r" +after 100 puts "\nall done\n" diff --git a/test/fcopy/src/dircopy.exp b/test/fcopy/src/dircopy.exp deleted file mode 100755 index 0882561e5..000000000 --- a/test/fcopy/src/dircopy.exp +++ /dev/null @@ -1,139 +0,0 @@ -#!/usr/bin/expect -f -# This file is part of Firejail project -# Copyright (C) 2014-2022 Firejail Authors -# License GPL v2 - -# -# copy directory src to dest -# -set timeout 10 -spawn $env(SHELL) -match_max 100000 - -send -- "rm -fr dest/*\r" -after 100 - -send -- "fcopy src dest\r" -after 100 - -send -- "find dest\r" -expect { - timeout {puts "TESTING ERROR 0\n";exit} - "dest/" -} -after 100 - -send -- "find dest\r" -expect { - timeout {puts "TESTING ERROR 0\n";exit} - "dest/" -} -after 100 - -send -- "find dest\r" -expect { - timeout {puts "TESTING ERROR 1\n";exit} - "dest/a" -} -after 100 - -send -- "find dest\r" -expect { - timeout {puts "TESTING ERROR 2\n";exit} - "dest/a/b" -} -after 100 - -send -- "find dest\r" -expect { - timeout {puts "TESTING ERROR 3\n";exit} - "dest/a/b/file4" -} -after 100 - -send -- "find dest\r" -expect { - timeout {puts "TESTING ERROR 4\n";exit} - "dest/a/file3" -} -after 100 - -send -- "find dest\r" -expect { - timeout {puts "TESTING ERROR 5\n";exit} - "dest/dircopy.exp" -} -after 100 - -send -- "find dest\r" -expect { - timeout {puts "TESTING ERROR 6\n";exit} - "dest/file2" -} -after 100 - -send -- "find dest\r" -expect { - timeout {puts "TESTING ERROR 7\n";exit} - "dest/file1" -} -after 100 - - -send -- "ls -al dest\r" -expect { - timeout {puts "TESTING ERROR 8\n";exit} - "drwxr-xr-x" { puts "umask 0022\n" } - "drwxrwxr-x" { puts "umask 0002\n" } -} -expect { - timeout {puts "TESTING ERROR 9\n";exit} - "a" -} -expect { - timeout {puts "TESTING ERROR 10\n";exit} - "lrwxrwxrwx" -} -expect { - timeout {puts "TESTING ERROR 11\n";exit} - "dircopy.exp" -} -expect { - timeout {puts "TESTING ERROR 12\n";exit} - "rwxr-xr-x" { puts "umask 0022\n" } - "rwxrwxr-x" { puts "umask 0002\n" } -} -expect { - timeout {puts "TESTING ERROR 13\n";exit} - "file1" -} -expect { - timeout {puts "TESTING ERROR 14\n";exit} - "rw-r--r--" { puts "umask 0022\n" } - "rw-rw-r--" { puts "umask 0002\n" } -} -expect { - timeout {puts "TESTING ERROR 15\n";exit} - "file2" -} -after 100 - -send -- "stty -echo\r" -after 100 -send -- "diff -q src/a/b/file4 dest/a/b/file4; echo done\r" -expect { - timeout {puts "TESTING ERROR 16\n";exit} - "differ" {puts "TESTING ERROR 17\n";exit} - "done" -} - -send -- "file dest/dircopy.exp\r" -expect { - timeout {puts "TESTING ERROR 18\n";exit} - "symbolic link" -} - -send -- "rm -fr dest/*\r" -after 100 - -puts "\nall done\n" -- cgit v1.2.3-70-g09d2