From 3e656e316380e487a59dd606b629a94ea8d39c1c Mon Sep 17 00:00:00 2001 From: Yan Vugenfirer Date: Sun, 9 Aug 2020 16:07:21 +0300 Subject: [PATCH] Add scripts that are comparing INF versions The comparison is between the versions that are present in signed drivers repository and should be present in signed_drivers_versions.txt file. The comparison is based on driver version in INF file. - Resolves: rhbz#1738372 Signed-off-by: Yan Vugenfirer --- tests/scripts/acceptance_freeze.sh | 4 --- tests/scripts/cleanup.sh | 2 ++ tests/scripts/compare_singed_versions.sh | 38 ++++++++++++++++++++++++ tests/scripts/mount_iso.sh | 8 +++++ tests/scripts/run_tests.sh | 4 --- tests/tests.yml | 7 ++++- 6 files changed, 54 insertions(+), 9 deletions(-) create mode 100755 tests/scripts/compare_singed_versions.sh create mode 100755 tests/scripts/mount_iso.sh delete mode 100755 tests/scripts/run_tests.sh diff --git a/tests/scripts/acceptance_freeze.sh b/tests/scripts/acceptance_freeze.sh index e380d37..6de85da 100755 --- a/tests/scripts/acceptance_freeze.sh +++ b/tests/scripts/acceptance_freeze.sh @@ -18,10 +18,6 @@ rpm2cpio $RPM_OLD | cpio -idmv mkdir mnt_iso_old mount ./usr/share/virtio-win/virtio-win.iso mnt_iso_old -o loop -# Mount current ISO -mkdir mnt_iso -mount /usr/share/virtio-win/virtio-win.iso mnt_iso -o loop - # Check unchanged files(winxp/win2k3/2k8) echo "begin to check if the files for winxp/2003 are unchanged" for i in `find mnt_iso -maxdepth 4 -mindepth 1 -type f | grep xp`;do diff $i ${i/mnt_iso/mnt_iso_old} >> freeze_results.txt; done diff --git a/tests/scripts/cleanup.sh b/tests/scripts/cleanup.sh index 73736c4..fc6bf0f 100755 --- a/tests/scripts/cleanup.sh +++ b/tests/scripts/cleanup.sh @@ -3,9 +3,11 @@ umount mnt_iso umount mnt_iso_old rm freeze_results.txt +rm compare_results.txt rm *.rpm rm -rf usr rmdir mnt_iso rmdir mnt_iso_old +rm -rf virtio-win-prewhql-* diff --git a/tests/scripts/compare_singed_versions.sh b/tests/scripts/compare_singed_versions.sh new file mode 100755 index 0000000..5ac661b --- /dev/null +++ b/tests/scripts/compare_singed_versions.sh @@ -0,0 +1,38 @@ +#!/bin/sh + +drivers=(viostor vioserial vioscsi viorng vioinput pvpanic NetKVM Balloon) +oses=(2k12 2k12R2 2k16 2k19 w10 w8.1 w8) +platfroms=(amd64 x86) +COMPARE_FILE=installed_signed_versions.txt +RESULT_FILE=compare_result.txt + +echo "Compare versions in INF files" + +rm $COMPARE_FILE +cd mnt_iso +for driver in ${drivers[@]}; do + cd $driver + for os in ${oses[@]}; do + for p in ${platfroms[@]}; do + if [ $os=="w8" ]; then + grep -Rr --include="*.inf" DriverVer | grep "$os" | grep "$p" | grep -v "w8.1" >> ../../$COMPARE_FILE + else + grep -Rr --include="*.inf" DriverVer | grep "$os" | grep "$p" >> ../../$COMPARE_FILE + fi + done + done + cd .. +done +cd .. + +diff signed_drivers_versions.txt $COMPARE_FILE > $RESULT_FILE + +if [ -s $RESULT_FILE ] +then + echo "Failure: versions of some of the drivers are different!" + cat $RESULT_FILE + exit 1 +else + echo "Success: INF versions are correct." + exit 0 +fi diff --git a/tests/scripts/mount_iso.sh b/tests/scripts/mount_iso.sh new file mode 100755 index 0000000..7394897 --- /dev/null +++ b/tests/scripts/mount_iso.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +echo "Mount installed virtio-win ISO" + +mkdir mnt_iso +mount /usr/share/virtio-win/virtio-win.iso mnt_iso -o loop + + diff --git a/tests/scripts/run_tests.sh b/tests/scripts/run_tests.sh deleted file mode 100755 index 739d6b2..0000000 --- a/tests/scripts/run_tests.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -echo "Testing gating, let's fail" -exit 1 diff --git a/tests/tests.yml b/tests/tests.yml index cc519e6..b4db42b 100644 --- a/tests/tests.yml +++ b/tests/tests.yml @@ -5,7 +5,12 @@ tags: - classic tests: + - mount_iso: + dir: scripts + run: ./mount_iso.sh - freeze_xp_test: dir: scripts run: ./acceptance_freeze.sh - + - compare_inf_versions: + dir: scripts + run: compare_singed_versions.sh