From 35e5f1aae8221ff7091548c81f92437b413562fe Mon Sep 17 00:00:00 2001 From: Kamil Dudka Date: Mon, 18 Oct 2021 15:00:48 +0200 Subject: [PATCH] Related: #1982198 - implement a gating test ... based on `fmf` and `tmt` --- .fmf/version | 1 + ci.fmf | 6 ++ gating.yaml | 6 ++ tests/tree-smoke/.gitignore | 2 + tests/tree-smoke/main.fmf | 7 ++ tests/tree-smoke/runtest.sh | 39 +++++++++ tests/tree-smoke/sync.sh | 10 +++ tests/tree-smoke/tree.exp | 163 ++++++++++++++++++++++++++++++++++++ tree-pkg.spec | 4 +- 9 files changed, 236 insertions(+), 2 deletions(-) create mode 100644 .fmf/version create mode 100644 ci.fmf create mode 100644 gating.yaml create mode 100644 tests/tree-smoke/.gitignore create mode 100644 tests/tree-smoke/main.fmf create mode 100755 tests/tree-smoke/runtest.sh create mode 100755 tests/tree-smoke/sync.sh create mode 100644 tests/tree-smoke/tree.exp diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/ci.fmf b/ci.fmf new file mode 100644 index 0000000..2bce34a --- /dev/null +++ b/ci.fmf @@ -0,0 +1,6 @@ +summary: + Run all tests +discover: + how: fmf +execute: + how: tmt 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/tree-smoke/.gitignore b/tests/tree-smoke/.gitignore new file mode 100644 index 0000000..9e17af3 --- /dev/null +++ b/tests/tree-smoke/.gitignore @@ -0,0 +1,2 @@ +/dir-tree +/tree.out diff --git a/tests/tree-smoke/main.fmf b/tests/tree-smoke/main.fmf new file mode 100644 index 0000000..9b32194 --- /dev/null +++ b/tests/tree-smoke/main.fmf @@ -0,0 +1,7 @@ +summary: Check whether `tree` works as expected. +test: ./runtest.sh +require: + - bash + - coreutils + - diffutils + - tree diff --git a/tests/tree-smoke/runtest.sh b/tests/tree-smoke/runtest.sh new file mode 100755 index 0000000..e3e8f19 --- /dev/null +++ b/tests/tree-smoke/runtest.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +# exit immediately if any command returns non-zero exit code +set -e + +# print commands as they are executed by the shell interpreter +set -x + +# set locale +export LANG=C +export LC_ALL=C +locale + +# print basic info about `tree` +rpm -q tree +command -v tree +tree --version +ldd /usr/bin/tree + +# create a testing directory tree +rm -rf dir-tree +mkdir dir-tree +( + set +x + cd dir-tree + for level in {1..16}; do + subdir=subdir-l${level} + touch {A,Z,a,z}-regular + ln -s a-regular symlink + ln -s $subdir dir-symlink + ln -s .. parent-dir-symlink + ln -s / root-dir-symlink + ln -s invalid danglging-symlink + mkdir -p $subdir + cd $subdir + done +) +tree dir-tree > tree.out +diff -u tree.{exp,out} diff --git a/tests/tree-smoke/sync.sh b/tests/tree-smoke/sync.sh new file mode 100755 index 0000000..464e643 --- /dev/null +++ b/tests/tree-smoke/sync.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +# print commands as they are executed by the shell interpreter +set -x + +# run the test +./runtest.sh + +# save current out put as the expected output +mv -v tree.{out,exp} diff --git a/tests/tree-smoke/tree.exp b/tests/tree-smoke/tree.exp new file mode 100644 index 0000000..69022e8 --- /dev/null +++ b/tests/tree-smoke/tree.exp @@ -0,0 +1,163 @@ +dir-tree +|-- A-regular +|-- Z-regular +|-- a-regular +|-- danglging-symlink -> invalid +|-- dir-symlink -> subdir-l1 +|-- parent-dir-symlink -> .. +|-- root-dir-symlink -> / +|-- subdir-l1 +| |-- A-regular +| |-- Z-regular +| |-- a-regular +| |-- danglging-symlink -> invalid +| |-- dir-symlink -> subdir-l2 +| |-- parent-dir-symlink -> .. +| |-- root-dir-symlink -> / +| |-- subdir-l2 +| | |-- A-regular +| | |-- Z-regular +| | |-- a-regular +| | |-- danglging-symlink -> invalid +| | |-- dir-symlink -> subdir-l3 +| | |-- parent-dir-symlink -> .. +| | |-- root-dir-symlink -> / +| | |-- subdir-l3 +| | | |-- A-regular +| | | |-- Z-regular +| | | |-- a-regular +| | | |-- danglging-symlink -> invalid +| | | |-- dir-symlink -> subdir-l4 +| | | |-- parent-dir-symlink -> .. +| | | |-- root-dir-symlink -> / +| | | |-- subdir-l4 +| | | | |-- A-regular +| | | | |-- Z-regular +| | | | |-- a-regular +| | | | |-- danglging-symlink -> invalid +| | | | |-- dir-symlink -> subdir-l5 +| | | | |-- parent-dir-symlink -> .. +| | | | |-- root-dir-symlink -> / +| | | | |-- subdir-l5 +| | | | | |-- A-regular +| | | | | |-- Z-regular +| | | | | |-- a-regular +| | | | | |-- danglging-symlink -> invalid +| | | | | |-- dir-symlink -> subdir-l6 +| | | | | |-- parent-dir-symlink -> .. +| | | | | |-- root-dir-symlink -> / +| | | | | |-- subdir-l6 +| | | | | | |-- A-regular +| | | | | | |-- Z-regular +| | | | | | |-- a-regular +| | | | | | |-- danglging-symlink -> invalid +| | | | | | |-- dir-symlink -> subdir-l7 +| | | | | | |-- parent-dir-symlink -> .. +| | | | | | |-- root-dir-symlink -> / +| | | | | | |-- subdir-l7 +| | | | | | | |-- A-regular +| | | | | | | |-- Z-regular +| | | | | | | |-- a-regular +| | | | | | | |-- danglging-symlink -> invalid +| | | | | | | |-- dir-symlink -> subdir-l8 +| | | | | | | |-- parent-dir-symlink -> .. +| | | | | | | |-- root-dir-symlink -> / +| | | | | | | |-- subdir-l8 +| | | | | | | | |-- A-regular +| | | | | | | | |-- Z-regular +| | | | | | | | |-- a-regular +| | | | | | | | |-- danglging-symlink -> invalid +| | | | | | | | |-- dir-symlink -> subdir-l9 +| | | | | | | | |-- parent-dir-symlink -> .. +| | | | | | | | |-- root-dir-symlink -> / +| | | | | | | | |-- subdir-l9 +| | | | | | | | | |-- A-regular +| | | | | | | | | |-- Z-regular +| | | | | | | | | |-- a-regular +| | | | | | | | | |-- danglging-symlink -> invalid +| | | | | | | | | |-- dir-symlink -> subdir-l10 +| | | | | | | | | |-- parent-dir-symlink -> .. +| | | | | | | | | |-- root-dir-symlink -> / +| | | | | | | | | |-- subdir-l10 +| | | | | | | | | | |-- A-regular +| | | | | | | | | | |-- Z-regular +| | | | | | | | | | |-- a-regular +| | | | | | | | | | |-- danglging-symlink -> invalid +| | | | | | | | | | |-- dir-symlink -> subdir-l11 +| | | | | | | | | | |-- parent-dir-symlink -> .. +| | | | | | | | | | |-- root-dir-symlink -> / +| | | | | | | | | | |-- subdir-l11 +| | | | | | | | | | | |-- A-regular +| | | | | | | | | | | |-- Z-regular +| | | | | | | | | | | |-- a-regular +| | | | | | | | | | | |-- danglging-symlink -> invalid +| | | | | | | | | | | |-- dir-symlink -> subdir-l12 +| | | | | | | | | | | |-- parent-dir-symlink -> .. +| | | | | | | | | | | |-- root-dir-symlink -> / +| | | | | | | | | | | |-- subdir-l12 +| | | | | | | | | | | | |-- A-regular +| | | | | | | | | | | | |-- Z-regular +| | | | | | | | | | | | |-- a-regular +| | | | | | | | | | | | |-- danglging-symlink -> invalid +| | | | | | | | | | | | |-- dir-symlink -> subdir-l13 +| | | | | | | | | | | | |-- parent-dir-symlink -> .. +| | | | | | | | | | | | |-- root-dir-symlink -> / +| | | | | | | | | | | | |-- subdir-l13 +| | | | | | | | | | | | | |-- A-regular +| | | | | | | | | | | | | |-- Z-regular +| | | | | | | | | | | | | |-- a-regular +| | | | | | | | | | | | | |-- danglging-symlink -> invalid +| | | | | | | | | | | | | |-- dir-symlink -> subdir-l14 +| | | | | | | | | | | | | |-- parent-dir-symlink -> .. +| | | | | | | | | | | | | |-- root-dir-symlink -> / +| | | | | | | | | | | | | |-- subdir-l14 +| | | | | | | | | | | | | | |-- A-regular +| | | | | | | | | | | | | | |-- Z-regular +| | | | | | | | | | | | | | |-- a-regular +| | | | | | | | | | | | | | |-- danglging-symlink -> invalid +| | | | | | | | | | | | | | |-- dir-symlink -> subdir-l15 +| | | | | | | | | | | | | | |-- parent-dir-symlink -> .. +| | | | | | | | | | | | | | |-- root-dir-symlink -> / +| | | | | | | | | | | | | | |-- subdir-l15 +| | | | | | | | | | | | | | | |-- A-regular +| | | | | | | | | | | | | | | |-- Z-regular +| | | | | | | | | | | | | | | |-- a-regular +| | | | | | | | | | | | | | | |-- danglging-symlink -> invalid +| | | | | | | | | | | | | | | |-- dir-symlink -> subdir-l16 +| | | | | | | | | | | | | | | |-- parent-dir-symlink -> .. +| | | | | | | | | | | | | | | |-- root-dir-symlink -> / +| | | | | | | | | | | | | | | |-- subdir-l16 +| | | | | | | | | | | | | | | |-- symlink -> a-regular +| | | | | | | | | | | | | | | `-- z-regular +| | | | | | | | | | | | | | |-- symlink -> a-regular +| | | | | | | | | | | | | | `-- z-regular +| | | | | | | | | | | | | |-- symlink -> a-regular +| | | | | | | | | | | | | `-- z-regular +| | | | | | | | | | | | |-- symlink -> a-regular +| | | | | | | | | | | | `-- z-regular +| | | | | | | | | | | |-- symlink -> a-regular +| | | | | | | | | | | `-- z-regular +| | | | | | | | | | |-- symlink -> a-regular +| | | | | | | | | | `-- z-regular +| | | | | | | | | |-- symlink -> a-regular +| | | | | | | | | `-- z-regular +| | | | | | | | |-- symlink -> a-regular +| | | | | | | | `-- z-regular +| | | | | | | |-- symlink -> a-regular +| | | | | | | `-- z-regular +| | | | | | |-- symlink -> a-regular +| | | | | | `-- z-regular +| | | | | |-- symlink -> a-regular +| | | | | `-- z-regular +| | | | |-- symlink -> a-regular +| | | | `-- z-regular +| | | |-- symlink -> a-regular +| | | `-- z-regular +| | |-- symlink -> a-regular +| | `-- z-regular +| |-- symlink -> a-regular +| `-- z-regular +|-- symlink -> a-regular +`-- z-regular + +64 directories, 96 files diff --git a/tree-pkg.spec b/tree-pkg.spec index fbb488a..70f5c1d 100644 --- a/tree-pkg.spec +++ b/tree-pkg.spec @@ -1,7 +1,7 @@ Summary: File system tree viewer Name: tree-pkg Version: 1.8.0 -Release: 9%{?dist} +Release: 10%{?dist} # The entire source code is GPLv2+ except strverscmp.c which is LGPLv2+ License: GPLv2+ and LGPLv2+ @@ -74,7 +74,7 @@ chmod -x $RPM_BUILD_ROOT%{_mandir}/man1/tree.1 %doc README %changelog -* Fri Sep 17 2021 Kamil Dudka - 1.8.0-9 +* Fri Sep 17 2021 Kamil Dudka - 1.8.0-10 - reflect review comments from Fedora Review (#2001467) * Fri Sep 03 2021 Kamil Dudka - 1.8.0-8