Compare commits

...

No commits in common. "c8s" and "827a70cd43d3ac5b1f4bfb407ab4d40ff6836eee" have entirely different histories.

57 changed files with 2645 additions and 44 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/zip30.tar.gz
zip30.tar.gz

View File

@ -1 +1 @@
c9f4099ecf2772b53c2dd4a8e508064ce015d182 SOURCES/zip30.tar.gz
c9f4099ecf2772b53c2dd4a8e508064ce015d182 zip30.tar.gz

View File

@ -1,24 +0,0 @@
From b0b6660d474738a23e6ef84afadd4f87793e3ad0 Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka@redhat.com>
Date: Tue, 13 Nov 2018 12:57:13 +0100
Subject: [PATCH] XXX
---
zip.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/zip.h b/zip.h
index ba03160..d62de9a 100644
--- a/zip.h
+++ b/zip.h
@@ -609,7 +609,7 @@ extern int bflag;
void zipmessage_nl OF((ZCONST char *, int));
void zipmessage OF((ZCONST char *, ZCONST char *));
void zipwarn OF((ZCONST char *, ZCONST char *));
-void ziperr OF((int, ZCONST char *));
+void ziperr OF((int, ZCONST char *)) __attribute__ ((noreturn));
#ifdef UTIL
# define error(msg) ziperr(ZE_LOGIC, msg)
#else
--
2.17.2

6
gating.yaml Normal file
View File

@ -0,0 +1,6 @@
--- !Policy
product_versions:
- rhel-9
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}

1
sources Normal file
View File

@ -0,0 +1 @@
7b74551e63f8ee6aab6fbc86676c0d37 zip30.tar.gz

55
tests/gating/all.sh Executable file
View File

@ -0,0 +1,55 @@
#!/bin/bash
# Copyright (C) 2019 Jakub Martisko <jamartis at redhat dot com>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
passed=0
subtests=(basic/* unzip/* zip/*)
total=${#subtests[@]}
skipped=0
for subtest in ${subtests[@]}
do
#tests to be skipped
if [ $subtest == "zip/largefiles" ]
then
((skipped++))
continue
fi
pushd $subtest >/dev/null
./test.sh
result=$?
echo "Test $subtest result: $result"
if [ "$result" == "0" ]
then
((passed++))
fi
popd >/dev/null
done
echo "Passed $passed/$total tests"
echo "Skipped $skipped/$total tests"
[[ $total == $((passed + skipped)) ]] || exit 1

View File

@ -0,0 +1,38 @@
#!/bin/bash
# Copyright (C) 2019 Jakub Martisko <jamartis at redhat dot com>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
files="./in ./exp ./out.zip"
rm -f $files
echo "Hello World" > ./in
echo "Hello World" > ./exp
zip ./out.zip ./in >/dev/null || exit 1
ls ./out.zip > /dev/null || exit 1
rm -f $files
exit 0

View File

@ -0,0 +1,44 @@
#!/bin/bash
# Copyright (C) 2019 Jakub Martisko <jamartis at redhat dot com>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
files="./in ./exp ./out.zip"
rm -f $files
echo "Hello World" > ./in
echo "Hello World" > ./exp
zip ./out.zip ./in > /dev/null || exit 1
rm -f ./in
unzip ./out.zip > /dev/null || exit 1
diff ./in ./exp || exit 1
rm -f $files
exit 0

42
tests/gating/unzip/copt/test.sh Executable file
View File

@ -0,0 +1,42 @@
#!/bin/bash
# Copyright (C) 2019 Jakub Martisko <jamartis at redhat dot com>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
files="./in ./exp ./out.zip ./out"
rm -f $files
echo "Hello World" > ./in
zip ./out.zip ./in >/dev/null || exit 1
unzip -c ./out.zip >./out || exit 1
(cat ./out |grep "Archive:[ \t]*./out.zip" >/dev/null) || exit 1
(cat ./out |grep "[ \t]*extracting:[ \t]*in" >/dev/null) || exit 1
(cat ./out |grep "Hello World" >/dev/null) || exit 1
rm -f $files
exit 0

View File

@ -0,0 +1,43 @@
#!/bin/bash
# Copyright (C) 2019 Jakub Martisko <jamartis at redhat dot com>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
files="./in ./exp ./out.zip ./out"
rm -f $files
echo "Hello World" > ./in
echo "Hello World" > ./exp
zip ./out.zip ./in >/dev/null || exit 1
UNZIP=-p unzip ./out.zip >./out || exit 1
diff ./out ./exp || exit 1
rm -f $files
exit 0
exit 1

View File

@ -0,0 +1,43 @@
#!/bin/bash
# Copyright (C) 2019 Jakub Martisko <jamartis at redhat dot com>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
files="./in ./exp ./out.zip ./dir"
rm -rf $files
echo "Hello World" > ./in
echo "Hello World" > ./exp
mkdir ./dir
zip ./out.zip ./in >/dev/null || exit 1
rm -f ./in
unzip -d dir ./out.zip >/dev/null || exit 1
diff ./dir/in ./exp >/dev/null || exit 1
rm -rf $files
exit 0

View File

@ -0,0 +1,44 @@
#!/bin/bash
# Copyright (C) 2019 Jakub Martisko <jamartis at redhat dot com>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
files="./in ./exp ./in2 ./out.zip"
rm -f $files
echo "Hello World" > ./in
echo "Hello World" > ./in2
echo "Hello World" > ./exp
zip ./out.zip ./in ./in2 >/dev/null || exit 1
rm -f ./in ./in2
unzip ./out.zip in >/dev/null || exit 1
ls ./in >/dev/null || exit 1
ls ./in2 2>/dev/null && exit 1
rm -f $files
exit 0

44
tests/gating/unzip/fopt/test.sh Executable file
View File

@ -0,0 +1,44 @@
#!/bin/bash
# Copyright (C) 2019 Jakub Martisko <jamartis at redhat dot com>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
files="./in ./exp ./out.zip"
rm -f $files
echo "Hello World" > ./in
echo "Hello World" > ./exp
zip ./out.zip ./in >/dev/null || exit 1
echo "Hello" > ./in
touch --date="last month" ./in
unzip -of ./out.zip >/dev/null || exit 1
diff ./exp ./in >/dev/null || exit 1
rm -f $files
exit 0

43
tests/gating/unzip/jmod/test.sh Executable file
View File

@ -0,0 +1,43 @@
#!/bin/bash
# Copyright (C) 2019 Jakub Martisko <jamartis at redhat dot com>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
files="./in ./exp ./out.zip ./dir"
rm -rf $files
mkdir dir
echo "Hello World" > ./dir/in
echo "Hello World" > ./exp
zip ./out.zip ./dir ./dir/in >/dev/null || exit 1
rm -rf ./dir
unzip -j ./out.zip >/dev/null || exit 1
diff ./exp ./in || exit 1
rm -f $files
exit 0

43
tests/gating/unzip/nmod/test.sh Executable file
View File

@ -0,0 +1,43 @@
#!/bin/bash
# Copyright (C) 2019 Jakub Martisko <jamartis at redhat dot com>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
files="./in ./exp ./out.zip"
rm -f $files
echo "Hello" > ./in
echo "Hello World" > ./exp
zip ./out.zip ./in >/dev/null || exit 1
echo "Hello World" > ./in
unzip -n ./out.zip >/dev/null || exit 1
diff ./in ./exp >/dev/null || exit 1
rm -f $files
exit 0

43
tests/gating/unzip/omod/test.sh Executable file
View File

@ -0,0 +1,43 @@
#!/bin/bash
# Copyright (C) 2019 Jakub Martisko <jamartis at redhat dot com>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
files="./in ./exp ./out.zip"
rm -f $files
echo "Hello World" > ./in
echo "Hello World" > ./exp
zip ./out.zip ./in >/dev/null || exit 1
echo "Hello" > ./in
unzip -o ./out.zip >/dev/null || exit 1
diff ./in ./exp >/dev/null || exit 1
rm -f $files
exit 0

42
tests/gating/unzip/pmod/test.sh Executable file
View File

@ -0,0 +1,42 @@
#!/bin/bash
# Copyright (C) 2019 Jakub Martisko <jamartis at redhat dot com>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
files="./in ./exp ./out.zip"
rm -f $files
echo "Hello World" > ./in
echo "Hello World" > ./exp
zip -P password ./out.zip ./in >/dev/null || exit 1
rm -f ./in
unzip -P password ./out.zip >/dev/null || exit 1
diff ./in ./exp || exit 1
rm -f $files
exit 0

42
tests/gating/unzip/popt/test.sh Executable file
View File

@ -0,0 +1,42 @@
#!/bin/bash
# Copyright (C) 2019 Jakub Martisko <jamartis at redhat dot com>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
files="./in ./exp ./out.zip ./out"
rm -f $files
echo "Hello World" > ./in
echo "Hello World" > ./exp
zip ./out.zip ./in >/dev/null || exit 1
unzip -p ./out.zip >./out || exit 1
diff ./out ./exp || exit 1
rm -f $files
exit 0

48
tests/gating/unzip/uopt/test.sh Executable file
View File

@ -0,0 +1,48 @@
#!/bin/bash
# Copyright (C) 2019 Jakub Martisko <jamartis at redhat dot com>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
files="./in ./in2 ./exp ./out.zip"
rm -f $files
echo "Hello World" > ./in
echo "Hello World" > ./in2
echo "Hello World" > ./exp
zip ./out.zip ./in ./in2 >/dev/null || exit 1
echo "Hello" > ./in
touch --date="last month" ./in || exit 1
rm -f ./in2
unzip -ou ./out.zip >/dev/null || exit 1
diff ./in ./exp || exit 1
diff ./in2 ./exp || exit 1
rm -f $files
exit 0

View File

@ -0,0 +1,44 @@
#!/bin/bash
# Copyright (C) 2019 Jakub Martisko <jamartis at redhat dot com>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
files="./in ./exp ./in2 ./out.zip"
rm -f $files
echo "Hello World" > ./in
echo "Hello World" > ./in2
echo "Hello World" > ./exp
zip ./out.zip ./in ./in2 >/dev/null || exit 1
rm -f ./in ./in2
unzip ./out.zip -x in2 >/dev/null || exit 1
ls ./in >/dev/null || exit 1
ls ./in2 2>/dev/null && exit 1
rm -f $files
exit 0

View File

@ -0,0 +1,48 @@
#!/bin/bash
# Copyright (C) 2019 Jakub Martisko <jamartis at redhat dot com>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
files="./in ./exp ./in2 ./exp2 ./out.zip"
rm -f $files
echo "Hello World" > ./in
echo "Hello World" > ./exp
echo "Hello World 2" > ./in2
echo "Hello World 2" > ./exp2
zip out.zip ./in >/dev/null || exit 1
zip out.zip ./in2 >/dev/null || exit 1
rm -f ./in ./in2
unzip ./out.zip >/dev/null || exit 1
diff ./in ./exp || exit 1
diff ./in2 ./exp2 || exit 1
rm -f $files
exit 0

45
tests/gating/zip/copy/test.sh Executable file
View File

@ -0,0 +1,45 @@
#!/bin/bash
# Copyright (C) 2019 Jakub Martisko <jamartis at redhat dot com>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
files="./in ./exp ./out.zip ./out2.zip"
rm -f $files
echo "Hello World" > ./in
echo "Hello World" > ./exp
zip out.zip ./in >/dev/null || exit 1
rm -f ./in
zip -U ./out.zip in --out ./out2.zip >/dev/null || exit 1
unzip ./out2.zip >/dev/null || exit 1
diff ./in ./exp || exit 1
rm -f $files
exit 0

49
tests/gating/zip/delete/test.sh Executable file
View File

@ -0,0 +1,49 @@
#!/bin/bash
# Copyright (C) 2019 Jakub Martisko <jamartis at redhat dot com>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
files="./in ./exp ./in2 ./exp2 ./out.zip ./list"
rm -f $files
echo "Hello World" > ./in
echo "Hello World" > ./in2
echo "Hello World" > ./exp
zip ./out.zip ./in ./in2 >/dev/null || exit 1
rm -f ./in ./in2
zip -d ./out.zip ./in >/dev/null || exit 1
unzip ./out.zip >/dev/null || exit 1
ls ./in 2>/dev/null && exit 1
diff ./in2 ./exp || exit 1
rm -f $files
exit 0

View File

@ -0,0 +1,48 @@
#!/bin/bash
# Copyright (C) 2019 Jakub Martisko <jamartis at redhat dot com>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
files="./in ./exp ./in2 ./out.zip"
rm -f $files
echo "Hello World" > ./in
echo "Hello World" > ./in2
echo "Hello World" > ./exp
zip ./out.zip ./in ./in2 >/dev/null || exit 1
export ZIPOPT="-d"
zip ./out.zip in2 >/dev/null || exit 1
rm -f ./in ./in2
unzip ./out.zip >/dev/null || exit 1
diff ./in ./exp || exit 1
ls ./in2 2>/dev/null && exit 1
rm -f $files
exit 0

View File

@ -0,0 +1,44 @@
#!/bin/bash
# Copyright (C) 2019 Jakub Martisko <jamartis at redhat dot com>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
files="./in ./exp ./in2 ./out.zip"
rm -fr $files
echo "Hello World" > ./in
echo "Hello World" > ./in2
zip ./out.zip ./in ./in2 -x ./in2 >/dev/null || exit 1
rm -f ./in ./in2 >/dev/null
unzip ./out.zip >/dev/null || exit 1
ls ./in >/dev/null || exit 1
ls ./in2 2>/dev/null && exit 1
rm -f $files
exit 0

View File

@ -0,0 +1,53 @@
#!/bin/bash
# Copyright (C) 2019 Jakub Martisko <jamartis at redhat dot com>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
files="./in ./exp ./in2 ./exp2 ./out.zip ./list"
rm -f $files
echo "Hello World" > ./in
echo "Hello World" > ./exp
echo "Hello World 2" > ./in2
echo "Hello World 2" > ./exp2
cat << EOF > ./list
./in
./in2
EOF
zip -@ ./out.zip <./list >/dev/null || exit 1
rm -f ./in ./in2
unzip ./out.zip >/dev/null || exit 1
diff ./in ./exp || exit 1
diff ./in2 ./exp2 || exit 1
rm -f $files
exit 0

View File

@ -0,0 +1,53 @@
#!/bin/bash
# Copyright (C) 2019 Jakub Martisko <jamartis at redhat dot com>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
files="./in ./exp ./in2 ./exp2 ./out.zip"
rm -f $files
echo "Hello World" > ./in
echo "Hello World" > ./exp
echo "Hello World 2" > ./in2
echo "Hello World 2" > ./exp2
touch --date "last month" ./in
zip out.zip ./in >/dev/null || exit 1
echo "Hello World 2" > ./in
zip -f ./out.zip ./in ./in2
rm -f ./in ./in2
unzip ./out.zip >/dev/null || exit 1
diff ./in ./exp2 || exit 1
ls ./in2 2>/dev/null && exit 1
rm -f $files
exit 0

View File

@ -0,0 +1,46 @@
#!/bin/bash
# Copyright (C) 2019 Jakub Martisko <jamartis at redhat dot com>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
files="./in.in ./exp ./in2.notin ./exp2 ./out.zip"
rm -f $files
echo "Hello World" > ./in.in
echo "Hello World" > ./exp
echo "Hello World 2" > ./in2.notin
echo "Hello World 2" > ./exp2
zip out.zip ./in.in ./in2.notin -i \*.in >/dev/null || exit 1
rm -f ./in.in ./in2.notin
unzip ./out.zip >/dev/null || exit 1
diff ./in.in ./exp || exit 1
ls in2.notin 2>/dev/null && exit 1
rm -f $files
exit 0

View File

@ -0,0 +1,44 @@
#!/bin/bash
# Copyright (C) 2019 Jakub Martisko <jamartis at redhat dot com>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
files="./in ./exp ./out.zip ./dir"
rm -fr $files
mkdir dir
echo "Hello World" > ./dir/in
echo "Hello World" > ./exp
zip -j ./out.zip ./dir/in >/dev/null || exit 1
rm -rf ./dir
unzip ./out.zip >/dev/null
diff ./in ./exp || exit 1
rm -f $files
exit 0

View File

@ -0,0 +1,44 @@
#!/bin/bash
# Copyright (C) 2019 Jakub Martisko <jamartis at redhat dot com>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
files="./in ./exp ./out.zip"
rm -fr $files
dd if=/dev/urandom of=./exp bs=10M count=600 iflag=fullblock 2>/dev/null
cp ./exp ./in
zip ./out.zip ./in >/dev/null || exit 1
rm -f ./in
unzip ./out.zip || exit 1
diff ./exp ./in
rm -f $files
exit 0

44
tests/gating/zip/move/test.sh Executable file
View File

@ -0,0 +1,44 @@
#!/bin/bash
# Copyright (C) 2019 Jakub Martisko <jamartis at redhat dot com>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
files="./in ./exp ./out.zip "
rm -f $files
echo "Hello World" > ./in
echo "Hello World" > ./exp
zip -m ./out.zip ./in >/dev/null || exit 1
ls ./in 2>/dev/null && exit 1
unzip ./out.zip >/dev/null || exit 1
diff ./in ./exp || exit 1
rm -f $files
exit 0

View File

@ -0,0 +1,37 @@
#!/bin/bash
# Copyright (C) 2019 Jakub Martisko <jamartis at redhat dot com>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
files="./in ./exp ./out.zip"
rm -fr $files
echo "Hello World" > ./in
echo "Hello World" > ./exp
rm -f $files
exit 0

View File

@ -0,0 +1,46 @@
#!/bin/bash
# Copyright (C) 2019 Jakub Martisko <jamartis at redhat dot com>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
files="./in ./exp ./out.zip ./dir ./subdir"
rm -fr $files
mkdir -p ./dir/subdir
echo "Hello World" > ./dir/in
echo "Hello World" > ./dir/subdir/in
echo "Hello World" > ./exp
zip -r ./out.zip ./dir >/dev/null || exit 1
rm -rf ./dir
unzip ./out.zip >/dev/null || exit 1
diff ./dir/in ./exp || exit 1
diff ./dir/subdir/in ./exp || exit 1
rm -rf $files
exit 0

View File

@ -0,0 +1,49 @@
#!/bin/bash
# Copyright (C) 2019 Jakub Martisko <jamartis at redhat dot com>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
files="./in ./exp ./out.zip ./dir ./subdir"
rm -fr $files
mkdir -p ./dir/subdir
echo "Hello World" > ./dir/in.in
echo "Hello World" > ./dir/in.notin
echo "Hello World" > ./dir/subdir/in.in
echo "Hello World" > ./exp
zip -R ./out.zip "*.in" >/dev/null || exit 1
rm -rf ./dir
unzip ./out.zip >/dev/null || exit 1
diff ./dir/in.in ./exp || exit 1
diff ./dir/subdir/in.in ./exp || exit 1
ls ./dir/in.notin >/dev/null 2>/dev/null && exit 1
rm -rf $files
exit 0

View File

@ -0,0 +1,45 @@
#!/bin/bash
# Copyright (C) 2019 Jakub Martisko <jamartis at redhat dot com>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
files="./in ./exp ./out.zip"
rm -f $files
echo "Hello" > ./in
echo "Hello World" > ./exp
zip ./out.zip ./in >/dev/null || exit 1
echo "Hello World" > ./in
zip ./out.zip ./in >/dev/null || exit 1
rm -f ./in
unzip ./out.zip >/dev/null || exit 1
diff ./in ./exp || exit 1
rm -f $files
exit 0

50
tests/gating/zip/speed/test.sh Executable file
View File

@ -0,0 +1,50 @@
#!/bin/bash
# Copyright (C) 2019 Jakub Martisko <jamartis at redhat dot com>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
files="./in ./exp ./out.zip"
rm -fr $files
(dd if=/dev/urandom bs=1 count=50000 2>/dev/null | base64 -w 0) >./exp
for i in {0..9}
do
rm -f ./in ./out.zip
cp ./exp ./in
zip -$i ./out.zip ./in >/dev/null || exit 1
rm -f ./in
unzip ./out.zip >/dev/null || exit 1
diff ./in ./exp || exit 1
rm -f ./out.zip ./in
done
rm -f $files
exit 0

54
tests/gating/zip/split/test.sh Executable file
View File

@ -0,0 +1,54 @@
#!/bin/bash
# Copyright (C) 2019 Jakub Martisko <jamartis at redhat dot com>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
files="./in ./exp ./out.zip ./out.z01 ./out.z02 ./out2.zip"
rm -fr $files
for i in {1..100000}
do
echo "Hello World" >> ./in
echo "Hello World" >> ./exp
done
zip -Z store -s 500k ./out.zip ./in >/dev/null
rm -f ./in
ls ./out.z01 >/dev/null|| exit 1
ls ./out.z02 >/dev/null|| exit 1
ls ./out.zip >/dev/null|| exit 1
zip -o -s- ./out.zip -O ./out2.zip >/dev/null || exit 1
unzip ./out2.zip >/dev/null || exit 1
diff ./in ./exp || exit 1
rm -f $files
exit 0

37
tests/gating/zip/stdin/test.sh Executable file
View File

@ -0,0 +1,37 @@
#!/bin/bash
# Copyright (C) 2019 Jakub Martisko <jamartis at redhat dot com>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
files="./in ./exp ./out.zip"
rm -f $files
echo "Hello World" > ./in
echo "Hello World" > ./exp
rm -f $files
exit 0
exit 1

View File

@ -0,0 +1,45 @@
#!/bin/bash
# Copyright (C) 2019 Jakub Martisko <jamartis at redhat dot com>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
files="./in ./exp ./out.zip ./link"
rm -f $files
echo "Hello World" > ./in
echo "Hello World" > ./exp
ln -s ./in ./link
zip --symlinks ./out.zip ./in ./link >/dev/null || exit 1
rm -f ./in ./link
unzip ./out.zip >/dev/null || exit 1
(ls -l ./link | grep "lrwxrwxrwx") >/dev/null || exit 1
diff ./link ./exp || exit 1
rm -f $files
exit 0

53
tests/gating/zip/uopt/test.sh Executable file
View File

@ -0,0 +1,53 @@
#!/bin/bash
# Copyright (C) 2019 Jakub Martisko <jamartis at redhat dot com>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
files="./in ./exp ./out.zip ./in2 ./exp2"
rm -f $files
echo "Hello" > ./in
echo "Hello" > ./in2
echo "Hello" > ./exp
echo "Hello World" > ./exp2
zip ./out.zip ./in ./in2 >/dev/null || exit 1
echo "Hello World" > ./in
echo "Hello World" > ./in2
touch --date="last month" ./in
touch --date="next month" ./in2
zip -u ./out.zip ./in ./in2 >/dev/null || exit 1
rm -f ./in ./in2
unzip ./out.zip >/dev/null || exit 1
diff ./in ./exp || exit 1
diff ./in2 ./exp2 || exit 1
rm -f $files
exit 0

19
tests/tests.yml Normal file
View File

@ -0,0 +1,19 @@
---
- hosts: localhost
vars:
- artifacts: ./artifacts
remote_user: root
roles:
- role: standard-test-basic
tags:
- atomic
- classic
- container
tests:
- simple:
dir: gating
run: ./all.sh
required_packages:
- zip
- unzip
- coreutils

154
tests/tests/__init__.py Executable file
View File

@ -0,0 +1,154 @@
'''
author = esakaiev@redhat.com
'''
import logging
import sys
import subprocess
import os
import shutil
def decorated_message(message):
"""
This decorator is used for providing logging header for different sections in the scripts
:param message: (`STRING`)
:return: decorated_function
"""
def decorated_function(func):
"""
:param func:
:return:
"""
def wrapper(self):
"""
:param self:
:return:
"""
print " "
print ("::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
print (":: {0}".format(message))
print ("::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
func(self)
return wrapper
return decorated_function
class BaseZipTests(object):
"""
This is a Base class for zip tests
"""
def __init__(self):
self._set_logger()
self._purpose = ""
self.print_test_purpose()
def _set_logger(self):
"""
This method is used for instantiating of logger
:return:
- None
"""
self.logger = logging.getLogger()
self.logger.setLevel(logging.DEBUG)
self.handler = logging.StreamHandler(sys.stdout)
self.handler.setLevel(logging.DEBUG)
formatter = logging.Formatter('[ %(asctime)s ] :: [ %(message)s ]')
self.handler.setFormatter(formatter)
self.logger.addHandler(self.handler)
@decorated_message("PURPOSE")
def print_test_purpose(self):
"""
:return:
"""
print self._purpose
def run_cmd(self, cmd, exp_err_code, message, cwd=None):
"""
This method is used for executing cmd, check output error code and
add result in the logger
:param cmd: ('STRING') - some command to execute
:param exp_err_code: ('INTEGER') - expected error code
:param message: ('STRING') - command description
:param cwd: ('STRING') - path to directory, where need to execute cmd
:return:
- errcode ('INTEGER')
"""
try:
errcode = subprocess.call(cmd, shell=True, cwd=cwd, stdout=sys.stderr.fileno())
if errcode != exp_err_code:
self.logger.debug("FAIL :: {0}".format(message))
else:
self.logger.debug("PASS ] :: [ {0}".format(message))
return errcode
except subprocess.CalledProcessError as exp:
self.logger.error("Could not execute command {0}, e: {1}".format(cmd, exp))
def check_package(self):
"""
This method is used for checking, if zip package is installed
:return: None
"""
assert self.run_cmd("dnf list installed zip", 0, "Dnf package should be installed") == 0
def check_output(self, cmd, exp_output, message, cwd=None):
"""
This method is used for executing cmd and compare output result with expected message
:param cmd: (`STRING`) - some command to execute
:param exp_err_code: (`INTEGER`) - expected error code
:param message: (`STRING`) - command description
:param cwd: (`STRING`) - path to directory, where need to execute cmd
:return:
- output message (`STRING`)
"""
try:
output = self.execute_cmd(cmd, cwd)
if output != exp_output:
self.logger.debug("FAIL ]:: [ {}".format(message))
else:
self.logger.debug("PASS ] :: [ {}".format(message))
return output
except subprocess.CalledProcessError as exp:
self.logger.error(r'FAIL ] :: [ Could not execute command: "{0}",\
ex: {1}'.format(cmd, exp))
def execute_cmd(self, cmd, cwd=None):
"""
This method is used for executing cmd and return output message
:param cmd: (`STRING`) - some command to execute
:param cwd: (`STRING`) - path to directory, where need to execute cmd
:return:
- output message (`STRING`)
"""
try:
output = subprocess.check_output(cmd, shell=True, cwd=cwd)
return output
except subprocess.CalledProcessError as exp:
self.logger.error(r'FAIL ] :: [ Could not execute command: "{0}",\
ex: {1}'.format(cmd, exp))
def remove_file(self, file_path, is_directory=False):
"""
This method is used for removing files or directories after execution of test cases
:param file_path:(`STRING`) - path to file/folder
:param is_directory: (`BOOLEAN`) - True for directories
:return: None
"""
try:
if is_directory:
shutil.rmtree(file_path)
else:
os.remove(file_path)
self.logger.debug("File {0} has been successfully removed".format(file_path))
except OSError, exp:
self.logger.debug("File {0} doesn't exists, e: {1}".format(file_path, exp))

89
tests/tests/test_4GBsegfault.py Executable file
View File

@ -0,0 +1,89 @@
# Copyright (c) 2018 Red Hat, Inc. All rights reserved. This copyrighted material
# is made available to anyone wishing to use, modify, copy, or
# redistribute it subject to the terms and conditions of the GNU General
# Public License v.2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# Author: Eduard Sakaiev <esakaiev@redhat.com>
import sys
import uuid
sys.path.append("..")
from tests import BaseZipTests
from tests import decorated_message
PURPOSE = '''zip mustn't segfault when packing files larger than 4 GB.
Note: this test can't run on RHEL 2.1 since the utilities used here
in the test don't work there as expected. This test can't run on
RHEL 5 either, but in this case, the reason is reworked zip which
can't work with files larger than 4 GB at all.'''
class Test4GBsegfault(BaseZipTests):
"""
This class is used for providing functionality
for Test4GBsegfault test case
"""
def __init__(self):
"""
"""
self._purpose = PURPOSE
super(Test4GBsegfault, self).__init__()
self._tmpdir = "/tmp/{}".format(uuid.uuid4())
@decorated_message("SETUP")
def prepare_setup(self):
"""
:return:
"""
self.check_package()
self.run_cmd("mkdir {}".format(self._tmpdir), 0,
"Creating tmp directory {}".format(self._tmpdir))
@decorated_message("TEST")
def start_test(self):
"""
:return:
"""
self.run_cmd("dd if=/dev/zero of=testfile bs=1M count=4097", 0,
"Creating of 4Gb file", self._tmpdir + "/")
self.run_cmd("zip testfile.zip testfile", 0,
"Archiving file with zip", self._tmpdir + "/")
@decorated_message("CLEANUP")
def cleanup(self):
"""
:return:
"""
self.run_cmd("rm -r {}".format(self._tmpdir), 0,
"Removing tmp directory")
if __name__ == "__main__":
test_4gb = Test4GBsegfault()
try:
test_4gb.prepare_setup()
test_4gb.start_test()
except AssertionError, exp:
test_4gb.logger.debug("FAIL ] :: [ Assertion occurred {0}".format(exp))
except Exception, exp:
test_4gb.logger.debug("FAIL ] :: [ Exception occurred {0}".format(exp))
finally:
test_4gb.cleanup()

View File

@ -0,0 +1,128 @@
# python2 test_big_file_in_archive.py
# Author: Josef Zila <jzila@redhat.com>
# Location: CoreOS/zip/Functionality/stress-tests/big-file-in-archive/runtest.sh
# Description: zip - tests handling large files (2GB,3MB,4GB)
# Copyright (c) 2008 Red Hat, Inc. All rights reserved. This copyrighted material
# is made available to anyone wishing to use, modify, copy, or
# redistribute it subject to the terms and conditions of the GNU General
# Public License v.2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# Include rhts and rhtslib environment
# rpm -q --quiet rhtslib || rpm -Uvh http://nest.test.redhat.com/mnt/qa/scratch/pmuller/rhtslib/rhtslib.rpm
import sys
import uuid
import platform
sys.path.append("..")
from tests import BaseZipTests
from tests import decorated_message
PURPOSE = '''
Test Name: Big file in archive
Author: Josef Zila <jzila@redhat.com>
Location: CoreOS/zip/Functionality/stress-tests/big-file-in-archive/PURPOSE
Short Description:
Tests handling large files (2GB,3GB,4GB)
Long Description:
Test creates three files (2GB, 3GB and 4GB large) and attempts to archive each of them using zip. Then original files are deleted
and archives are unpacked, to check size of unpacked files. Current version of zip on all archs and distros in time of
writing(2.31-1) passes test. Note: 4GB file is too large for zip to handle, so it is not supposed to be successfully archived
or unpacked, test just checks for correct return codes.
how to run it:
python2 test_big_file_in_archive.py
TEST UPDATED (esakaiev)
------------------------
After rebase to zip-3.0-1 there is no 4GB limit. Patching the test accordingly.
'''
class TestBigFileInArchive(BaseZipTests):
"""
This class is used for providing functionality
for TestBigFileInArchive test case
"""
def __init__(self):
"""
"""
self._purpose = PURPOSE
super(TestBigFileInArchive, self).__init__()
self._files = ['/tmp/tmp.{}'.format(uuid.uuid4()) for x in xrange(3)]
self._files_sizes = [2048, 3056, 4096]
self._os_distribution = platform.linux_distribution()
@decorated_message("Preparing Setup")
def prepare_setup(self):
"""
:return:
"""
self.check_package()
for i, file_name in enumerate(self._files):
size = self._files_sizes[i]
assert self.run_cmd("dd if=/dev/zero of={0} bs=1M count={1}".format(file_name, size), 0,
"Creating {0} GB file".format(size / 1000), cwd="/tmp/") == 0
@decorated_message("Starting Test")
def start_test(self):
"""
:return:
"""
for i, file_name in enumerate(self._files):
error_code = 0
self.remove_file(file_name + ".zip") # #remove archive temp files, we just need unused temp names
size = self._files_sizes[i]
self.run_cmd("zip {0} {1}".format(file_name + ".zip", file_name), error_code,
"Archiving {} Gb file".format(size / 1000), cwd="/tmp/")
self.remove_file(file_name) # Removing original files
self.run_cmd("unzip {0} -d /".format(file_name + ".zip"), error_code,
"Unpacking {} Gb file".format(size / 1000), cwd="/tmp/")
# Checking new 2GB file size
self.check_output("stat -c %s {0}".format(self._files[0]), "2147483648\n", "Checking new 2GB file size")
@decorated_message("Cleaning up")
def cleanup(self):
"""
:return:
"""
for file_name in self._files:
self.remove_file(file_name)
self.remove_file(file_name + ".zip")
if __name__ == "__main__":
test = TestBigFileInArchive()
try:
test.prepare_setup()
test.start_test()
except AssertionError, exp:
test.logger.debug("FAIL ] :: [ Assertion occurred {0}".format(exp))
except Exception, exp:
test.logger.debug("FAIL ] :: [ Exception occurred {0}".format(exp))
finally:
test.cleanup()

View File

@ -0,0 +1,140 @@
# Author: Josef Zila <jzila@redhat.com>
# Location: CoreOS/zip/Functionality/stress-tests/long-path-in-archive/runtest.sh
# Description: zip - tests handling very long paths within archive (15*256 characters long path)
# Copyright (c) 2008 Red Hat, Inc. All rights reserved. This copyrighted material
# is made available to anyone wishing to use, modify, copy, or
# redistribute it subject to the terms and conditions of the GNU General
# Public License v.2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import sys
import uuid
import os
from shutil import copyfile
sys.path.append("..")
from tests import BaseZipTests
from tests import decorated_message
PURPOSE = '''
Test Name:
Author: Josef Zila <jzila@redhat.com>
Location: CoreOS/zip/Functionality/stress-tests/long-path-in-archive/PURPOSE
Short Description:
Tests handling very long paths within archive (15*256 characters long path)
Long Description:
This test creates file with very long path of 15 directories, each 255 characters. This whole directory structure is then zipped and unzipped
to determine if zip program handles paths this long correctly. Current version of zip on all archs and distros in time of writing(2.31-1) passes test.
how to run it:
choose arch and distro
TEST UPDATED (esakaiev)
'''
class TestLongPathInArchive(BaseZipTests):
"""
This class is used for providing functionality
for TestLongPathInArchive test case
"""
def __init__(self):
self._purpose = PURPOSE
super(TestLongPathInArchive, self).__init__()
self._tmpdir = "/tmp/{}".format(uuid.uuid4())
self._file_under_test = "/proc/version"
self._long_name = "".join(["aaaaa" for i in xrange(51)])
self._long_path = "/".join([self._long_name for x in xrange(15)])
self._test_file_path = self._tmpdir + "/" + self._long_path + "/" + "testfile"
self._package_ver = ""
self._package_release = ""
@decorated_message("Prepare setup")
def prepare_setup(self):
"""
:return:
"""
self.check_package()
self.run_cmd("mkdir {}".format(self._tmpdir), 0, "Creating tmp directory {}".format(self._tmpdir))
self._package_ver = self.execute_cmd("rpm -q zip --queryformat %{version}")
self._package_release = self.execute_cmd("rpm -q zip --queryformat %{version}")
self.logger.debug("Running zip.{0}.{1} package".format(self._package_ver, self._package_release))
# creating folders structure:
try:
os.makedirs(self._tmpdir + "/" + self._long_path)
self.logger.debug("PASS ] :: [ Test directory with long path has been successfully created")
except OSError, exp:
self.logger.debug("FAIL ] :: [ Could not create directories by path, e: {}".format(exp))
raise
copyfile(self._file_under_test, self._test_file_path)
@decorated_message("Starting Test cases")
def start_test(self):
"""
:return:
"""
self.run_cmd("zip -r test {0} -q".format(self._long_name), 0,
"Zipping test file",
cwd=self._tmpdir)
self.remove_file(self._tmpdir + "/" + self._long_name, True)
self.run_cmd("unzip -qq test.zip", 0,
"Unzipping test file",
cwd=self._tmpdir)
content_init = None
with open(self._file_under_test) as fp_init:
content_init = fp_init.read().replace('\n', '')
content_fut = None
with open(self._test_file_path) as fp_fut:
content_fut = fp_fut.read().replace('\n', '')
if content_init == content_fut:
self.logger.debug("PASS ] :: [ {}".format("Content of the initial file and file under test was matched"))
else:
self.logger.debug("FAIL ] :: [ {}".format("Content of the initial file and file under test wasn't matched"))
@decorated_message("Cleaning up")
def cleanup(self):
"""
:return:
"""
self.remove_file(self._tmpdir, True)
if __name__ == "__main__":
test = TestLongPathInArchive()
try:
test.prepare_setup()
test.start_test()
except AssertionError, exp:
test.logger.debug("FAIL ] :: [ Assertion occurred {0}".format(exp))
except Exception, exp:
test.logger.debug("FAIL ] :: [ Exception occurred {0}".format(exp))
finally:
test.cleanup()

View File

@ -0,0 +1,140 @@
# Author: Josef Zila <jzila@redhat.com>
# Location: CoreOS/zip/Functionality/stress-tests/many-files-in-archive/runtest.sh
# Description: zip - Tests behaviour with many files in archive (1048578 files)
# Copyright (c) 2008 Red Hat, Inc. All rights reserved. This copyrighted material
# is made available to anyone wishing to use, modify, copy, or
# redistribute it subject to the terms and conditions of the GNU General
# Public License v.2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import sys
import uuid
sys.path.append("..")
from tests import BaseZipTests
from tests import decorated_message
PURPOSE = '''
Test Name:
Author: Josef Zila <jzila@redhat.com>
Location: CoreOS/zip/Functionality/stress-tests/many-files-in-archive/PURPOSE
Short Description:
Tests behaviour with many files in archive (1048577 files)
Long Description:
This test creates 1048576 empty files and one non-empty file. Then zips and unzips directory containing all those files and tests content of
non-empty file and count of unzipped files. This test is very time-consuming. Current version of zip on all archs and distros in time of writing
(2.31-1) passes test.
how to run it:
choose arch and distro
TEST UPDATED (esakaiev)
'''
class TestManyFilesInArchive(BaseZipTests):
"""
This class is used for providing functionality
for TestManyFilesInArchive test case
"""
def __init__(self):
self._purpose = PURPOSE
super(TestManyFilesInArchive, self).__init__()
self._tmpdir = "/tmp/{}".format(uuid.uuid4())
self._files_number = 1048576
self._package_ver = ""
self._package_release = ""
@decorated_message("Prepare setup")
def prepare_setup(self):
"""
:return:
"""
self.check_package()
self.run_cmd("mkdir {}".format(self._tmpdir), 0,
"Creating tmp directory {}".format(self._tmpdir))
self._package_ver = self.execute_cmd("rpm -q zip --queryformat %{version}")
self._package_release = self.execute_cmd("rpm -q zip --queryformat %{version}")
self.logger.debug("Running zip.{0}.{1} package".format(self._package_ver, self._package_release))
self.logger.debug("Creating {0} files".format(self._files_number))
[open("{0}/{1}".format(self._tmpdir, i), "w").close() for i in xrange(self._files_number)]
self.logger.debug("Creating test file")
with open("{0}/test.txt".format(self._tmpdir), "w") as fp:
fp.write("12345")
@decorated_message("Starting Test cases")
def start_test(self):
"""
:return:
"""
self.run_cmd("zip -r test {0} -q".format(self._tmpdir.split('/')[-1]), 0,
"Zipping test files",
cwd='/tmp')
self.remove_file(self._tmpdir, True)
self.run_cmd("unzip -qq test.zip", 0,
"Unzipping test files",
cwd='/tmp')
test_file_content = None
with open("{0}/test.txt".format(self._tmpdir)) as fp:
test_file_content = fp.read().replace('/n', '')
if test_file_content == "12345":
self.logger.debug("PASS ] :: [ {}".format("Unpacked content matches original"))
else:
self.logger.debug("FAIL ] :: [ {}".format("Unpacked content does not match original!"))
files_count = self.execute_cmd("ls {0} | wc -l".format(self._tmpdir)).replace("\n", "")
if files_count == str(self._files_number + 1):
self.logger.debug(
"PASS ] :: [ {}".format("All {0} files present after unpacking".format(self._files_number + 1)))
else:
self.logger.debug(r"FAIL ] :: [ File count changed after unpacking! \
Before zipping there was {0} files. \
After unzip there is {1} files.".format(self._files_number + 1, files_count))
@decorated_message("Cleaning up")
def cleanup(self):
"""
:return:
"""
self.remove_file(self._tmpdir, True)
self.remove_file("/tmp/test.zip")
if __name__ == "__main__":
test = TestManyFilesInArchive()
try:
test.prepare_setup()
test.start_test()
except AssertionError, exp:
test.logger.debug("FAIL ] :: [ Assertion occurred {0}".format(exp))
except Exception, exp:
test.logger.debug("FAIL ] :: [ Exception occurred {0}".format(exp))
finally:
test.cleanup()

106
tests/tests/test_umask.py Executable file
View File

@ -0,0 +1,106 @@
# Copyright (c) 2006 Red Hat, Inc. All rights reserved. This copyrighted material
# is made available to anyone wishing to use, modify, copy, or
# redistribute it subject to the terms and conditions of the GNU General
# Public License v.2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# Author: Radek Biba <rbiba@redhat.com>
import sys
import uuid
UMASK = "Running umask"
sys.path.append("..")
from tests import BaseZipTests
from tests import decorated_message
PURPOSE = '''
zip is supposed to honor umask settings when creating archives.
This test case just checks if it really does
TEST UPDATED (esakaiev)
'''
class TestUmask(BaseZipTests):
"""
This class is used for providing functionality
for TestUmask test case
"""
def __init__(self):
self._purpose = PURPOSE
super(TestUmask, self).__init__()
self._tmpdir = "/tmp/{}".format(uuid.uuid4())
self._mask_list = ["0", "2", "20", "22", "200", "202", "220", "222", "6", "60"]
self._package_ver = ""
self._package_release = ""
@decorated_message("Prepare setup")
def prepare_setup(self):
"""
:return:
"""
self.check_package()
self.run_cmd("mkdir {}".format(self._tmpdir), 0, "Creating tmp directory {}".format(self._tmpdir))
self._package_ver = self.execute_cmd("rpm -q zip --queryformat %{version}")
self._package_release = self.execute_cmd("rpm -q zip --queryformat %{version}")
self.logger.debug("Running zip.{0}.{1} package".format(self._package_ver, self._package_release))
# Trying to verify that zip honors umask. Trying with various combinations
# of 'w's and 'r's for User, Group, and Others.
@decorated_message("Starting Test cases")
def start_test(self):
"""
:return:
"""
for mask in self._mask_list:
self.logger.debug("Running umask and zipping file {0}".format(mask))
self.execute_cmd("umask {0}; touch {0}; zip -q {0}.zip {0}".format(mask), cwd=self._tmpdir)
stat_test_zip = self.execute_cmd("stat -c %a {0}.zip".format(mask), cwd=self._tmpdir).replace("\n", "")
stat_test = self.execute_cmd("stat -c %a {0}".format(mask), cwd=self._tmpdir).replace("\n", "")
print stat_test_zip, stat_test
if stat_test_zip == stat_test:
self.logger.debug(
"PASS ] :: [ permissions for {0}.zip match to {0}, {1} == {2}".format(mask, stat_test_zip,
stat_test))
else:
self.logger.debug(
"FAIL ] :: [ permissions for {0}.zip doesn't match to {0}, {1} != {2}".format(mask, stat_test_zip,
stat_test))
@decorated_message("Cleaning up")
def cleanup(self):
"""
:return:
"""
self.remove_file(self._tmpdir, True)
if __name__ == "__main__":
test = TestUmask()
try:
test.prepare_setup()
test.start_test()
except AssertionError, exp:
test.logger.debug("FAIL ] :: [ Assertion occurred {0}".format(exp))
except Exception, exp:
test.logger.debug("FAIL ] :: [ Exception occurred {0}".format(exp))
finally:
test.cleanup()

View File

@ -0,0 +1,105 @@
# Author: Josef Zila <jzila@redhat.com>
# Description: Zip did not honor umask setting when creating archives.
# Copyright (c) 2008 Red Hat, Inc. All rights reserved. This copyrighted material
# is made available to anyone wishing to use, modify, copy, or
# redistribute it subject to the terms and conditions of the GNU General
# Public License v.2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import sys
import uuid
UMASK = "Running umask"
sys.path.append("..")
from tests import BaseZipTests
from tests import decorated_message
PURPOSE = '''
Test Name: umask-when-creating
Author: Josef Zila <jzila@redhat.com>
Short Description:
zip does not honor umaks setting when creating archive
Long Description:
zip appears to have a built-in umask of 0022 regardless of the global umask.
With umask set to 0000, zip-2.3-27 creates zip files with permissions of
0644 instead of 0666. Previous versions created files with correct permissions.
TEST UPDATED (esakaiev)
'''
class TestUmaskWhenCreating(BaseZipTests):
"""
This class is used for providing functionality
for TestUmaskWhenCreating test case
"""
def __init__(self):
self._purpose = PURPOSE
super(TestUmaskWhenCreating, self).__init__()
self._tmpdir = "/tmp/{}".format(uuid.uuid4())
self._mask_list = ["777", "000", "027"]
self._expected_results = ["----------", "-rw-rw-rw-", "-rw-r-----"]
self._package_ver = ""
self._package_release = ""
@decorated_message("Prepare setup")
def prepare_setup(self):
self.check_package()
self.run_cmd("mkdir {}".format(self._tmpdir), 0, "Creating tmp directory {}".format(self._tmpdir))
self._package_ver = self.execute_cmd("rpm -q zip --queryformat %{version}")
self._package_release = self.execute_cmd("rpm -q zip --queryformat %{version}")
self.logger.debug("Running zip.{0}.{1} package".format(self._package_ver, self._package_release))
@decorated_message("Starting Test cases")
def start_test(self):
for i, mask in enumerate(self._mask_list):
self.logger.debug("Running umask and zipping file {0}".format(mask))
self.execute_cmd("umask -S {0} >> /dev/null; zip test /etc/services >> /dev/null".format(mask),
cwd=self._tmpdir)
result = self.execute_cmd("ls -l test.zip | cut -b 1-10", cwd=self._tmpdir).replace("\n", "")
if result == self._expected_results[i]:
self.logger.debug(
"PASS ] :: [ file permissions match to {0}".format(self._expected_results[i]))
else:
self.logger.debug(
"FAIL ] :: [ file permissions don't match to {0}".format(self._expected_results[i]))
self.remove_file(self._tmpdir + "/" + "test.zip")
@decorated_message("Cleaning up")
def cleanup(self):
self.remove_file(self._tmpdir, True)
if __name__ == "__main__":
test = TestUmaskWhenCreating()
try:
test.prepare_setup()
test.start_test()
except AssertionError, exp:
test.logger.debug("FAIL ] :: [ Assertion occurred {0}".format(exp))
except Exception, exp:
test.logger.debug("FAIL ] :: [ Exception occurred {0}".format(exp))
finally:
test.cleanup()

View File

@ -0,0 +1,105 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Description: zipnote fails to update the archive
# Author: Karel Volny <kvolny@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2015 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing
# to use, modify, copy, or redistribute it subject to the terms
# and conditions of the GNU General Public License version 2.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
import sys
import uuid
sys.path.append("..")
from tests import BaseZipTests
from tests import decorated_message
PURPOSE = '''
PURPOSE of zipnote-fails-to-update-the-archive
Description: zipnote fails to update the archive
Author: Karel Volny <kvolny@redhat.com>
TEST UPDATED (esakaiev)
'''
class TestZipnoteFailsToUpdateTheArchive(BaseZipTests):
"""
This class is used for providing functionality
for TestZipnoteFailsToUpdateTheArchive test case
"""
def __init__(self):
self._purpose = PURPOSE
super(TestZipnoteFailsToUpdateTheArchive, self).__init__()
self._tmpdir = '/tmp/tmp.{}'.format(uuid.uuid4())
@decorated_message("Preparing setup")
def prepare_setup(self):
"""
:return:
"""
self.check_package()
self.run_cmd("mkdir {}".format(self._tmpdir), 0, "Creating tmp directory {}".format(self._tmpdir))
@decorated_message("Starting Test")
def start_test(self):
"""
:return:
"""
self.run_cmd("touch file", 0, "Creating the Demo file", cwd=self._tmpdir)
self.run_cmd("zip archive.zip file", 0, "Creating the archive including the file", cwd=self._tmpdir)
self.run_cmd("zipnote archive.zip > info.txt", 0, "Reading the archive comments", cwd=self._tmpdir)
## bad - e.g. zip-3.0-1.el6.i686:
# zipnote error: Interrupted (aborting)
# Segmentation fault
## good: no output
self.run_cmd("zipnote -w archive.zip < info.txt > output_file.txt 2>&1", 0, "Writing comments to the archive",
cwd=self._tmpdir)
if 'error' in open(self._tmpdir + '/output_file.txt').read():
self.logger.debug("FAIL ] :: [ File shouldn't contain an error pattern")
else:
self.logger.debug("PASS ] :: [ File doesn't contain an error pattern")
@decorated_message("Cleaning up")
def cleanup(self):
"""
:return:
"""
self.run_cmd("rm -r {}".format(self._tmpdir), 0,
"Removing tmp directory")
if __name__ == "__main__":
test = TestZipnoteFailsToUpdateTheArchive()
try:
test.prepare_setup()
test.start_test()
except AssertionError, exp:
test.logger.debug("FAIL ] :: [ Assertion occurred {0}".format(exp))
except Exception, exp:
test.logger.debug("FAIL ] :: [ Exception occurred {0}".format(exp))
finally:
test.cleanup()

View File

@ -1,9 +1,8 @@
Summary: A file compression and packaging utility compatible with PKZIP
Name: zip
Version: 3.0
Release: 23%{?dist}
Release: 35%{?dist}
License: BSD
Group: Applications/Archiving
Source: http://downloads.sourceforge.net/infozip/zip30.tar.gz
URL: http://www.info-zip.org/Zip.html
@ -18,12 +17,10 @@ Patch4: man.patch
Patch5: zip-3.0-format-security.patch
Patch6: zipnote.patch
Patch7: zip-3.0-configure.patch
Patch8: zip-3.0-covscan1.patch
BuildRequires: bzip2-devel
BuildRequires: make
BuildRequires: bzip2-devel, gcc
Requires: unzip
%global _hardened_build 1
%description
The zip program is a compression and file packaging utility. Zip is
analogous to a combination of the UNIX tar and compress commands and
@ -41,11 +38,15 @@ program.
%patch4 -p1 -b .man
%patch5 -p1 -b .format-security
%patch6 -p1 -b .zipnote
%patch7 -p1 -b .zipconfigure
%patch8 -p1 -b .covscan1
%patch7 -p1
%build
make -f unix/Makefile generic_gcc refix=%{_prefix} LFLAGS2="$RPM_LD_FLAGS" CFLAGS_NOOPT="-I. -DUNIX $RPM_OPT_FLAGS" %{?_smp_mflags}
#Remove assembly file to force the c implementation of the crc functions
#Related to 3.0-33 and 3.0-34
rm crc_i386.S
rm match.S
make -f unix/Makefile prefix=%{_prefix} CFLAGS_NOOPT="-I. -DUNIX -DNO_ASM $RPM_OPT_FLAGS" LFLAGS2="%{?__global_ldflags}" generic_gcc %{?_smp_mflags}
%install
mkdir -p $RPM_BUILD_ROOT%{_bindir}
@ -68,16 +69,55 @@ make -f unix/Makefile prefix=$RPM_BUILD_ROOT%{_prefix} \
%{_mandir}/man1/zipsplit.1*
%changelog
* Tue Nov 13 2018 Jakub Martisko <jamartis@redhat.com> - 3.0-23
- Set the ziperr function as noreturn
- Fix email in the previous chnagelog entry
- Related: #1602741
* Tue Feb 14 2023 Jakub Martisko <jamartis@redhat.com> - 3.0-35
- Fix the annocheck issus from 3-0-33 without reintroducing the regression from 3.0-34
Related: rhbz#2162688
* Fri Oct 19 2018 Jakub Martisko <jamartis@redhat.com> - 3.0-22
- Add missing linker flags
- Port the configure patch from unzip that allows linker flags configuration
from the spec file
- Related: #1624188
* Tue Jan 31 2023 Jakub Martisko <jamartis@redhat.com> - 3.0-34
- Fix the regression introduced in 3.0-33 that caused some of the zip build flags to be dropped
Resolves: rhbz#2162688
* Tue Feb 15 2022 Jakub Martisko <jamartis@redhat.com> - 3.0-33
- Disable the asm implementation of some functions and use the C instead
- This should fix some of the annocheck issues
Related: rhbz#2044902
* Thu Feb 03 2022 Jakub Martisko <jamartis@redhat.com> - 3.0-32
- Enable gating tests
Related: rhbz#2049738
* Wed Feb 02 2022 Jakub Martisko <jamartis@redhat.com> - 3.0-31
- Add the missing linker flags
- Add the patch that allows to configure the linker flags from the spec file
Resolves: rhbz #2044902
* Tue Aug 10 2021 Mohan Boddu <mboddu@redhat.com> - 3.0-30
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 3.0-29
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Thu Jan 28 2021 Fedora Release Engineering <releng@fedoraproject.org> - 3.0-28
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.0-27
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Fri Jan 31 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.0-26
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Sat Jul 27 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.0-25
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Sun Feb 03 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.0-24
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.0-23
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Thu Mar 01 2018 Jakub Martisko <jamartis@redhat.com> - 3.0-22
- Add gcc to buildrequires
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.0-21
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild