Skip to content

Commit 1997a28

Browse files
committed
unify path for images
1 parent 8aeec46 commit 1997a28

File tree

6 files changed

+52
-78
lines changed

6 files changed

+52
-78
lines changed

.testinfo.tmt

Whitespace-only changes.

containers/runner/Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ RUN dnf -y update && \
2020
python3-rpmfluff \
2121
python3-rpm \
2222
squid \
23-
strace \
2423
make \
2524
openssh-clients && \
2625
dnf -y clean all

containers/runner/launch

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77

88
set -eu
99

10-
BASEDIR=$(dirname $(dirname $(dirname $(realpath $0))))
10+
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
11+
BASEDIR="$(dirname $(dirname $SCRIPT_DIR ))"
1112
CRUN=${CRUN:-$(which podman docker 2>/dev/null | head -n1)}
1213
CONTAINER=${CONTAINER:-quay.io/rhinstaller/kstest-runner}
1314
# Podman in rootless mode does not have access to /dev/kvm socket https://bugzilla.redhat.com/show_bug.cgi?id=1901462
@@ -16,6 +17,7 @@ PODMAN_SELINUX_FIX=
1617
RUN_COMMAND=/kickstart-tests/containers/runner/run-kstest
1718
SCENARIO=${SCENARIO:-unknown}
1819
BOOT_ISO="boot.iso"
20+
IMAGES_DIR=$BASEDIR/data/images
1921

2022
# Get number of jobs to be run in parallel based on number of CPUs and amount of RAM
2123
recommended_jobs() {
@@ -69,12 +71,13 @@ Options:
6971
--scenario NAME Name of the tests being run, used to group results in json
7072
logs.
7173
--dry-run Do not run the tests, only process kickstarts
74+
--data DIR Use DIR as the data directory for images and logs (default: BASEDIR/data)
7275
-h, --help Show this help
7376
EOF
7477
}
7578

7679
# parse options
77-
eval set -- "$(getopt -o j:p:t:s:u:rch --long jobs:,platform:,testtype:,skip-testtypes:,updates:,retry,connect-shell,daily-iso:,defaults:,run-args:,recommended-jobs,scenario:,timeout:,dry-run,help -- "$@")"
80+
eval set -- "$(getopt -o j:p:t:s:u:rch --long jobs:,platform:,testtype:,skip-testtypes:,updates:,retry,connect-shell,daily-iso:,defaults:,run-args:,recommended-jobs,scenario:,timeout:,dry-run,data:,help -- "$@")"
7881

7982
while true; do
8083
case "${1:-}" in
@@ -92,6 +95,7 @@ while true; do
9295
--timeout) shift; TIMEOUT="$1" ;;
9396
--scenario) shift; SCENARIO="$1" ;;
9497
--dry-run) DRY_RUN=1 ;;
98+
--data) shift; DATA_DIR="$1" ;;
9599
-h|--help) usage; exit 0 ;;
96100
--) shift; break ;;
97101
esac
@@ -108,27 +112,35 @@ else
108112
KSTESTS_TEST="$*"
109113
fi
110114

115+
116+
DATA_DIR="${DATA_DIR:-$BASEDIR/data}"
117+
IMAGES_DIR="$DATA_DIR/images"
118+
LOGS_DIR="$DATA_DIR/logs"
119+
120+
111121
# prepare data directory
112-
mkdir -p data/images
113-
mkdir -p -m 777 data/logs
114-
if ! [ -e "data/images/boot.iso" ]; then
122+
mkdir -p "$IMAGES_DIR"
123+
mkdir -p "$LOGS_DIR"
124+
chmod -R a+rwx "$LOGS_DIR" || true # ignore errors when running as non-root
125+
126+
if ! [ -e "$IMAGES_DIR/boot.iso" ]; then
115127
BOOT_ISO="boot-${PLATFORM}.iso"
116128
# do not download the ISO if it already exists
117-
if ! [ -e "data/images/boot-${PLATFORM}.iso" ]; then
129+
if ! [ -e "$IMAGES_DIR/boot-${PLATFORM}.iso" ]; then
118130
if [ -n "${DAILY_ISO_TOKEN:-}" ]; then
119-
echo "INFO: data/images/${BOOT_ISO} does not exist, downloading daily iso..."
120-
$PWD/containers/runner/fetch_daily_iso.sh ${DAILY_ISO_TOKEN} data/images/boot-${PLATFORM}.iso
131+
echo "INFO: $IMAGES_DIR/${BOOT_ISO} does not exist, downloading daily iso..."
132+
$BASEDIR/containers/runner/fetch_daily_iso.sh ${DAILY_ISO_TOKEN} $IMAGES_DIR/boot-${PLATFORM}.iso
121133
else
122-
echo "INFO: data/images/${BOOT_ISO} does not exist, downloading current ${PLATFORM} image..."
134+
echo "INFO: $IMAGES_DIR/${BOOT_ISO} does not exist, downloading current ${PLATFORM} image..."
123135
source scripts/defaults-${PLATFORM}.sh
124-
curl -L "${KSTEST_URL}/images/boot.iso" --output data/images/boot-${PLATFORM}.iso
136+
curl -L "${KSTEST_URL}/images/boot.iso" --output $IMAGES_DIR/boot-${PLATFORM}.iso
125137
fi
126-
echo "Using downloaded data/images/${BOOT_ISO}"
138+
echo "Using downloaded $IMAGES_DIR/${BOOT_ISO}"
127139
else
128-
echo "Using existing data/images/${BOOT_ISO}"
140+
echo "Using existing $IMAGES_DIR/${BOOT_ISO}"
129141
fi
130142
else
131-
echo "Using existing data/images/${BOOT_ISO}"
143+
echo "Using existing $IMAGES_DIR/${BOOT_ISO}"
132144
fi
133145

134146
# support both path and URL for --updates
@@ -182,6 +194,6 @@ $CRUN run -it --rm --device=/dev/kvm --publish 127.0.0.1::16509 $PODMAN_SELINUX_
182194
${TEST_ENV_VARS} \
183195
${VAR_TMP:-} \
184196
${DEFAULTS_SH_ARGS:-} \
185-
-v "$PWD/data:/opt/kstest/data:z" \
197+
-v "$DATA_DIR:/opt/kstest/data:z" \
186198
-v "$BASEDIR:/kickstart-tests:ro,z" \
187199
$CONTAINER $RUN_COMMAND

main.fmf

Lines changed: 16 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -335,14 +335,6 @@
335335
tag:
336336
- security
337337
test+: certificate.sh
338-
/check_for_disabled_modules:
339-
/x:
340-
/x:
341-
tag:
342-
- ui
343-
- anaconda
344-
- addons
345-
test+: check_for_disabled_modules.sh
346338
/clearpart:
347339
/1:
348340
/x:
@@ -611,15 +603,22 @@
611603
- firewall
612604
- coverage
613605
test+: firewall.sh
614-
/functions:
615-
/proxy:
616-
/x:
617-
tag: []
618-
test+: functions-proxy.sh
619-
/x:
606+
/flatpak:
607+
/preinstall:
608+
/ftp:
609+
tag:
610+
- packaging
611+
- payload
612+
- skip-on-fedora
613+
- skip-on-rhel-9
614+
test+: flatpak-preinstall-ftp.sh
620615
/x:
621-
tag: []
622-
test+: functions.sh
616+
tag:
617+
- packaging
618+
- payload
619+
- skip-on-fedora
620+
- skip-on-rhel-9
621+
test+: flatpak-preinstall.sh
623622
/geolocation:
624623
/off:
625624
/by-default-with-ks:
@@ -865,9 +864,6 @@
865864
tag:
866865
- logs
867866
test+: log-util-check.sh
868-
/tests:
869-
tag: []
870-
test+: log-util-tests.sh
871867
/lvm:
872868
/1:
873869
/x:
@@ -1392,34 +1388,12 @@
13921388
- partition
13931389
- luks
13941390
test+: part-luks-4.sh
1395-
/post:
1396-
/lib:
1397-
/keyboard:
1398-
tag: []
1399-
test+: post-lib-keyboard.sh
1400-
/network:
1401-
tag: []
1402-
test+: post-lib-network.sh
1403-
/nochroot:
1404-
/lib-keyboard:
1405-
tag: []
1406-
test+: post-nochroot-lib-keyboard.sh
1407-
/lib-network:
1408-
tag: []
1409-
test+: post-nochroot-lib-network.sh
1410-
/lib-ui:
1411-
tag: []
1412-
test+: post-nochroot-lib-ui.sh
14131391
/pre:
14141392
/install:
14151393
/x:
14161394
tag:
14171395
- kickstart
14181396
test+: pre-install.sh
1419-
/lib:
1420-
/harddrive:
1421-
tag: []
1422-
test+: pre-lib-harddrive.sh
14231397
/preexisting:
14241398
/btrfs:
14251399
/x:
@@ -1704,11 +1678,6 @@
17041678
tag:
17051679
- ksscript
17061680
test+: script-pre.sh
1707-
/scripts:
1708-
/lib:
1709-
/x:
1710-
tag: []
1711-
test+: scripts-lib.sh
17121681
/selinux:
17131682
/contexts:
17141683
/x:
@@ -1960,14 +1929,6 @@
19601929
tag:
19611930
- users
19621931
test+: user-wheel-no-root.sh
1963-
/validate:
1964-
/lib:
1965-
/initial-setup:
1966-
tag: []
1967-
test+: validate-lib-initial-setup.sh
1968-
/services:
1969-
tag: []
1970-
test+: validate-lib-services.sh
19711932
/vlan:
19721933
/httpks:
19731934
/x:
@@ -1980,4 +1941,4 @@
19801941
- network
19811942
test+: vlan-pre.sh
19821943
duration: 50m
1983-
test: 'mkdir -p data/{images,logs}; chmod -R a+rwx data; ./containers/runner/launch --platform rhel10 '
1944+
test: ./containers/runner/launch --data /var/tmp/ks_data --platform rhel10

plans/granular.fmf

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,24 @@ provision:
66
memory: '>= 8 GB'
77
how: connect
88
user: root
9-
guest: 10.0.185.156
10-
#key: /home/jscotka/git/cockpit-project/tests/cockpit-tests/.ssh/id_rsa
9+
guest: 10.0.186.80
1110
key: /usr/share/qa-tools/1minutetip/1minutetip-ecdsa
1211

1312
discover:
1413
- how: fmf
15-
filter: tag:keyboard
14+
filter: "tag: -knownfailure"
1615

1716
execute:
1817
how: tmt
1918

19+
2020
prepare:
2121
- how: install
2222
package:
2323
- podman
2424
- qemu-kvm
2525
- libvirt
2626
- git
27-
- how: shell
27+
# - how: shell
2828
# script:
29-
# - mkdir -p data/{images,logs}
30-
# - chmod -R a+rwx data
3129
# - curl --insecure -o ./data/images/boot-rhel10.iso http://ftp.sh.cvut.cz/centos-stream/10-stream/BaseOS/x86_64/iso/CentOS-Stream-10-20250707.0-x86_64-boot.iso

scripts/tmt_test_metadata_extractor.py

100644100755
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from subprocess import check_output
66
import yaml
77
from pprint import pprint
8+
import os
89

910
KSTESTDIR_ENV="KSTESTDIR"
1011
MAX_DEPTH = 2
@@ -13,7 +14,9 @@ class RawTMTMetadata:
1314
tmt_file = "main.fmf"
1415
tmt_tag = "tag"
1516
tmt_test = "test"
16-
tmt_test_prefix = "mkdir -p data/{images,logs}; chmod -R a+rwx data; ./containers/runner/launch --platform rhel10 "
17+
launch_data_var = "--data /var/tmp/ks_data"
18+
platform_var = "--platform rhel10"
19+
tmt_test_prefix = f"./containers/runner/launch {launch_data_var} {platform_var}"
1720
tmt_base_test_structure_list = ["tests"]
1821
tmt_stuff_item = ["x"]
1922

@@ -77,7 +80,8 @@ def go(self):
7780
self.store_tmt_file()
7881

7982
def list_files(path: str, pattern: str) -> list:
80-
return glob(f"{path}/{pattern}")
83+
files = glob(f"{path}/{pattern}")
84+
return [f for f in files if os.access(f, os.X_OK)]
8185

8286

8387

0 commit comments

Comments
 (0)