From c846b6d8444d15212e29784b6c21d228ed65f5a3 Mon Sep 17 00:00:00 2001 From: Debarshi Ray Date: Sun, 9 Jul 2023 11:38:50 +0200 Subject: [PATCH] test/system: Simplify the check for Fedora Rawhide First, it's not a good idea to use awk(1) as a grep(1) replacement. Unless one really needs the AWK programming language, it's better to stick to grep(1) because it's simpler. Secondly, it's better to look for a specific os-release(5) field instead of looking for the occurrence of 'rawhide' anywhere in the file, because it lowers the possibility of false positives. https://github.com/containers/toolbox/pull/1336 --- test/system/setup_suite.bash | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test/system/setup_suite.bash b/test/system/setup_suite.bash index a5c7da1..4df56ee 100644 --- a/test/system/setup_suite.bash +++ b/test/system/setup_suite.bash @@ -33,7 +33,6 @@ setup_suite() { return 1 fi - local os_release="$(find_os_release)" local system_id="$(get_system_id)" local system_version="$(get_system_version)" @@ -49,8 +48,7 @@ setup_suite() { _pull_and_cache_distro_image ubuntu 20.04 || false _pull_and_cache_distro_image busybox || false # If run on Fedora Rawhide, cache 2 extra images (previous Fedora versions) - local rawhide_res="$(awk '/rawhide/' $os_release)" - if [ "$system_id" = "fedora" ] && [ -n "$rawhide_res" ]; then + if is_fedora_rawhide; then _pull_and_cache_distro_image fedora "$((system_version-1))" || false _pull_and_cache_distro_image fedora "$((system_version-2))" || false fi