Skip to content

Commit c6dc300

Browse files
committed
Makefile: T8602: move validation if ISO exists into individual scripts
Sometimes I do call scripts/check-qemu-install directly without the Makefile wrapper, thus it should be ensured that the ISO image exists also from within the test-case launcher, too.
1 parent 28d7cef commit c6dc300

4 files changed

Lines changed: 24 additions & 24 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ packer_build/*
66
packer_cache/*
77
key/*
88
packages/*
9+
rootfs/*
910
!packages/*/
1011
/testinstall*.raw
1112
/testinstall*.efivars

Makefile

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,62 +12,54 @@ all:
1212
%:
1313
./build-vyos-image $*
1414

15-
.PHONY: checkiso
16-
.ONESHELL:
17-
checkiso:
18-
if [[ ! -f $(ISO_PATH) ]]; then
19-
echo "Could not find $(ISO_PATH)"
20-
exit 1
21-
fi
22-
2315
.PHONY: test
2416
.ONESHELL:
25-
test: checkiso
17+
test:
2618
scripts/check-qemu-install --debug --match="$(MATCH)" --smoketest --uefi --cpu 4 --memory 8 --iso $(ISO_PATH) $(filter-out $@,$(MAKECMDGOALS))
2719

2820
.PHONY: test-no-interfaces
2921
.ONESHELL:
30-
test-no-interfaces: checkiso
22+
test-no-interfaces:
3123
scripts/check-qemu-install --debug --smoketest --uefi --no-interfaces --cpu 4 --memory 8 --huge-page-size 2M --huge-page-count 1800 --isolate-cpus 2-3 --iso $(ISO_PATH) $(filter-out $@,$(MAKECMDGOALS))
3224

3325
.PHONY: test-no-interfaces-no-vpp
3426
.ONESHELL:
35-
test-no-interfaces-no-vpp: checkiso
27+
test-no-interfaces-no-vpp:
3628
scripts/check-qemu-install --debug --smoketest --uefi --no-interfaces --no-vpp --iso $(ISO_PATH) $(filter-out $@,$(MAKECMDGOALS))
3729

3830
.PHONY: test-interfaces
3931
.ONESHELL:
40-
test-interfaces: checkiso
32+
test-interfaces:
4133
scripts/check-qemu-install --debug --match="interfaces_" --smoketest --uefi --iso $(ISO_PATH) $(filter-out $@,$(MAKECMDGOALS))
4234

4335
.PHONY: test-vpp
4436
.ONESHELL:
45-
test-vpp: checkiso
37+
test-vpp:
4638
scripts/check-qemu-install --debug --match="vpp" --smoketest --uefi --cpu 4 --memory 8 --huge-page-size 2M --huge-page-count 1800 --isolate-cpus 2-3 --iso $(ISO_PATH) $(filter-out $@,$(MAKECMDGOALS))
4739

4840
.PHONY: testc
4941
.ONESHELL:
50-
testc: checkiso
42+
testc:
5143
scripts/check-qemu-install --debug --match="!vpp" --cpu 2 --memory 7 --configtest --iso $(ISO_PATH) $(filter-out $@,$(MAKECMDGOALS))
5244

5345
.PHONY: testcvpp
5446
.ONESHELL:
55-
testcvpp: checkiso
47+
testcvpp:
5648
scripts/check-qemu-install --debug --match="vpp" --cpu 4 --memory 8 --huge-page-size 2M --huge-page-count 1800 --isolate-cpus 2-3 --configtest --iso $(ISO_PATH) $(filter-out $@,$(MAKECMDGOALS))
5749

5850
.PHONY: testraid
5951
.ONESHELL:
60-
testraid: checkiso
52+
testraid:
6153
scripts/check-qemu-install --debug --raid --iso $(ISO_PATH) $(filter-out $@,$(MAKECMDGOALS))
6254

6355
.PHONY: testsb
6456
.ONESHELL:
65-
testsb: checkiso
57+
testsb:
6658
scripts/check-qemu-install --debug --uefi --sbtest --iso $(ISO_PATH) $(filter-out $@,$(MAKECMDGOALS))
6759

6860
.PHONY: testtpm
6961
.ONESHELL:
70-
testtpm: checkiso
62+
testtpm:
7163
scripts/check-qemu-install --debug --tpmtest --iso $(ISO_PATH) $(filter-out $@,$(MAKECMDGOALS))
7264

7365
.PHONY: test-ci-qcow2
@@ -82,13 +74,13 @@ test-ci-qcow2:
8274

8375
.PHONY: qemu-live
8476
.ONESHELL:
85-
qemu-live: checkiso
77+
qemu-live:
8678
scripts/check-qemu-install --qemu-cmd --iso $(ISO_PATH) $(filter-out $@,$(MAKECMDGOALS))
8779

8880
.PHONY: oci
8981
.ONESHELL:
90-
oci: checkiso
91-
scripts/iso-to-oci $(ISO_PATH)
82+
oci:
83+
@scripts/iso-to-oci $(ISO_PATH)
9284

9385
.PHONY: clean
9486
.ONESHELL:

scripts/check-qemu-install

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,8 +396,9 @@ if not args.disk:
396396
tmp_disk_random = "%04x" % random.randint(0,65535)
397397
args.disk = f'testinstall-{tmp_disk_time}-{tmp_disk_random}{DISK_IMAGE_EXTENSION}'
398398

399-
if not args.iso or not os.path.isfile(args.iso):
400-
log.debug('Unable to find ISO image to install ...')
399+
if args.iso and not os.path.isfile(args.iso):
400+
log.error('Unable to find VyOS ISO image needed by testcases!')
401+
sys.exit(1)
401402

402403
OVMF_CODE = '/usr/share/OVMF/OVMF_CODE_4M.secboot.fd'
403404
OVMF_VARS_TMP = args.disk.replace(DISK_IMAGE_EXTENSION, '.efivars')

scripts/iso-to-oci

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,23 @@ function cleanup() {
1111

1212
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
1313
echo "Not running as root"
14-
exit
14+
exit 1
1515
fi
1616

1717
if [ "$#" -ne 1 ]; then
1818
echo "Illegal number of parameters"
19+
exit 1
1920
fi
2021

2122
ISO=$1
2223
ROOTFS=rootfs
2324
UNSQUASHFS=unsquashfs
2425

26+
if [ ! -f "$ISO" ]; then
27+
echo "E: Unable to find VyOS ISO image \"$ISO\" required for conversion"
28+
exit 1
29+
fi
30+
2531
# ensure clean working directory
2632
cleanup
2733

0 commit comments

Comments
 (0)