From: bluhm Date: Tue, 25 Sep 2018 12:15:49 +0000 (+0000) Subject: disklabel(8) uses hw.physmem to calculate swap and /var sizes. This X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=74fe0421c22907f7817ff13d5bea5c2f45367511;p=openbsd disklabel(8) uses hw.physmem to calculate swap and /var sizes. This prevents reproduceable regression tests. Recompile the disklabel with a fixed memory size for this test. Also adjust expected output for recent /usr/obj and /usr/local size changes. discussed with krw@ --- diff --git a/regress/sbin/disklabel/Makefile b/regress/sbin/disklabel/Makefile index cea3d49be60..aa827428428 100644 --- a/regress/sbin/disklabel/Makefile +++ b/regress/sbin/disklabel/Makefile @@ -1,12 +1,30 @@ -# $OpenBSD: Makefile,v 1.1 2018/09/19 12:20:47 krw Exp $ +# $OpenBSD: Makefile,v 1.2 2018/09/25 12:15:49 bluhm Exp $ # # Regress tests for disklabel REGRESS_TARGETS = run-regress-disklabel-A -CLEANFILES += disklabel-A-output disklabel-A-f image +CLEANFILES += disklabel-A-output disklabel-A-f image disklabel.c manual.c -run-regress-disklabel-A: +.PATH: ${.CURDIR}/../../../sbin/disklabel +PROG = disklabel +SRCS = disklabel.c dkcksum.c editor.c manual.c +CPPFLAGS = -I ${.CURDIR}/../../../sbin/disklabel +LDADD = -lutil + +# The disk layout depends on physical ram. Fake it to a fixed value. +# Recompile disklabel program. +disklabel.c: ../../../sbin/disklabel/disklabel.c Makefile + sed '/^getphysmem/,/^}/s/^[ ].*/ physmem = 16844521472ULL;/' \ + ${.CURDIR}/../../../sbin/disklabel/disklabel.c >$@.tmp + mv $@.tmp $@ + +manual.c: + (echo 'const unsigned char manpage[] = {'; \ + echo 'no manual' | gzip -9c | hexdump -ve '"0x" 1/1 "%02x,"'; \ + echo '};'; echo 'const int manpage_sz = sizeof(manpage);') > manual.c + +run-regress-disklabel-A: disklabel ${SUDO} sh ${.CURDIR}/disklabel-A diff -up ${.CURDIR}/disklabel-A-expected disklabel-A-output diff --git a/regress/sbin/disklabel/disklabel-A b/regress/sbin/disklabel/disklabel-A index 1e065ffc42e..7831cda3cfb 100644 --- a/regress/sbin/disklabel/disklabel-A +++ b/regress/sbin/disklabel/disklabel-A @@ -49,9 +49,9 @@ for i in $D; do vnconfig vnd0 image fdisk -iy vnd0 echo - (disklabel -A -p g vnd0; \ - disklabel -Aw -f disklabel-A-f vnd0; \ - disklabel vnd0) | grep '^ [a-p]: ' | egrep -v "unused" | sort + (./disklabel -A -p g vnd0; \ + ./disklabel -Aw -f disklabel-A-f vnd0; \ + ./disklabel vnd0) | grep '^ [a-p]: ' | egrep -v "unused" | sort echo cat disklabel-A-f echo "===== End ${i}MB disk =====" diff --git a/regress/sbin/disklabel/disklabel-A-expected b/regress/sbin/disklabel/disklabel-A-expected index 81be06d5f72..7b3b124d045 100644 --- a/regress/sbin/disklabel/disklabel-A-expected +++ b/regress/sbin/disklabel/disklabel-A-expected @@ -1,26 +1,26 @@ ===== Start 18000MB disk ===== Writing MBR at offset 0. - a: 0.6G 128 4.2BSD 2048 16384 1 # / - a: 1317568 128 4.2BSD 2048 16384 1 - b: 1.0G 1317696 swap - b: 2184580 1317696 swap - d: 0.9G 3502304 4.2BSD 2048 16384 1 # /tmp - d: 1862304 3502304 4.2BSD 2048 16384 1 - e: 1.3G 5364608 4.2BSD 2048 16384 1 # /var - e: 2790784 5364608 4.2BSD 2048 16384 1 - f: 1.4G 8155392 4.2BSD 2048 16384 1 # /usr - f: 2853568 8155392 4.2BSD 2048 16384 1 - g: 0.7G 11008960 4.2BSD 2048 16384 1 # /usr/X11R6 - g: 1392640 11008960 4.2BSD 2048 16384 1 - h: 2.4G 12401600 4.2BSD 2048 16384 1 # /usr/local - h: 5128256 12401600 4.2BSD 2048 16384 1 - i: 1.5G 17529856 4.2BSD 2048 16384 1 # /usr/src - i: 3066528 17529856 4.2BSD 2048 16384 1 - j: 3.4G 20596384 4.2BSD 2048 16384 1 # /usr/obj - j: 7099744 20596384 4.2BSD 2048 16384 1 - k: 4.4G 27696128 4.2BSD 2048 16384 1 # /home - k: 9169856 27696128 4.2BSD 2048 16384 1 + a: 0.5G 128 4.2BSD 2048 16384 1 # / + a: 1107840 128 4.2BSD 2048 16384 1 + b: 0.8G 1107968 swap + b: 1765150 1107968 swap + d: 0.7G 2873120 4.2BSD 2048 16384 1 # /tmp + d: 1526784 2873120 4.2BSD 2048 16384 1 + e: 1.1G 4399904 4.2BSD 2048 16384 1 # /var + e: 2245536 4399904 4.2BSD 2048 16384 1 + f: 1.3G 6645440 4.2BSD 2048 16384 1 # /usr + f: 2643840 6645440 4.2BSD 2048 16384 1 + g: 0.6G 9289280 4.2BSD 2048 16384 1 # /usr/X11R6 + g: 1266816 9289280 4.2BSD 2048 16384 1 + h: 2.1G 10556096 4.2BSD 2048 16384 1 # /usr/local + h: 4499104 10556096 4.2BSD 2048 16384 1 + i: 1.4G 15055200 4.2BSD 2048 16384 1 # /usr/src + i: 2982656 15055200 4.2BSD 2048 16384 1 + j: 5.3G 18037856 4.2BSD 2048 16384 1 # /usr/obj + j: 11126272 18037856 4.2BSD 2048 16384 1 + k: 3.7G 29164128 4.2BSD 2048 16384 1 # /home + k: 7701856 29164128 4.2BSD 2048 16384 1 /dev/vnd0a / ffs rw 1 1 /dev/vnd0k /home ffs rw 1 2 @@ -283,36 +283,18 @@ Writing MBR at offset 0. ===== Start 9000MB disk ===== Writing MBR at offset 0. - a: 0.2G 128 4.2BSD 2048 16384 1 # / - a: 395968 128 4.2BSD 2048 16384 1 - b: 0.2G 396096 swap - b: 341380 396096 swap - d: 0.2G 737504 4.2BSD 2048 16384 1 # /tmp - d: 387744 737504 4.2BSD 2048 16384 1 - e: 0.2G 1125248 4.2BSD 2048 16384 1 # /var - e: 394624 1125248 4.2BSD 2048 16384 1 - f: 0.9G 1519872 4.2BSD 2048 16384 1 # /usr - f: 1931968 1519872 4.2BSD 2048 16384 1 - g: 0.4G 3451840 4.2BSD 2048 16384 1 # /usr/X11R6 - g: 839680 3451840 4.2BSD 2048 16384 1 - h: 1.1G 4291520 4.2BSD 2048 16384 1 # /usr/local - h: 2363456 4291520 4.2BSD 2048 16384 1 - i: 1.3G 6654976 4.2BSD 2048 16384 1 # /usr/src - i: 2697888 6654976 4.2BSD 2048 16384 1 - j: 3.0G 9352864 4.2BSD 2048 16384 1 # /usr/obj - j: 6362464 9352864 4.2BSD 2048 16384 1 - k: 1.3G 15715328 4.2BSD 2048 16384 1 # /home - k: 2718656 15715328 4.2BSD 2048 16384 1 + a: 1.1G 128 4.2BSD 2048 16384 1 # / + a: 2351584 128 4.2BSD 2048 16384 1 + b: 0.2G 2351712 swap + b: 524288 2351712 swap + d: 3.0G 2876000 4.2BSD 2048 16384 1 # /usr + d: 6291456 2876000 4.2BSD 2048 16384 1 + e: 2.0G 9167456 4.2BSD 2048 16384 1 # /home + e: 4194304 9167456 4.2BSD 2048 16384 1 /dev/vnd0a / ffs rw 1 1 -/dev/vnd0k /home ffs rw 1 2 -/dev/vnd0d /tmp ffs rw 1 2 -/dev/vnd0f /usr ffs rw 1 2 -/dev/vnd0g /usr/X11R6 ffs rw 1 2 -/dev/vnd0h /usr/local ffs rw 1 2 -/dev/vnd0j /usr/obj ffs rw 1 2 -/dev/vnd0i /usr/src ffs rw 1 2 -/dev/vnd0e /var ffs rw 1 2 +/dev/vnd0e /home ffs rw 1 2 +/dev/vnd0d /usr ffs rw 1 2 /dev/vnd0b none swap sw ===== End 9000MB disk ===== @@ -321,24 +303,24 @@ Writing MBR at offset 0. a: 1.0G 128 4.2BSD 2048 16384 1 # / a: 2097152 128 4.2BSD 2048 16384 1 - b: 8.1G 2097280 swap - b: 16930180 2097280 swap - d: 4.0G 19027488 4.2BSD 2048 16384 1 # /tmp - d: 8388576 19027488 4.2BSD 2048 16384 1 - e: 10.5G 27416064 4.2BSD 2048 16384 1 # /var - e: 21960064 27416064 4.2BSD 2048 16384 1 - f: 2.0G 49376128 4.2BSD 2048 16384 1 # /usr - f: 4194304 49376128 4.2BSD 2048 16384 1 - g: 1.0G 53570432 4.2BSD 2048 16384 1 # /usr/X11R6 - g: 2097152 53570432 4.2BSD 2048 16384 1 - h: 10.0G 55667584 4.2BSD 2048 16384 1 # /usr/local - h: 20971520 55667584 4.2BSD 2048 16384 1 - i: 2.0G 76639104 4.2BSD 2048 16384 1 # /usr/src - i: 4194304 76639104 4.2BSD 2048 16384 1 - j: 6.0G 80833408 4.2BSD 2048 16384 1 # /usr/obj - j: 12582912 80833408 4.2BSD 2048 16384 1 - k: 43.3G 93416320 4.2BSD 2048 16384 1 # /home - k: 90905664 93416320 4.2BSD 2048 16384 1 + b: 7.9G 2097280 swap + b: 16510750 2097280 swap + d: 4.0G 18608032 4.2BSD 2048 16384 1 # /tmp + d: 8388576 18608032 4.2BSD 2048 16384 1 + e: 10.2G 26996608 4.2BSD 2048 16384 1 # /var + e: 21414816 26996608 4.2BSD 2048 16384 1 + f: 2.0G 48411424 4.2BSD 2048 16384 1 # /usr + f: 4194304 48411424 4.2BSD 2048 16384 1 + g: 1.0G 52605728 4.2BSD 2048 16384 1 # /usr/X11R6 + g: 2097152 52605728 4.2BSD 2048 16384 1 + h: 10.0G 54702880 4.2BSD 2048 16384 1 # /usr/local + h: 20971520 54702880 4.2BSD 2048 16384 1 + i: 2.0G 75674400 4.2BSD 2048 16384 1 # /usr/src + i: 4194304 75674400 4.2BSD 2048 16384 1 + j: 6.0G 79868704 4.2BSD 2048 16384 1 # /usr/obj + j: 12582912 79868704 4.2BSD 2048 16384 1 + k: 43.8G 92451616 4.2BSD 2048 16384 1 # /home + k: 91870368 92451616 4.2BSD 2048 16384 1 /dev/vnd0a / ffs rw 1 1 /dev/vnd0k /home ffs rw 1 2 @@ -355,26 +337,26 @@ Writing MBR at offset 0. ===== Start 12000MB disk ===== Writing MBR at offset 0. - a: 0.3G 128 4.2BSD 2048 16384 1 # / - a: 703168 128 4.2BSD 2048 16384 1 - b: 0.5G 703296 swap - b: 955780 703296 swap - d: 0.4G 1659104 4.2BSD 2048 16384 1 # /tmp - d: 879264 1659104 4.2BSD 2048 16384 1 - e: 0.6G 2538368 4.2BSD 2048 16384 1 # /var - e: 1193344 2538368 4.2BSD 2048 16384 1 - f: 1.1G 3731712 4.2BSD 2048 16384 1 # /usr - f: 2239168 3731712 4.2BSD 2048 16384 1 - g: 0.5G 5970880 4.2BSD 2048 16384 1 # /usr/X11R6 - g: 1024000 5970880 4.2BSD 2048 16384 1 - h: 1.6G 6994880 4.2BSD 2048 16384 1 # /usr/local - h: 3285056 6994880 4.2BSD 2048 16384 1 - i: 1.3G 10279936 4.2BSD 2048 16384 1 # /usr/src - i: 2820768 10279936 4.2BSD 2048 16384 1 - j: 3.2G 13100704 4.2BSD 2048 16384 1 # /usr/obj - j: 6608224 13100704 4.2BSD 2048 16384 1 - k: 2.3G 19708928 4.2BSD 2048 16384 1 # /home - k: 4869056 19708928 4.2BSD 2048 16384 1 + a: 0.2G 128 4.2BSD 2048 16384 1 # / + a: 493440 128 4.2BSD 2048 16384 1 + b: 0.3G 493568 swap + b: 536350 493568 swap + d: 0.3G 1029920 4.2BSD 2048 16384 1 # /tmp + d: 543744 1029920 4.2BSD 2048 16384 1 + e: 0.3G 1573664 4.2BSD 2048 16384 1 # /var + e: 648096 1573664 4.2BSD 2048 16384 1 + f: 1.0G 2221760 4.2BSD 2048 16384 1 # /usr + f: 2029440 2221760 4.2BSD 2048 16384 1 + g: 0.4G 4251200 4.2BSD 2048 16384 1 # /usr/X11R6 + g: 898176 4251200 4.2BSD 2048 16384 1 + h: 1.3G 5149376 4.2BSD 2048 16384 1 # /usr/local + h: 2655904 5149376 4.2BSD 2048 16384 1 + i: 1.3G 7805280 4.2BSD 2048 16384 1 # /usr/src + i: 2736896 7805280 4.2BSD 2048 16384 1 + j: 5.1G 10542176 4.2BSD 2048 16384 1 # /usr/obj + j: 10634752 10542176 4.2BSD 2048 16384 1 + k: 1.6G 21176928 4.2BSD 2048 16384 1 # /home + k: 3401056 21176928 4.2BSD 2048 16384 1 /dev/vnd0a / ffs rw 1 1 /dev/vnd0k /home ffs rw 1 2 @@ -391,26 +373,26 @@ Writing MBR at offset 0. ===== Start 20000MB disk ===== Writing MBR at offset 0. - a: 0.7G 128 4.2BSD 2048 16384 1 # / - a: 1522368 128 4.2BSD 2048 16384 1 - b: 1.2G 1522496 swap - b: 2594180 1522496 swap - d: 1.0G 4116704 4.2BSD 2048 16384 1 # /tmp - d: 2189984 4116704 4.2BSD 2048 16384 1 - e: 1.6G 6306688 4.2BSD 2048 16384 1 # /var - e: 3323264 6306688 4.2BSD 2048 16384 1 - f: 1.5G 9629952 4.2BSD 2048 16384 1 # /usr - f: 3058368 9629952 4.2BSD 2048 16384 1 - g: 0.7G 12688320 4.2BSD 2048 16384 1 # /usr/X11R6 - g: 1515520 12688320 4.2BSD 2048 16384 1 - h: 2.7G 14203840 4.2BSD 2048 16384 1 # /usr/local - h: 5742656 14203840 4.2BSD 2048 16384 1 - i: 1.5G 19946496 4.2BSD 2048 16384 1 # /usr/src - i: 3148448 19946496 4.2BSD 2048 16384 1 - j: 3.5G 23094944 4.2BSD 2048 16384 1 # /usr/obj - j: 7263584 23094944 4.2BSD 2048 16384 1 - k: 5.1G 30358528 4.2BSD 2048 16384 1 # /home - k: 10603456 30358528 4.2BSD 2048 16384 1 + a: 0.6G 128 4.2BSD 2048 16384 1 # / + a: 1312640 128 4.2BSD 2048 16384 1 + b: 1.0G 1312768 swap + b: 2174750 1312768 swap + d: 0.9G 3487520 4.2BSD 2048 16384 1 # /tmp + d: 1854464 3487520 4.2BSD 2048 16384 1 + e: 1.3G 5341984 4.2BSD 2048 16384 1 # /var + e: 2778016 5341984 4.2BSD 2048 16384 1 + f: 1.4G 8120000 4.2BSD 2048 16384 1 # /usr + f: 2848640 8120000 4.2BSD 2048 16384 1 + g: 0.7G 10968640 4.2BSD 2048 16384 1 # /usr/X11R6 + g: 1389696 10968640 4.2BSD 2048 16384 1 + h: 2.4G 12358336 4.2BSD 2048 16384 1 # /usr/local + h: 5113504 12358336 4.2BSD 2048 16384 1 + i: 1.5G 17471840 4.2BSD 2048 16384 1 # /usr/src + i: 3064576 17471840 4.2BSD 2048 16384 1 + j: 5.4G 20536416 4.2BSD 2048 16384 1 # /usr/obj + j: 11290112 20536416 4.2BSD 2048 16384 1 + k: 4.4G 31826528 4.2BSD 2048 16384 1 # /home + k: 9135456 31826528 4.2BSD 2048 16384 1 /dev/vnd0a / ffs rw 1 1 /dev/vnd0k /home ffs rw 1 2 @@ -429,24 +411,24 @@ Writing MBR at offset 0. a: 1.0G 128 4.2BSD 2048 16384 1 # / a: 2097152 128 4.2BSD 2048 16384 1 - b: 3.2G 2097280 swap - b: 6690180 2097280 swap - d: 2.6G 8787488 4.2BSD 2048 16384 1 # /tmp - d: 5466784 8787488 4.2BSD 2048 16384 1 - e: 4.1G 14254272 4.2BSD 2048 16384 1 # /var - e: 8648064 14254272 4.2BSD 2048 16384 1 - f: 2.0G 22902336 4.2BSD 2048 16384 1 # /usr - f: 4194304 22902336 4.2BSD 2048 16384 1 - g: 1.0G 27096640 4.2BSD 2048 16384 1 # /usr/X11R6 - g: 2097152 27096640 4.2BSD 2048 16384 1 - h: 5.7G 29193792 4.2BSD 2048 16384 1 # /usr/local - h: 11886656 29193792 4.2BSD 2048 16384 1 - i: 1.9G 41080448 4.2BSD 2048 16384 1 # /usr/src - i: 3967648 41080448 4.2BSD 2048 16384 1 - j: 4.2G 45048096 4.2BSD 2048 16384 1 # /usr/obj - j: 8901984 45048096 4.2BSD 2048 16384 1 - k: 13.3G 53950080 4.2BSD 2048 16384 1 # /home - k: 27971904 53950080 4.2BSD 2048 16384 1 + b: 3.0G 2097280 swap + b: 6270750 2097280 swap + d: 2.4G 8368032 4.2BSD 2048 16384 1 # /tmp + d: 5131264 8368032 4.2BSD 2048 16384 1 + e: 3.9G 13499296 4.2BSD 2048 16384 1 # /var + e: 8102816 13499296 4.2BSD 2048 16384 1 + f: 2.0G 21602112 4.2BSD 2048 16384 1 # /usr + f: 4194304 21602112 4.2BSD 2048 16384 1 + g: 1.0G 25796416 4.2BSD 2048 16384 1 # /usr/X11R6 + g: 2097152 25796416 4.2BSD 2048 16384 1 + h: 5.4G 27893568 4.2BSD 2048 16384 1 # /usr/local + h: 11257504 27893568 4.2BSD 2048 16384 1 + i: 1.9G 39151072 4.2BSD 2048 16384 1 # /usr/src + i: 3883776 39151072 4.2BSD 2048 16384 1 + j: 6.0G 43034848 4.2BSD 2048 16384 1 # /usr/obj + j: 12582912 43034848 4.2BSD 2048 16384 1 + k: 12.5G 55617760 4.2BSD 2048 16384 1 # /home + k: 26304224 55617760 4.2BSD 2048 16384 1 /dev/vnd0a / ffs rw 1 1 /dev/vnd0k /home ffs rw 1 2