Add gating tests
Resolves: rhbz#1986357
This commit is contained in:
parent
8461bb6f55
commit
ab0d495421
21
tests/gating/all.sh
Executable file
21
tests/gating/all.sh
Executable file
@ -0,0 +1,21 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
passed=0
|
||||||
|
subtests=(./gzip ./gunzip ./gzexe ./zcat ./zcmp ./zdiff ./zegrep ./zfgrep ./zforce ./zgrep ./zless ./zmore ./znew)
|
||||||
|
total=${#subtests[@]}
|
||||||
|
|
||||||
|
for subtest in ${subtests[@]}
|
||||||
|
do
|
||||||
|
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"
|
||||||
|
[[ $total == $passed ]] || exit 1
|
10
tests/gating/gunzip/test.sh
Executable file
10
tests/gating/gunzip/test.sh
Executable file
@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "Hello World!" > ./in
|
||||||
|
gzip -f -k ./in
|
||||||
|
gunzip -c ./in.gz > ./out
|
||||||
|
diff ./in ./out
|
||||||
|
result=$?
|
||||||
|
rm -f *.gz ./out ./in
|
||||||
|
exit $result
|
||||||
|
|
17
tests/gating/gzexe/test.sh
Executable file
17
tests/gating/gzexe/test.sh
Executable file
@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
|
||||||
|
cat <<EOF >./in
|
||||||
|
#!/bin/bash
|
||||||
|
echo "Hello World!"
|
||||||
|
EOF
|
||||||
|
chmod +x ./in
|
||||||
|
./in >./expected
|
||||||
|
|
||||||
|
gzexe ./in 2>/dev/null
|
||||||
|
/bin/bash ./in >./out
|
||||||
|
diff ./out ./expected
|
||||||
|
result=$?
|
||||||
|
rm -f ./in ./in~ ./out ./expected
|
||||||
|
exit $result
|
||||||
|
|
8
tests/gating/gzip/test.sh
Executable file
8
tests/gating/gzip/test.sh
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "Hello World!" > ./in
|
||||||
|
gzip -f -c ./in >/dev/null
|
||||||
|
result=$?
|
||||||
|
rm -f ./in *.gz
|
||||||
|
exit $result
|
||||||
|
|
14
tests/gating/zcat/test.sh
Executable file
14
tests/gating/zcat/test.sh
Executable file
@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "Hello" > ./in
|
||||||
|
echo "World!" > ./in2
|
||||||
|
echo "Hello" > ./exp
|
||||||
|
echo "World!" >> ./exp
|
||||||
|
gzip -f -k ./in
|
||||||
|
gzip -f -k ./in2
|
||||||
|
zcat ./in.gz ./in2.gz >out
|
||||||
|
diff ./exp ./out
|
||||||
|
result=$?
|
||||||
|
rm -f ./in ./in2 *.gz ./out ./exp
|
||||||
|
exit $result
|
||||||
|
|
9
tests/gating/zcmp/test.sh
Executable file
9
tests/gating/zcmp/test.sh
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "Hello World!" > ./in
|
||||||
|
gzip -f -k ./in
|
||||||
|
zcmp ./in ./in.gz
|
||||||
|
result=$?
|
||||||
|
rm -f *.gz ./out ./in
|
||||||
|
exit $result
|
||||||
|
|
9
tests/gating/zdiff/test.sh
Executable file
9
tests/gating/zdiff/test.sh
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "Hello World!" > ./in
|
||||||
|
gzip -f -k ./in
|
||||||
|
zdiff ./in ./in.gz
|
||||||
|
result=$?
|
||||||
|
rm -f *.gz ./out ./in
|
||||||
|
exit $result
|
||||||
|
|
9
tests/gating/zegrep/test.sh
Executable file
9
tests/gating/zegrep/test.sh
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "Hello World!" > ./in
|
||||||
|
gzip -f -k ./in
|
||||||
|
zegrep "ello" ./in.gz >/dev/null
|
||||||
|
result=$?
|
||||||
|
rm -f *.gz ./out ./in
|
||||||
|
exit $result
|
||||||
|
|
9
tests/gating/zfgrep/test.sh
Executable file
9
tests/gating/zfgrep/test.sh
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "Hello World!" > ./in
|
||||||
|
gzip -f -k ./in
|
||||||
|
zfgrep "ello" ./in.gz >/dev/null
|
||||||
|
result=$?
|
||||||
|
rm -f *.gz ./out ./in
|
||||||
|
exit $result
|
||||||
|
|
10
tests/gating/zforce/test.sh
Executable file
10
tests/gating/zforce/test.sh
Executable file
@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "Hello World!" > ./in
|
||||||
|
gzip -f -c ./in > ./out
|
||||||
|
zforce ./out > /dev/null
|
||||||
|
ls ./out.gz >/dev/null
|
||||||
|
result=$?
|
||||||
|
rm -f ./in *.gz
|
||||||
|
exit $result
|
||||||
|
|
9
tests/gating/zgrep/test.sh
Executable file
9
tests/gating/zgrep/test.sh
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "Hello World!" > ./in
|
||||||
|
gzip -f -k ./in
|
||||||
|
zgrep "ello" ./in.gz >/dev/null
|
||||||
|
result=$?
|
||||||
|
rm -f *.gz ./out ./in
|
||||||
|
exit $result
|
||||||
|
|
4
tests/gating/zless/test.sh
Executable file
4
tests/gating/zless/test.sh
Executable file
@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
zless --help >/dev/null
|
||||||
|
result=$?
|
||||||
|
exit $result
|
4
tests/gating/zmore/test.sh
Executable file
4
tests/gating/zmore/test.sh
Executable file
@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
zmore --help >/dev/null
|
||||||
|
result=$?
|
||||||
|
exit $result
|
4
tests/gating/znew/test.sh
Executable file
4
tests/gating/znew/test.sh
Executable file
@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
znew --help >/dev/null
|
||||||
|
result=$?
|
||||||
|
exit $result
|
15
tests/sanity.yml
Normal file
15
tests/sanity.yml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
- hosts: localhost
|
||||||
|
vars:
|
||||||
|
- artifacts: ./artifacts
|
||||||
|
remote_user: root
|
||||||
|
roles:
|
||||||
|
- role: standard-test-basic
|
||||||
|
tags:
|
||||||
|
- atomic
|
||||||
|
- classic
|
||||||
|
- container
|
||||||
|
tests:
|
||||||
|
- simple:
|
||||||
|
dir: gating
|
||||||
|
run: ./all.sh
|
@ -20,13 +20,13 @@
|
|||||||
with_items:
|
with_items:
|
||||||
- {file: test-simple, dest: test-simple }
|
- {file: test-simple, dest: test-simple }
|
||||||
|
|
||||||
- block:
|
- name: Execute the tests
|
||||||
- name: Execute the tests
|
block:
|
||||||
shell: exec > /tmp/test.log && /usr/local/bin/test-simple 2>&1
|
- shell: exec > /tmp/test.log && /usr/local/bin/test-simple 2>&1
|
||||||
|
|
||||||
- always:
|
always:
|
||||||
- name: Pull out the logs
|
- name: Pull out the logs
|
||||||
fetch:
|
fetch:
|
||||||
dest: "{{ artifacts }}/"
|
dest: "{{ artifacts }}/"
|
||||||
src: "/tmp/test.log"
|
src: "/tmp/test.log"
|
||||||
flat: yes
|
flat: true
|
||||||
|
@ -1 +1,3 @@
|
|||||||
- include: test_simple.yml
|
---
|
||||||
|
- import_playbook: test_simple.yml
|
||||||
|
- import_playbook: sanity.yml
|
||||||
|
Loading…
Reference in New Issue
Block a user