diff --git a/gating.yaml b/gating.yaml new file mode 100644 index 0000000..648918d --- /dev/null +++ b/gating.yaml @@ -0,0 +1,6 @@ +--- !Policy +product_versions: + - rhel-9 +decision_context: osci_compose_gate +rules: + - !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional} diff --git a/tests/gating/all.sh b/tests/gating/all.sh new file mode 100755 index 0000000..e5ddf2e --- /dev/null +++ b/tests/gating/all.sh @@ -0,0 +1,55 @@ +#!/bin/bash +# Copyright (C) 2019 Jakub Martisko + +# 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 diff --git a/tests/gating/basic/compress/test.sh b/tests/gating/basic/compress/test.sh new file mode 100755 index 0000000..a5fbb99 --- /dev/null +++ b/tests/gating/basic/compress/test.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Copyright (C) 2019 Jakub Martisko + +# 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 diff --git a/tests/gating/basic/decompress/test.sh b/tests/gating/basic/decompress/test.sh new file mode 100755 index 0000000..c14ec38 --- /dev/null +++ b/tests/gating/basic/decompress/test.sh @@ -0,0 +1,44 @@ +#!/bin/bash +# Copyright (C) 2019 Jakub Martisko + +# 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 diff --git a/tests/gating/unzip/copt/test.sh b/tests/gating/unzip/copt/test.sh new file mode 100755 index 0000000..1757005 --- /dev/null +++ b/tests/gating/unzip/copt/test.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# Copyright (C) 2019 Jakub Martisko + +# 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 diff --git a/tests/gating/unzip/envopts/test.sh b/tests/gating/unzip/envopts/test.sh new file mode 100755 index 0000000..b4e10f0 --- /dev/null +++ b/tests/gating/unzip/envopts/test.sh @@ -0,0 +1,43 @@ +#!/bin/bash +# Copyright (C) 2019 Jakub Martisko + +# 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 diff --git a/tests/gating/unzip/exdir/test.sh b/tests/gating/unzip/exdir/test.sh new file mode 100755 index 0000000..d33bbda --- /dev/null +++ b/tests/gating/unzip/exdir/test.sh @@ -0,0 +1,43 @@ +#!/bin/bash +# Copyright (C) 2019 Jakub Martisko + +# 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 diff --git a/tests/gating/unzip/files/test.sh b/tests/gating/unzip/files/test.sh new file mode 100755 index 0000000..6accf67 --- /dev/null +++ b/tests/gating/unzip/files/test.sh @@ -0,0 +1,44 @@ +#!/bin/bash +# Copyright (C) 2019 Jakub Martisko + +# 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 diff --git a/tests/gating/unzip/fopt/test.sh b/tests/gating/unzip/fopt/test.sh new file mode 100755 index 0000000..785ba5e --- /dev/null +++ b/tests/gating/unzip/fopt/test.sh @@ -0,0 +1,44 @@ +#!/bin/bash +# Copyright (C) 2019 Jakub Martisko + +# 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 diff --git a/tests/gating/unzip/jmod/test.sh b/tests/gating/unzip/jmod/test.sh new file mode 100755 index 0000000..4056cb3 --- /dev/null +++ b/tests/gating/unzip/jmod/test.sh @@ -0,0 +1,43 @@ +#!/bin/bash +# Copyright (C) 2019 Jakub Martisko + +# 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 diff --git a/tests/gating/unzip/nmod/test.sh b/tests/gating/unzip/nmod/test.sh new file mode 100755 index 0000000..f83b983 --- /dev/null +++ b/tests/gating/unzip/nmod/test.sh @@ -0,0 +1,43 @@ +#!/bin/bash +# Copyright (C) 2019 Jakub Martisko + +# 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 diff --git a/tests/gating/unzip/omod/test.sh b/tests/gating/unzip/omod/test.sh new file mode 100755 index 0000000..af80a22 --- /dev/null +++ b/tests/gating/unzip/omod/test.sh @@ -0,0 +1,43 @@ +#!/bin/bash +# Copyright (C) 2019 Jakub Martisko + +# 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 diff --git a/tests/gating/unzip/pmod/test.sh b/tests/gating/unzip/pmod/test.sh new file mode 100755 index 0000000..c7a4ab4 --- /dev/null +++ b/tests/gating/unzip/pmod/test.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# Copyright (C) 2019 Jakub Martisko + +# 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 diff --git a/tests/gating/unzip/popt/test.sh b/tests/gating/unzip/popt/test.sh new file mode 100755 index 0000000..3ac9d97 --- /dev/null +++ b/tests/gating/unzip/popt/test.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# Copyright (C) 2019 Jakub Martisko + +# 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 diff --git a/tests/gating/unzip/uopt/test.sh b/tests/gating/unzip/uopt/test.sh new file mode 100755 index 0000000..f14da2f --- /dev/null +++ b/tests/gating/unzip/uopt/test.sh @@ -0,0 +1,48 @@ +#!/bin/bash +# Copyright (C) 2019 Jakub Martisko + +# 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 diff --git a/tests/gating/unzip/xfiles/test.sh b/tests/gating/unzip/xfiles/test.sh new file mode 100755 index 0000000..a8b94d3 --- /dev/null +++ b/tests/gating/unzip/xfiles/test.sh @@ -0,0 +1,44 @@ +#!/bin/bash +# Copyright (C) 2019 Jakub Martisko + +# 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 diff --git a/tests/gating/zip/addfile/test.sh b/tests/gating/zip/addfile/test.sh new file mode 100755 index 0000000..3d319d0 --- /dev/null +++ b/tests/gating/zip/addfile/test.sh @@ -0,0 +1,48 @@ +#!/bin/bash +# Copyright (C) 2019 Jakub Martisko + +# 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 diff --git a/tests/gating/zip/copy/test.sh b/tests/gating/zip/copy/test.sh new file mode 100755 index 0000000..3bbd711 --- /dev/null +++ b/tests/gating/zip/copy/test.sh @@ -0,0 +1,45 @@ +#!/bin/bash +# Copyright (C) 2019 Jakub Martisko + +# 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 diff --git a/tests/gating/zip/delete/test.sh b/tests/gating/zip/delete/test.sh new file mode 100755 index 0000000..889b2a8 --- /dev/null +++ b/tests/gating/zip/delete/test.sh @@ -0,0 +1,49 @@ +#!/bin/bash +# Copyright (C) 2019 Jakub Martisko + +# 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 diff --git a/tests/gating/zip/envopts/test.sh b/tests/gating/zip/envopts/test.sh new file mode 100755 index 0000000..fc677df --- /dev/null +++ b/tests/gating/zip/envopts/test.sh @@ -0,0 +1,48 @@ +#!/bin/bash +# Copyright (C) 2019 Jakub Martisko + +# 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 diff --git a/tests/gating/zip/exclude/test.sh b/tests/gating/zip/exclude/test.sh new file mode 100755 index 0000000..845ceaf --- /dev/null +++ b/tests/gating/zip/exclude/test.sh @@ -0,0 +1,44 @@ +#!/bin/bash +# Copyright (C) 2019 Jakub Martisko + +# 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 diff --git a/tests/gating/zip/filelist/test.sh b/tests/gating/zip/filelist/test.sh new file mode 100755 index 0000000..c309789 --- /dev/null +++ b/tests/gating/zip/filelist/test.sh @@ -0,0 +1,53 @@ +#!/bin/bash +# Copyright (C) 2019 Jakub Martisko + +# 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 diff --git a/tests/gating/zip/freshen/test.sh b/tests/gating/zip/freshen/test.sh new file mode 100755 index 0000000..a14c82b --- /dev/null +++ b/tests/gating/zip/freshen/test.sh @@ -0,0 +1,53 @@ +#!/bin/bash +# Copyright (C) 2019 Jakub Martisko + +# 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 diff --git a/tests/gating/zip/include/test.sh b/tests/gating/zip/include/test.sh new file mode 100755 index 0000000..1f87941 --- /dev/null +++ b/tests/gating/zip/include/test.sh @@ -0,0 +1,46 @@ +#!/bin/bash +# Copyright (C) 2019 Jakub Martisko + +# 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 diff --git a/tests/gating/zip/junkpaths/test.sh b/tests/gating/zip/junkpaths/test.sh new file mode 100755 index 0000000..f8538ac --- /dev/null +++ b/tests/gating/zip/junkpaths/test.sh @@ -0,0 +1,44 @@ +#!/bin/bash +# Copyright (C) 2019 Jakub Martisko + +# 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 diff --git a/tests/gating/zip/largefiles/test.sh b/tests/gating/zip/largefiles/test.sh new file mode 100755 index 0000000..9be64de --- /dev/null +++ b/tests/gating/zip/largefiles/test.sh @@ -0,0 +1,44 @@ +#!/bin/bash +# Copyright (C) 2019 Jakub Martisko + +# 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 diff --git a/tests/gating/zip/move/test.sh b/tests/gating/zip/move/test.sh new file mode 100755 index 0000000..a6b9cf2 --- /dev/null +++ b/tests/gating/zip/move/test.sh @@ -0,0 +1,44 @@ +#!/bin/bash +# Copyright (C) 2019 Jakub Martisko + +# 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 diff --git a/tests/gating/zip/outpufile/test.sh b/tests/gating/zip/outpufile/test.sh new file mode 100755 index 0000000..2716a75 --- /dev/null +++ b/tests/gating/zip/outpufile/test.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# Copyright (C) 2019 Jakub Martisko + +# 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 diff --git a/tests/gating/zip/recursepaths/test.sh b/tests/gating/zip/recursepaths/test.sh new file mode 100755 index 0000000..28426a8 --- /dev/null +++ b/tests/gating/zip/recursepaths/test.sh @@ -0,0 +1,46 @@ +#!/bin/bash +# Copyright (C) 2019 Jakub Martisko + +# 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 diff --git a/tests/gating/zip/recursepatterns/test.sh b/tests/gating/zip/recursepatterns/test.sh new file mode 100755 index 0000000..ac3d3b6 --- /dev/null +++ b/tests/gating/zip/recursepatterns/test.sh @@ -0,0 +1,49 @@ +#!/bin/bash +# Copyright (C) 2019 Jakub Martisko + +# 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 diff --git a/tests/gating/zip/replacefile/test.sh b/tests/gating/zip/replacefile/test.sh new file mode 100755 index 0000000..b3e54c7 --- /dev/null +++ b/tests/gating/zip/replacefile/test.sh @@ -0,0 +1,45 @@ +#!/bin/bash +# Copyright (C) 2019 Jakub Martisko + +# 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 diff --git a/tests/gating/zip/speed/test.sh b/tests/gating/zip/speed/test.sh new file mode 100755 index 0000000..df5acb1 --- /dev/null +++ b/tests/gating/zip/speed/test.sh @@ -0,0 +1,50 @@ +#!/bin/bash +# Copyright (C) 2019 Jakub Martisko + +# 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 diff --git a/tests/gating/zip/split/test.sh b/tests/gating/zip/split/test.sh new file mode 100755 index 0000000..71516e8 --- /dev/null +++ b/tests/gating/zip/split/test.sh @@ -0,0 +1,54 @@ +#!/bin/bash +# Copyright (C) 2019 Jakub Martisko + +# 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 diff --git a/tests/gating/zip/stdin/test.sh b/tests/gating/zip/stdin/test.sh new file mode 100755 index 0000000..8a1f204 --- /dev/null +++ b/tests/gating/zip/stdin/test.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# Copyright (C) 2019 Jakub Martisko + +# 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 diff --git a/tests/gating/zip/symlinks/test.sh b/tests/gating/zip/symlinks/test.sh new file mode 100755 index 0000000..41a8447 --- /dev/null +++ b/tests/gating/zip/symlinks/test.sh @@ -0,0 +1,45 @@ +#!/bin/bash +# Copyright (C) 2019 Jakub Martisko + +# 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 diff --git a/tests/gating/zip/uopt/test.sh b/tests/gating/zip/uopt/test.sh new file mode 100755 index 0000000..3e4d56c --- /dev/null +++ b/tests/gating/zip/uopt/test.sh @@ -0,0 +1,53 @@ +#!/bin/bash +# Copyright (C) 2019 Jakub Martisko + +# 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 diff --git a/tests/tests.yml b/tests/tests.yml index 930837a..593d9b1 100644 --- a/tests/tests.yml +++ b/tests/tests.yml @@ -1,47 +1,19 @@ --- - hosts: localhost - tags: - - classic - - tasks: - - name: Define remote_artifacts if it is not already defined - set_fact: - artifacts: ${HOME}/artifacts - when: artifacts is not defined - - - name: Make artifacts directory - file: path={{ artifacts }} state=directory recurse=yes - - - block: - - name: Execute tests - shell: | - logfile={{ artifacts }}/test.{{ item }}.log - exec 2>>$logfile 1>>$logfile - cd tests - #make script executable - chmod 0775 {{ item }} - #execute the test - python2 {{ item }}.py - if [ $? -eq 0 ]; then - echo "PASS {{ item }}" >> {{ artifacts }}/test.log - else - echo "FAIL {{ item }}" >> {{ artifacts }}/test.log - fi - with_items: - - "test_4GBsegfault" - - "test_big_file_in_archive" - - "test_long_path_in_archive" - - "test_many_files_in_archive" - - "test_umask" - - "test_umask_when_creating" - - "test_zipnote_fails_to_update_the_archive" - - # Can't go in block. See - # https://github.com/ansible/ansible/issues/20736 - - name: Check the results - shell: grep "^FAIL" {{ artifacts }}/test.log - register: test_fails - failed_when: test_fails.stdout or test_fails.stderr - - - + 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 diff --git a/zip.spec b/zip.spec index 1dd2c29..8d6d362 100644 --- a/zip.spec +++ b/zip.spec @@ -1,7 +1,7 @@ Summary: A file compression and packaging utility compatible with PKZIP Name: zip Version: 3.0 -Release: 31%{?dist} +Release: 32%{?dist} License: BSD Source: http://downloads.sourceforge.net/infozip/zip30.tar.gz URL: http://www.info-zip.org/Zip.html @@ -64,6 +64,10 @@ make -f unix/Makefile prefix=$RPM_BUILD_ROOT%{_prefix} \ %{_mandir}/man1/zipsplit.1* %changelog +* Thu Feb 03 2022 Jakub Martisko - 3.0-32 +- Enable gating tests + Related: rhbz#2049738 + * Wed Feb 02 2022 Jakub Martisko - 3.0-31 - Add the missing linker flags - Add the patch that allows to configure the linker flags from the spec file