0000: 23 21 2f 75 73 72 2f 62 69 6e 2f 65 6e 76 20 70 #!/usr/bin/env p
0010: 65 72 6c 0a 23 23 23 23 23 23 23 23 23 23 23 23 erl.############
0020: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
0030: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
0040: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
0050: 23 23 23 23 23 23 23 23 23 23 23 23 0a 23 20 74 ############.# t
0060: 65 73 74 2d 6f 73 38 2d 72 75 6e 20 2d 20 43 6f est-os8-run - Co
0070: 6c 6c 65 63 74 73 20 74 68 65 20 73 65 74 20 6f llects the set o
0080: 66 20 61 6c 6c 20 2d 2d 2a 2d 6f 73 38 2d 2a 20 f all --*-os8-*
0090: 6f 70 74 69 6f 6e 73 20 66 72 6f 6d 20 74 68 65 options from the
00a0: 0a 23 20 20 20 63 6f 6e 66 69 67 75 72 65 20 73 .# configure s
00b0: 63 72 69 70 74 2c 20 67 65 6e 65 72 61 74 65 73 cript, generates
00c0: 20 61 6c 6c 20 75 6e 69 71 75 65 20 73 75 62 73 all unique subs
00d0: 65 74 73 20 6f 66 20 74 68 61 74 20 6f 70 74 69 ets of that opti
00e0: 6f 6e 20 73 65 74 2c 0a 23 20 20 20 72 75 6e 73 on set,.# runs
00f0: 20 63 6f 6e 66 69 67 75 72 65 20 77 69 74 68 20 configure with
0100: 65 61 63 68 20 6f 66 20 74 68 6f 73 65 20 73 75 each of those su
0110: 62 73 65 74 73 2c 20 61 6e 64 20 63 6f 6d 70 61 bsets, and compa
0120: 72 65 73 20 74 68 65 20 6f 75 74 70 75 74 0a 23 res the output.#
0130: 20 20 20 4f 53 2f 38 20 62 69 6e 20 52 4b 30 35 OS/8 bin RK05
0140: 20 64 69 73 6b 20 74 6f 20 74 68 65 20 70 72 65 disk to the pre
0150: 76 69 6f 75 73 20 72 75 6e 27 73 20 76 65 72 73 vious run's vers
0160: 69 6f 6e 2e 20 20 49 66 20 74 68 65 72 65 20 69 ion. If there i
0170: 73 20 61 0a 23 20 20 20 64 69 73 63 72 65 70 61 s a.# discrepa
0180: 6e 63 79 2c 20 67 65 6e 65 72 61 74 65 20 61 20 ncy, generate a
0190: 64 69 66 66 20 61 67 61 69 6e 73 74 20 74 68 65 diff against the
01a0: 20 62 75 69 6c 64 20 6c 6f 67 20 66 6f 72 20 74 build log for t
01b0: 68 61 74 20 6f 70 74 69 6f 6e 0a 23 20 20 20 73 hat option.# s
01c0: 65 74 20 61 6e 64 20 72 65 70 6f 72 74 20 74 68 et and report th
01d0: 65 20 70 72 6f 62 6c 65 6d 20 66 6f 72 20 74 68 e problem for th
01e0: 65 20 75 73 65 72 20 74 6f 20 64 69 61 67 6e 6f e user to diagno
01f0: 73 65 2e 0a 23 0a 23 20 20 20 54 68 65 20 66 69 se..#.# The fi
0200: 72 73 74 20 74 69 6d 65 20 74 68 65 20 73 63 72 rst time the scr
0210: 69 70 74 20 69 73 20 72 75 6e 2c 20 6f 72 20 74 ipt is run, or t
0220: 68 65 20 66 69 72 73 74 20 74 69 6d 65 20 61 20 he first time a
0230: 6e 65 77 20 75 6e 69 71 75 65 0a 23 20 20 20 6f new unique.# o
0240: 70 74 69 6f 6e 20 73 75 62 73 65 74 20 69 73 20 ption subset is
0250: 67 65 6e 65 72 61 74 65 64 2c 20 77 65 20 73 61 generated, we sa
0260: 76 65 20 74 68 65 20 62 75 69 6c 64 20 72 65 73 ve the build res
0270: 75 6c 74 73 20 61 73 20 74 68 65 0a 23 20 20 20 ults as the.#
0280: 65 78 65 6d 70 6c 61 72 20 74 6f 20 75 73 65 20 exemplar to use
0290: 69 6e 20 6c 61 74 65 72 20 74 65 73 74 73 2e 0a in later tests..
02a0: 23 0a 23 20 43 6f 70 79 72 69 67 68 74 20 c2 a9 #.# Copyright ©
02b0: 20 32 30 31 37 2d 32 30 31 38 20 62 79 20 57 61 2017-2018 by Wa
02c0: 72 72 65 6e 20 59 6f 75 6e 67 0a 23 0a 23 20 50 rren Young.#.# P
02d0: 65 72 6d 69 73 73 69 6f 6e 20 69 73 20 68 65 72 ermission is her
02e0: 65 62 79 20 67 72 61 6e 74 65 64 2c 20 66 72 65 eby granted, fre
02f0: 65 20 6f 66 20 63 68 61 72 67 65 2c 20 74 6f 20 e of charge, to
0300: 61 6e 79 20 70 65 72 73 6f 6e 20 6f 62 74 61 69 any person obtai
0310: 6e 69 6e 67 0a 23 20 61 20 63 6f 70 79 20 6f 66 ning.# a copy of
0320: 20 74 68 69 73 20 73 6f 66 74 77 61 72 65 20 61 this software a
0330: 6e 64 20 61 73 73 6f 63 69 61 74 65 64 20 64 6f nd associated do
0340: 63 75 6d 65 6e 74 61 74 69 6f 6e 20 66 69 6c 65 cumentation file
0350: 73 20 28 74 68 65 0a 23 20 22 53 6f 66 74 77 61 s (the.# "Softwa
0360: 72 65 22 29 2c 20 74 6f 20 64 65 61 6c 20 69 6e re"), to deal in
0370: 20 74 68 65 20 53 6f 66 74 77 61 72 65 20 77 69 the Software wi
0380: 74 68 6f 75 74 20 72 65 73 74 72 69 63 74 69 6f thout restrictio
0390: 6e 2c 20 69 6e 63 6c 75 64 69 6e 67 0a 23 20 77 n, including.# w
03a0: 69 74 68 6f 75 74 20 6c 69 6d 69 74 61 74 69 6f ithout limitatio
03b0: 6e 20 74 68 65 20 72 69 67 68 74 73 20 74 6f 20 n the rights to
03c0: 75 73 65 2c 20 63 6f 70 79 2c 20 6d 6f 64 69 66 use, copy, modif
03d0: 79 2c 20 6d 65 72 67 65 2c 20 70 75 62 6c 69 73 y, merge, publis
03e0: 68 2c 0a 23 20 64 69 73 74 72 69 62 75 74 65 2c h,.# distribute,
03f0: 20 73 75 62 6c 69 63 65 6e 73 65 2c 20 61 6e 64 sublicense, and
0400: 2f 6f 72 20 73 65 6c 6c 20 63 6f 70 69 65 73 20 /or sell copies
0410: 6f 66 20 74 68 65 20 53 6f 66 74 77 61 72 65 2c of the Software,
0420: 20 61 6e 64 20 74 6f 0a 23 20 70 65 72 6d 69 74 and to.# permit
0430: 20 70 65 72 73 6f 6e 73 20 74 6f 20 77 68 6f 6d persons to whom
0440: 20 74 68 65 20 53 6f 66 74 77 61 72 65 20 69 73 the Software is
0450: 20 66 75 72 6e 69 73 68 65 64 20 74 6f 20 64 6f furnished to do
0460: 20 73 6f 2c 20 73 75 62 6a 65 63 74 20 74 6f 0a so, subject to.
0470: 23 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 # the following
0480: 63 6f 6e 64 69 74 69 6f 6e 73 3a 0a 23 0a 23 20 conditions:.#.#
0490: 54 68 65 20 61 62 6f 76 65 20 63 6f 70 79 72 69 The above copyri
04a0: 67 68 74 20 6e 6f 74 69 63 65 20 61 6e 64 20 74 ght notice and t
04b0: 68 69 73 20 70 65 72 6d 69 73 73 69 6f 6e 20 6e his permission n
04c0: 6f 74 69 63 65 20 73 68 61 6c 6c 20 62 65 0a 23 otice shall be.#
04d0: 20 69 6e 63 6c 75 64 65 64 20 69 6e 20 61 6c 6c included in all
04e0: 20 63 6f 70 69 65 73 20 6f 72 20 73 75 62 73 74 copies or subst
04f0: 61 6e 74 69 61 6c 20 70 6f 72 74 69 6f 6e 73 20 antial portions
0500: 6f 66 20 74 68 65 20 53 6f 66 74 77 61 72 65 2e of the Software.
0510: 0a 23 0a 23 20 54 48 45 20 53 4f 46 54 57 41 52 .#.# THE SOFTWAR
0520: 45 20 49 53 20 50 52 4f 56 49 44 45 44 20 22 41 E IS PROVIDED "A
0530: 53 20 49 53 22 2c 20 57 49 54 48 4f 55 54 20 57 S IS", WITHOUT W
0540: 41 52 52 41 4e 54 59 20 4f 46 20 41 4e 59 20 4b ARRANTY OF ANY K
0550: 49 4e 44 2c 0a 23 20 45 58 50 52 45 53 53 20 4f IND,.# EXPRESS O
0560: 52 20 49 4d 50 4c 49 45 44 2c 20 49 4e 43 4c 55 R IMPLIED, INCLU
0570: 44 49 4e 47 20 42 55 54 20 4e 4f 54 20 4c 49 4d DING BUT NOT LIM
0580: 49 54 45 44 20 54 4f 20 54 48 45 20 57 41 52 52 ITED TO THE WARR
0590: 41 4e 54 49 45 53 20 4f 46 0a 23 20 4d 45 52 43 ANTIES OF.# MERC
05a0: 48 41 4e 54 41 42 49 4c 49 54 59 2c 20 46 49 54 HANTABILITY, FIT
05b0: 4e 45 53 53 20 46 4f 52 20 41 20 50 41 52 54 49 NESS FOR A PARTI
05c0: 43 55 4c 41 52 20 50 55 52 50 4f 53 45 20 41 4e CULAR PURPOSE AN
05d0: 44 20 4e 4f 4e 49 4e 46 52 49 4e 47 45 4d 45 4e D NONINFRINGEMEN
05e0: 54 2e 0a 23 20 49 4e 20 4e 4f 20 45 56 45 4e 54 T..# IN NO EVENT
05f0: 20 53 48 41 4c 4c 20 54 48 45 20 41 55 54 48 4f SHALL THE AUTHO
0600: 52 53 20 4c 49 53 54 45 44 20 41 42 4f 56 45 20 RS LISTED ABOVE
0610: 42 45 20 4c 49 41 42 4c 45 20 46 4f 52 20 41 4e BE LIABLE FOR AN
0620: 59 20 43 4c 41 49 4d 2c 0a 23 20 44 41 4d 41 47 Y CLAIM,.# DAMAG
0630: 45 53 20 4f 52 20 4f 54 48 45 52 20 4c 49 41 42 ES OR OTHER LIAB
0640: 49 4c 49 54 59 2c 20 57 48 45 54 48 45 52 20 49 ILITY, WHETHER I
0650: 4e 20 41 4e 20 41 43 54 49 4f 4e 20 4f 46 20 43 N AN ACTION OF C
0660: 4f 4e 54 52 41 43 54 2c 20 54 4f 52 54 0a 23 20 ONTRACT, TORT.#
0670: 4f 52 20 4f 54 48 45 52 57 49 53 45 2c 20 41 52 OR OTHERWISE, AR
0680: 49 53 49 4e 47 20 46 52 4f 4d 2c 20 4f 55 54 20 ISING FROM, OUT
0690: 4f 46 20 4f 52 20 49 4e 20 43 4f 4e 4e 45 43 54 OF OR IN CONNECT
06a0: 49 4f 4e 20 57 49 54 48 20 54 48 45 20 53 4f 46 ION WITH THE SOF
06b0: 54 57 41 52 45 0a 23 20 4f 52 20 54 48 45 20 55 TWARE.# OR THE U
06c0: 53 45 20 4f 52 20 4f 54 48 45 52 20 44 45 41 4c SE OR OTHER DEAL
06d0: 49 4e 47 53 20 49 4e 20 54 48 45 20 53 4f 46 54 INGS IN THE SOFT
06e0: 57 41 52 45 2e 0a 23 0a 23 20 45 78 63 65 70 74 WARE..#.# Except
06f0: 20 61 73 20 63 6f 6e 74 61 69 6e 65 64 20 69 6e as contained in
0700: 20 74 68 69 73 20 6e 6f 74 69 63 65 2c 20 74 68 this notice, th
0710: 65 20 6e 61 6d 65 73 20 6f 66 20 74 68 65 20 61 e names of the a
0720: 75 74 68 6f 72 73 20 61 62 6f 76 65 0a 23 20 73 uthors above.# s
0730: 68 61 6c 6c 20 6e 6f 74 20 62 65 20 75 73 65 64 hall not be used
0740: 20 69 6e 20 61 64 76 65 72 74 69 73 69 6e 67 20 in advertising
0750: 6f 72 20 6f 74 68 65 72 77 69 73 65 20 74 6f 20 or otherwise to
0760: 70 72 6f 6d 6f 74 65 20 74 68 65 20 73 61 6c 65 promote the sale
0770: 2c 0a 23 20 75 73 65 20 6f 72 20 6f 74 68 65 72 ,.# use or other
0780: 20 64 65 61 6c 69 6e 67 73 20 69 6e 20 74 68 69 dealings in thi
0790: 73 20 53 6f 66 74 77 61 72 65 20 77 69 74 68 6f s Software witho
07a0: 75 74 20 70 72 69 6f 72 20 77 72 69 74 74 65 6e ut prior written
07b0: 0a 23 20 61 75 74 68 6f 72 69 7a 61 74 69 6f 6e .# authorization
07c0: 20 66 72 6f 6d 20 74 68 6f 73 65 20 61 75 74 68 from those auth
07d0: 6f 72 73 2e 0a 23 23 23 23 23 23 23 23 23 23 23 ors..###########
07e0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
07f0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
0800: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
0810: 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 0a 75 #############..u
0820: 73 65 20 73 74 72 69 63 74 3b 0a 75 73 65 20 77 se strict;.use w
0830: 61 72 6e 69 6e 67 73 3b 0a 0a 23 20 4d 6f 64 75 arnings;..# Modu
0840: 6c 65 73 20 66 72 6f 6d 20 43 50 41 4e 0a 75 73 les from CPAN.us
0850: 65 20 4d 61 74 68 3a 3a 53 75 62 73 65 74 73 3a e Math::Subsets:
0860: 3a 4c 69 73 74 3b 0a 75 73 65 20 50 61 72 61 6c :List;.use Paral
0870: 6c 65 6c 3a 3a 4c 6f 6f 70 73 3b 0a 0a 23 20 43 lel::Loops;..# C
0880: 6f 72 65 20 6d 6f 64 75 6c 65 73 0a 75 73 65 20 ore modules.use
0890: 43 77 64 20 71 77 28 67 65 74 63 77 64 20 61 62 Cwd qw(getcwd ab
08a0: 73 5f 70 61 74 68 29 3b 0a 75 73 65 20 44 69 67 s_path);.use Dig
08b0: 65 73 74 3a 3a 53 48 41 20 71 77 28 73 68 61 32 est::SHA qw(sha2
08c0: 35 36 5f 68 65 78 29 3b 0a 75 73 65 20 45 6e 67 56_hex);.use Eng
08d0: 6c 69 73 68 3b 0a 75 73 65 20 46 69 6c 65 3a 3a lish;.use File::
08e0: 42 61 73 65 6e 61 6d 65 3b 0a 75 73 65 20 46 69 Basename;.use Fi
08f0: 6c 65 3a 3a 43 6f 70 79 3b 0a 75 73 65 20 47 65 le::Copy;.use Ge
0900: 74 6f 70 74 3a 3a 53 74 64 3b 0a 75 73 65 20 4c topt::Std;.use L
0910: 69 73 74 3a 3a 55 74 69 6c 20 71 77 28 73 68 75 ist::Util qw(shu
0920: 66 66 6c 65 29 3b 0a 75 73 65 20 54 65 72 6d 3a ffle);.use Term:
0930: 3a 41 4e 53 49 43 6f 6c 6f 72 3b 0a 0a 23 20 50 :ANSIColor;..# P
0940: 65 72 6c 3a 3a 43 72 69 74 69 63 20 72 75 6c 65 erl::Critic rule
0950: 73 20 77 65 27 72 65 20 77 69 6c 6c 69 6e 67 20 s we're willing
0960: 74 6f 20 62 65 6e 64 0a 23 23 20 6e 6f 20 63 72 to bend.## no cr
0970: 69 74 69 63 20 28 49 6e 70 75 74 4f 75 74 70 75 itic (InputOutpu
0980: 74 3a 3a 52 65 71 75 69 72 65 42 72 69 65 66 4f t::RequireBriefO
0990: 70 65 6e 20 29 0a 0a 0a 23 23 23 23 20 47 4c 4f pen )...#### GLO
09a0: 42 41 4c 53 20 23 23 23 23 23 23 23 23 23 23 23 BALS ###########
09b0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
09c0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
09d0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
09e0: 0a 0a 6d 79 20 40 74 65 73 74 73 3b 0a 6d 79 20 ..my @tests;.my
09f0: 24 74 65 73 74 73 5f 6d 66 3b 0a 6d 79 20 28 25 $tests_mf;.my (%
0a00: 67 65 6e 65 72 61 74 65 64 2c 20 25 74 65 73 74 generated, %test
0a10: 65 64 29 3b 0a 6d 79 20 24 63 75 72 72 6c 6f 67 ed);.my $currlog
0a20: 20 3d 20 27 6f 62 6a 2f 6f 73 38 2d 72 75 6e 2e = 'obj/os8-run.
0a30: 6c 6f 67 27 3b 0a 6d 79 20 24 63 6d 70 6c 7a 20 log';.my $cmplz
0a40: 3d 20 61 62 73 5f 70 61 74 68 20 28 64 69 72 6e = abs_path (dirn
0a50: 61 6d 65 20 28 24 30 29 29 20 2e 20 27 2f 63 6d ame ($0)) . '/cm
0a60: 70 6c 7a 27 3b 0a 0a 23 20 43 6f 6d 6d 61 6e 64 plz';..# Command
0a70: 20 6c 69 6e 65 20 6f 70 74 69 6f 6e 20 76 61 6c line option val
0a80: 75 65 73 0a 6d 79 20 28 24 64 72 79 5f 72 75 6e ues.my ($dry_run
0a90: 2c 20 24 65 78 69 73 74 69 6e 67 5f 6f 6e 6c 79 , $existing_only
0aa0: 2c 20 24 67 65 6e 65 72 61 74 65 5f 6f 6e 6c 79 , $generate_only
0ab0: 2c 20 24 73 69 6e 67 6c 65 5f 63 6f 72 65 2c 20 , $single_core,
0ac0: 24 73 68 75 66 66 6c 65 2c 0a 20 20 20 20 20 20 $shuffle,.
0ad0: 20 20 24 76 65 72 62 6f 73 65 29 3b 0a 0a 0a 23 $verbose);...#
0ae0: 23 23 23 20 73 61 6e 69 74 69 7a 65 5f 6c 6f 67 ### sanitize_log
0af0: 20 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ###############
0b00: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
0b10: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
0b20: 23 23 23 23 23 23 23 0a 23 20 43 6f 70 79 20 74 #######.# Copy t
0b30: 68 65 20 67 69 76 65 6e 20 69 6e 70 75 74 20 6c he given input l
0b40: 6f 67 20 66 69 6c 65 20 74 6f 20 74 68 65 20 6f og file to the o
0b50: 75 70 74 75 74 20 66 69 6c 65 2c 20 65 78 70 75 uptut file, expu
0b60: 72 67 61 74 69 6e 67 20 62 69 74 73 0a 23 20 74 rgating bits.# t
0b70: 68 61 74 20 63 68 61 6e 67 65 20 66 72 6f 6d 20 hat change from
0b80: 6f 6e 65 20 72 75 6e 20 74 6f 20 74 68 65 20 6e one run to the n
0b90: 65 78 74 20 77 69 74 68 6f 75 74 20 62 65 69 6e ext without bein
0ba0: 67 20 6d 65 61 6e 69 6e 67 66 75 6c 2e 0a 0a 73 g meaningful...s
0bb0: 75 62 20 73 61 6e 69 74 69 7a 65 5f 6c 6f 67 0a ub sanitize_log.
0bc0: 7b 0a 20 20 20 20 6d 79 20 28 24 69 66 69 6c 65 {. my ($ifile
0bd0: 2c 20 24 6f 66 69 6c 65 29 20 3d 20 40 5f 3b 0a , $ofile) = @_;.
0be0: 0a 20 20 20 20 6f 70 65 6e 20 6d 79 20 24 69 66 . open my $if
0bf0: 2c 20 27 3c 27 2c 20 24 69 66 69 6c 65 20 6f 72 , '<', $ifile or
0c00: 20 64 69 65 20 22 43 61 6e 6e 6f 74 20 72 65 61 die "Cannot rea
0c10: 64 20 24 69 66 69 6c 65 3a 20 24 21 5c 6e 22 3b d $ifile: $!\n";
0c20: 0a 20 20 20 20 6f 70 65 6e 20 6d 79 20 24 6f 66 . open my $of
0c30: 2c 20 27 3e 27 2c 20 24 6f 66 69 6c 65 20 6f 72 , '>', $ofile or
0c40: 20 64 69 65 20 22 43 61 6e 6e 6f 74 20 77 72 69 die "Cannot wri
0c50: 74 65 20 24 6f 66 69 6c 65 3a 20 24 21 5c 6e 22 te $ofile: $!\n"
0c60: 3b 0a 0a 20 20 20 20 77 68 69 6c 65 20 28 3c 24 ;.. while (<$
0c70: 69 66 3e 29 20 7b 0a 20 20 20 20 20 20 20 20 23 if>) {. #
0c80: 20 53 74 72 69 70 20 61 6c 6c 20 74 68 65 20 43 Strip all the C
0c90: 52 73 20 6f 75 74 2e 20 20 57 65 20 6f 6e 6c 79 Rs out. We only
0ca0: 20 6e 65 65 64 20 74 68 65 20 4c 46 73 2e 0a 20 need the LFs..
0cb0: 20 20 20 20 20 20 20 73 7b 5c 72 7d 7b 7d 67 73 s{\r}{}gs
0cc0: 3b 0a 20 20 20 20 20 20 20 20 6d 79 20 24 6f 72 ;. my $or
0cd0: 69 67 69 6e 61 6c 20 3d 20 24 5f 3b 20 20 20 20 iginal = $_;
0ce0: 20 20 23 20 73 61 76 65 20 69 74 20 70 6f 73 74 # save it post
0cf0: 2d 73 74 72 69 70 0a 0a 20 20 20 20 20 20 20 20 -strip..
0d00: 23 20 53 74 72 69 70 20 76 61 72 69 61 62 6c 65 # Strip variable
0d10: 20 70 61 72 74 73 20 6f 66 20 53 49 4d 48 20 6c parts of SIMH l
0d20: 69 6e 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 65 61 ine following ea
0d30: 63 68 20 43 74 72 6c 2d 45 3a 0a 20 20 20 20 20 ch Ctrl-E:.
0d40: 20 20 20 23 0a 20 20 20 20 20 20 20 20 23 20 22 #. # "
0d50: 53 69 6d 75 6c 61 74 69 6f 6e 20 73 74 6f 70 70 Simulation stopp
0d60: 65 64 2c 20 50 43 3a 20 30 31 32 31 30 20 28 4a ed, PC: 01210 (J
0d70: 4d 50 20 31 32 30 37 29 22 0a 20 20 20 20 20 20 MP 1207)".
0d80: 20 20 73 7b 0a 20 20 20 20 20 20 20 20 20 20 20 s{.
0d90: 20 28 53 69 6d 75 6c 61 74 69 6f 6e 5c 20 73 74 (Simulation\ st
0da0: 6f 70 70 65 64 29 20 20 20 20 20 20 20 20 20 20 opped)
0db0: 20 20 23 20 62 69 74 20 74 6f 20 70 72 65 73 65 # bit to prese
0dc0: 72 76 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 rve.
0dd0: 2c 5c 20 50 43 3a 5c 20 5c 64 2b 5c 20 5c 28 5b ,\ PC:\ \d+\ \([
0de0: 41 2d 5a 5d 2b 28 5c 20 5c 64 2b 29 3f 5c 29 20 A-Z]+(\ \d+)?\)
0df0: 20 23 20 76 61 72 69 61 62 6c 65 20 62 69 74 0a # variable bit.
0e00: 20 20 20 20 20 20 20 20 7d 7b 24 31 2e 7d 78 3b }{$1.}x;
0e10: 0a 0a 20 20 20 20 20 20 20 20 23 20 52 65 77 72 .. # Rewr
0e20: 69 74 65 20 53 49 4d 48 20 41 54 54 41 43 48 20 ite SIMH ATTACH
0e30: 63 6f 6d 6d 61 6e 64 73 20 74 6f 20 72 65 6d 6f commands to remo
0e40: 76 65 20 70 6f 69 6e 74 6c 65 73 73 20 64 69 66 ve pointless dif
0e50: 66 65 72 65 6e 63 65 73 0a 20 20 20 20 20 20 20 ferences.
0e60: 20 23 20 69 6e 20 61 62 73 6f 6c 75 74 65 20 70 # in absolute p
0e70: 61 74 68 73 20 62 65 74 77 65 65 6e 20 6d 61 63 aths between mac
0e80: 68 69 6e 65 73 20 6f 72 20 46 6f 73 73 69 6c 20 hines or Fossil
0e90: 63 68 65 63 6b 6f 75 74 73 2e 0a 20 20 20 20 20 checkouts..
0ea0: 20 20 20 73 7b 0a 20 20 20 20 20 20 20 20 20 20 s{.
0eb0: 20 20 28 61 74 74 61 63 68 5c 20 29 20 20 20 20 (attach\ )
0ec0: 20 20 20 20 20 20 20 23 20 53 49 4d 48 20 63 6f # SIMH co
0ed0: 6d 6d 61 6e 64 0a 20 20 20 20 20 20 20 20 20 20 mmand.
0ee0: 20 20 28 2d 72 5c 20 29 3f 20 20 20 20 20 20 20 (-r\ )?
0ef0: 20 20 20 20 20 20 20 23 20 6f 70 74 69 6f 6e 61 # optiona
0f00: 6c 20 66 6c 61 67 0a 20 20 20 20 20 20 20 20 20 l flag.
0f10: 20 20 20 28 5b 61 2d 7a 30 2d 39 5d 2b 5c 20 29 ([a-z0-9]+\ )
0f20: 20 20 20 20 20 20 20 20 23 20 53 49 4d 48 20 64 # SIMH d
0f30: 65 76 69 63 65 20 6e 61 6d 65 0a 20 20 20 20 20 evice name.
0f40: 20 20 20 20 20 20 20 28 2e 2a 74 65 73 74 2f 74 (.*test/t
0f50: 6d 70 2f 5b 30 2d 39 5d 2b 2f 29 20 23 20 6e 6f mp/[0-9]+/) # no
0f60: 69 73 65 20 70 61 72 74 73 20 6f 66 20 69 6d 61 ise parts of ima
0f70: 67 65 20 66 69 6c 65 20 6e 61 6d 65 20 74 68 72 ge file name thr
0f80: 75 20 50 49 44 0a 20 20 20 20 20 20 20 20 7d 7b u PID. }{
0f90: 24 31 24 33 2e 2e 2e 2f 7d 78 3b 0a 20 20 20 20 $1$3.../}x;.
0fa0: 20 20 20 20 73 7b 0a 20 20 20 20 20 20 20 20 20 s{.
0fb0: 20 20 20 28 61 74 74 61 63 68 5c 20 29 0a 20 20 (attach\ ).
0fc0: 20 20 20 20 20 20 20 20 20 20 28 2d 72 5c 20 29 (-r\ )
0fd0: 3f 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 5b ?. ([
0fe0: 61 2d 7a 30 2d 39 5d 2b 5c 20 29 0a 20 20 20 20 a-z0-9]+\ ).
0ff0: 20 20 20 20 20 20 20 20 28 2e 2a 2f 28 6d 65 64 (.*/(med
1000: 69 61 2f 6f 73 38 29 2f 29 20 20 20 20 23 20 61 ia/os8)/) # a
1010: 6c 73 6f 20 73 71 75 69 73 68 20 74 68 69 73 20 lso squish this
1020: 6e 6f 69 73 65 0a 20 20 20 20 20 20 20 20 7d 7b noise. }{
1030: 24 31 24 33 2e 2e 2e 2f 24 35 2f 7d 78 3b 0a 0a $1$3.../$5/}x;..
1040: 20 20 20 20 20 20 20 20 23 20 41 64 64 20 63 6c # Add cl
1050: 65 61 6e 65 64 20 6c 69 6e 65 20 74 6f 20 6f 66 eaned line to of
1060: 69 6c 65 0a 20 20 20 20 20 20 20 20 70 72 69 6e ile. prin
1070: 74 20 24 6f 66 20 24 5f 3b 0a 20 20 20 20 7d 0a t $of $_;. }.
1080: 0a 20 20 20 20 63 6c 6f 73 65 20 24 69 66 3b 0a . close $if;.
1090: 20 20 20 20 63 6c 6f 73 65 20 24 6f 66 3b 0a 0a close $of;..
10a0: 20 20 20 20 72 65 74 75 72 6e 3b 0a 7d 0a 0a 0a return;.}...
10b0: 23 23 23 23 20 63 6f 6e 73 74 72 75 63 74 5f 74 #### construct_t
10c0: 65 73 74 20 23 23 23 23 23 23 23 23 23 23 23 23 est ############
10d0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
10e0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
10f0: 23 23 23 23 23 23 23 23 0a 23 20 41 73 73 65 6d ########.# Assem
1100: 62 6c 65 73 20 61 20 74 65 73 74 20 72 65 63 6f bles a test reco
1110: 72 64 20 66 6f 72 20 61 20 73 69 6e 67 6c 65 20 rd for a single
1120: 70 65 72 6d 75 74 61 74 69 6f 6e 0a 0a 73 75 62 permutation..sub
1130: 20 63 6f 6e 73 74 72 75 63 74 5f 74 65 73 74 0a construct_test.
1140: 7b 0a 20 20 20 20 6d 79 20 40 6f 70 74 73 20 3d {. my @opts =
1150: 20 40 5f 3b 0a 0a 20 20 20 20 23 20 44 69 73 74 @_;.. # Dist
1160: 69 6c 6c 20 74 68 69 73 20 6f 70 74 69 6f 6e 20 ill this option
1170: 73 65 74 20 74 6f 20 61 20 68 61 73 68 20 76 61 set to a hash va
1180: 6c 75 65 20 61 66 74 65 72 20 77 68 69 63 68 20 lue after which
1190: 77 65 20 77 69 6c 6c 0a 20 20 20 20 23 20 6e 61 we will. # na
11a0: 6d 65 20 74 68 65 20 6f 75 74 70 75 74 20 66 69 me the output fi
11b0: 6c 65 73 2e 20 20 57 65 20 64 6f 6e 27 74 20 77 les. We don't w
11c0: 61 6e 74 20 74 6f 20 6e 61 6d 65 20 66 69 6c 65 ant to name file
11d0: 73 20 77 69 74 68 20 61 0a 20 20 20 20 23 20 6c s with a. # l
11e0: 65 61 64 69 6e 67 20 68 79 70 68 65 6e 20 6f 72 eading hyphen or
11f0: 20 77 69 74 68 20 6c 6f 6e 67 20 76 61 72 69 61 with long varia
1200: 62 6c 65 2d 6c 65 6e 67 74 68 20 6e 61 6d 65 73 ble-length names
1210: 2c 20 70 6f 74 65 6e 74 69 61 6c 6c 79 0a 20 20 , potentially.
1220: 20 20 23 20 6d 75 6c 74 69 70 6c 65 20 6c 69 6e # multiple lin
1230: 65 73 20 6c 6f 6e 67 2e 0a 20 20 20 20 6d 79 20 es long.. my
1240: 24 6f 70 74 73 74 72 20 3d 20 6a 6f 69 6e 20 27 $optstr = join '
1250: 20 27 2c 20 40 6f 70 74 73 3b 0a 20 20 20 20 6d ', @opts;. m
1260: 79 20 24 68 61 73 68 20 3d 20 73 68 61 32 35 36 y $hash = sha256
1270: 5f 68 65 78 28 24 6f 70 74 73 74 72 29 3b 0a 20 _hex($optstr);.
1280: 20 20 20 6d 79 20 24 68 64 69 72 20 3d 20 22 74 my $hdir = "t
1290: 65 73 74 2f 24 68 61 73 68 22 3b 20 20 20 20 23 est/$hash"; #
12a0: 20 74 65 73 74 20 68 61 73 68 20 64 69 72 20 72 test hash dir r
12b0: 65 6c 61 74 69 76 65 20 74 6f 20 6f 75 72 20 43 elative to our C
12c0: 57 44 0a 20 20 20 20 6d 79 20 24 72 68 64 69 72 WD. my $rhdir
12d0: 20 3d 20 22 2e 2e 2f 2e 2e 2f 24 68 61 73 68 22 = "../../$hash"
12e0: 3b 20 20 23 20 24 68 64 69 72 20 72 65 6c 61 74 ; # $hdir relat
12f0: 69 76 65 20 74 6f 20 62 75 69 6c 64 64 69 72 20 ive to builddir
1300: 74 65 73 74 2f 74 6d 70 2f 24 50 49 44 0a 20 20 test/tmp/$PID.
1310: 20 20 6d 79 20 24 74 65 73 74 20 3d 20 7b 20 0a my $test = { .
1320: 20 20 20 20 20 20 20 20 68 61 73 68 20 20 20 3d hash =
1330: 3e 20 24 68 61 73 68 2c 0a 20 20 20 20 20 20 20 > $hash,.
1340: 20 68 64 69 72 20 20 20 3d 3e 20 24 72 68 64 69 hdir => $rhdi
1350: 72 2c 0a 20 20 20 20 20 20 20 20 6c 6f 67 20 20 r,. log
1360: 20 20 3d 3e 20 22 24 72 68 64 69 72 2f 6c 61 73 => "$rhdir/las
1370: 74 2e 6c 6f 67 22 2c 0a 20 20 20 20 20 20 20 20 t.log",.
1380: 6e 61 6d 65 20 20 20 3d 3e 20 27 7b 27 20 2e 20 name => '{' .
1390: 73 75 62 73 74 72 20 28 24 68 61 73 68 2c 20 30 substr ($hash, 0
13a0: 2c 20 31 32 29 20 2e 20 27 7d 27 2c 0a 20 20 20 , 12) . '}',.
13b0: 20 20 20 20 20 6f 70 74 73 74 72 20 3d 3e 20 24 optstr => $
13c0: 6f 70 74 73 74 72 2c 0a 20 20 20 20 20 20 20 20 optstr,.
13d0: 72 6b 6c 7a 20 20 20 3d 3e 20 22 24 72 68 64 69 rklz => "$rhdi
13e0: 72 2f 6c 61 73 74 2e 72 6b 6c 7a 22 2c 0a 20 20 r/last.rklz",.
13f0: 20 20 7d 3b 0a 0a 20 20 20 20 23 20 53 6b 69 70 };.. # Skip
1400: 20 74 68 69 73 20 6f 6e 65 20 69 66 20 69 74 20 this one if it
1410: 61 6c 72 65 61 64 79 20 65 78 69 73 74 73 20 61 already exists a
1420: 6e 64 20 77 65 27 72 65 20 69 6e 20 2d 67 20 6d nd we're in -g m
1430: 6f 64 65 2e 0a 20 20 20 20 69 66 20 28 24 67 65 ode.. if ($ge
1440: 6e 65 72 61 74 65 5f 6f 6e 6c 79 29 20 7b 0a 20 nerate_only) {.
1450: 20 20 20 20 20 20 20 69 66 20 28 2d 64 20 24 68 if (-d $h
1460: 64 69 72 29 20 7b 0a 20 20 20 20 20 20 20 20 20 dir) {.
1470: 20 20 20 69 66 20 28 2d 66 20 22 24 68 64 69 72 if (-f "$hdir
1480: 2f 6c 61 73 74 2e 6c 6f 67 22 29 20 7b 0a 20 20 /last.log") {.
1490: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 66 if
14a0: 20 28 2d 66 20 22 24 68 64 69 72 2f 6c 61 73 74 (-f "$hdir/last
14b0: 2e 72 6b 6c 7a 22 29 20 7b 0a 20 20 20 20 20 20 .rklz") {.
14c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 70 72 pr
14d0: 69 6e 74 20 22 53 6b 69 70 70 69 6e 67 20 24 74 int "Skipping $t
14e0: 65 73 74 2d 3e 7b 6e 61 6d 65 7d 3a 20 61 6c 72 est->{name}: alr
14f0: 65 61 64 79 20 64 6f 6e 65 2e 5c 6e 22 3b 0a 20 eady done.\n";.
1500: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1510: 20 20 20 72 65 74 75 72 6e 3b 0a 20 20 20 20 20 return;.
1520: 20 20 20 20 20 20 20 20 20 20 20 7d 0a 20 20 20 }.
1530: 20 20 20 20 20 20 20 20 20 20 20 20 20 65 6c 73 els
1540: 69 66 20 28 24 76 65 72 62 6f 73 65 29 20 7b 0a if ($verbose) {.
1550: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1560: 20 20 20 20 70 72 69 6e 74 20 22 4d 75 73 74 20 print "Must
1570: 72 65 2d 67 65 6e 20 24 68 61 73 68 20 64 65 73 re-gen $hash des
1580: 70 69 74 65 20 2d 67 3a 20 72 6b 6c 7a 20 6d 69 pite -g: rklz mi
1590: 73 73 69 6e 67 21 5c 6e 22 3b 0a 20 20 20 20 20 ssing!\n";.
15a0: 20 20 20 20 20 20 20 20 20 20 20 7d 0a 20 20 20 }.
15b0: 20 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 }.
15c0: 20 20 20 20 20 20 20 65 6c 73 69 66 20 28 24 76 elsif ($v
15d0: 65 72 62 6f 73 65 29 20 7b 0a 20 20 20 20 20 20 erbose) {.
15e0: 20 20 20 20 20 20 20 20 20 20 70 72 69 6e 74 20 print
15f0: 22 4d 75 73 74 20 72 65 2d 67 65 6e 20 24 68 61 "Must re-gen $ha
1600: 73 68 20 64 65 73 70 69 74 65 20 2d 67 3a 20 6c sh despite -g: l
1610: 6f 67 20 6d 69 73 73 69 6e 67 21 5c 6e 22 3b 0a og missing!\n";.
1620: 20 20 20 20 20 20 20 20 20 20 20 20 7d 0a 20 20 }.
1630: 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20 }.
1640: 65 6c 73 69 66 20 28 24 76 65 72 62 6f 73 65 29 elsif ($verbose)
1650: 20 7b 0a 20 20 20 20 20 20 20 20 20 20 20 20 70 {. p
1660: 72 69 6e 74 20 22 57 69 6c 6c 20 67 65 6e 65 72 rint "Will gener
1670: 61 74 65 20 24 68 61 73 68 2e 5c 6e 22 3b 0a 20 ate $hash.\n";.
1680: 20 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 0a 20 }. }.
1690: 20 20 20 65 6c 73 69 66 20 28 2d 64 20 24 68 64 elsif (-d $hd
16a0: 69 72 29 20 7b 0a 20 20 20 20 20 20 20 20 70 72 ir) {. pr
16b0: 69 6e 74 20 22 57 69 6c 6c 20 74 65 73 74 20 24 int "Will test $
16c0: 6f 70 74 73 74 72 20 61 67 61 69 6e 73 74 20 24 optstr against $
16d0: 68 61 73 68 2e 5c 6e 22 20 69 66 20 24 76 65 72 hash.\n" if $ver
16e0: 62 6f 73 65 3b 0a 20 20 20 20 7d 0a 20 20 20 20 bose;. }.
16f0: 65 6c 73 69 66 20 28 24 76 65 72 62 6f 73 65 29 elsif ($verbose)
1700: 20 7b 0a 20 20 20 20 20 20 20 20 70 72 69 6e 74 {. print
1710: 20 22 4d 75 73 74 20 67 65 6e 65 72 61 74 65 20 "Must generate
1720: 6d 69 73 73 69 6e 67 20 74 65 73 74 20 73 65 74 missing test set
1730: 20 24 68 61 73 68 2e 5c 6e 22 3b 0a 20 20 20 20 $hash.\n";.
1740: 7d 0a 0a 20 20 20 20 70 75 73 68 20 40 74 65 73 }.. push @tes
1750: 74 73 2c 20 24 74 65 73 74 3b 0a 0a 20 20 20 20 ts, $test;..
1760: 72 65 74 75 72 6e 3b 0a 7d 0a 0a 0a 23 23 23 23 return;.}...####
1770: 20 63 6f 6d 70 61 72 65 5f 72 6b 6c 7a 20 23 23 compare_rklz ##
1780: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1790: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
17a0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
17b0: 23 23 23 23 0a 23 20 43 6f 6d 70 61 72 65 20 74 ####.# Compare t
17c0: 77 6f 20 6c 7a 34 2d 63 6f 6d 70 72 65 73 73 65 wo lz4-compresse
17d0: 64 20 52 4b 30 35 20 64 69 73 6b 20 69 6d 61 67 d RK05 disk imag
17e0: 65 73 2c 20 72 65 74 75 72 6e 69 6e 67 20 74 72 es, returning tr
17f0: 75 65 20 69 66 20 74 68 65 79 0a 23 20 61 72 65 ue if they.# are
1800: 20 74 68 65 20 73 61 6d 65 2e 20 20 49 66 20 74 the same. If t
1810: 68 65 79 20 61 72 65 20 64 69 66 66 65 72 65 6e hey are differen
1820: 74 2c 20 61 6c 73 6f 20 6f 75 74 70 75 74 73 20 t, also outputs
1830: 61 20 62 69 6e 61 72 79 20 64 69 66 66 65 72 65 a binary differe
1840: 6e 63 65 0a 23 20 72 65 70 6f 72 74 2e 0a 23 0a nce.# report..#.
1850: 23 20 57 65 20 63 61 6c 6c 20 61 20 73 65 70 61 # We call a sepa
1860: 72 61 74 65 20 73 68 65 6c 6c 20 73 63 72 69 70 rate shell scrip
1870: 74 20 69 6e 73 74 65 61 64 20 6f 66 20 75 73 65 t instead of use
1880: 20 69 6e 6c 69 6e 65 20 73 68 65 6c 6c 20 63 6f inline shell co
1890: 64 65 20 68 65 72 65 0a 23 20 62 65 63 61 75 73 de here.# becaus
18a0: 65 20 74 68 65 20 68 65 6c 70 65 72 20 63 6f 64 e the helper cod
18b0: 65 20 75 73 65 73 20 61 20 42 61 73 68 20 66 65 e uses a Bash fe
18c0: 61 74 75 72 65 2c 20 61 6e 64 20 2f 62 69 6e 2f ature, and /bin/
18d0: 73 68 20 6d 69 67 68 74 20 6e 6f 74 20 62 65 0a sh might not be.
18e0: 23 20 62 61 73 68 2c 20 61 73 20 6f 6e 20 61 20 # bash, as on a
18f0: 52 61 73 70 62 69 61 6e 20 62 6f 78 2e 0a 0a 73 Raspbian box...s
1900: 75 62 20 63 6f 6d 70 61 72 65 5f 72 6b 6c 7a 0a ub compare_rklz.
1910: 7b 0a 20 20 20 20 6d 79 20 28 24 72 31 2c 20 24 {. my ($r1, $
1920: 72 32 29 20 3d 20 40 5f 3b 0a 20 20 20 20 72 65 r2) = @_;. re
1930: 74 75 72 6e 20 73 79 73 74 65 6d 28 22 24 63 6d turn system("$cm
1940: 70 6c 7a 20 27 24 72 31 27 20 27 24 72 32 27 22 plz '$r1' '$r2'"
1950: 29 20 3d 3d 20 30 3b 0a 7d 0a 0a 0a 23 23 23 23 ) == 0;.}...####
1960: 20 64 6f 5f 74 65 73 74 20 23 23 23 23 23 23 23 do_test #######
1970: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1980: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1990: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
19a0: 23 23 23 23 0a 23 20 54 65 73 74 20 61 20 73 69 ####.# Test a si
19b0: 6e 67 6c 65 20 70 65 72 6d 75 74 61 74 69 6f 6e ngle permutation
19c0: 0a 0a 73 75 62 20 64 6f 5f 74 65 73 74 0a 7b 0a ..sub do_test.{.
19d0: 20 20 20 20 23 20 53 65 74 20 75 70 20 77 6f 72 # Set up wor
19e0: 6b 69 6e 67 20 64 69 72 65 63 74 6f 72 79 0a 20 king directory.
19f0: 20 20 20 6d 79 20 24 74 65 73 74 20 3d 20 24 5f my $test = $_
1a00: 3b 0a 20 20 20 20 70 72 69 6e 74 20 22 43 6f 6e ;. print "Con
1a10: 66 69 67 75 72 69 6e 67 20 74 65 73 74 20 24 74 figuring test $t
1a20: 65 73 74 2d 3e 7b 6e 61 6d 65 7d 2c 20 50 49 44 est->{name}, PID
1a30: 20 24 50 49 44 2e 2e 2e 5c 6e 22 3b 0a 20 20 20 $PID...\n";.
1a40: 20 72 65 74 75 72 6e 20 69 66 20 24 64 72 79 5f return if $dry_
1a50: 72 75 6e 3b 0a 20 20 20 20 63 68 64 69 72 20 22 run;. chdir "
1a60: 74 65 73 74 2f 74 6d 70 22 20 6f 72 20 64 69 65 test/tmp" or die
1a70: 20 22 43 6f 75 6c 64 20 6e 6f 74 20 43 44 20 74 "Could not CD t
1a80: 6f 20 74 6d 70 20 64 69 72 3a 20 24 21 5c 6e 22 o tmp dir: $!\n"
1a90: 3b 0a 20 20 20 20 6d 6b 64 69 72 20 24 50 49 44 ;. mkdir $PID
1aa0: 3b 0a 20 20 20 20 63 68 64 69 72 20 24 50 49 44 ;. chdir $PID
1ab0: 3b 0a 20 20 20 20 64 69 65 20 22 43 6f 75 6c 64 ;. die "Could
1ac0: 20 6e 6f 74 20 6d 6b 64 69 72 20 24 74 65 73 74 not mkdir $test
1ad0: 2d 3e 7b 68 64 69 72 7d 3a 20 24 21 5c 6e 22 0a ->{hdir}: $!\n".
1ae0: 20 20 20 20 20 20 20 20 20 20 20 20 75 6e 6c 65 unle
1af0: 73 73 20 2d 64 20 24 74 65 73 74 2d 3e 7b 68 64 ss -d $test->{hd
1b00: 69 72 7d 20 7c 7c 20 6d 6b 64 69 72 28 24 74 65 ir} || mkdir($te
1b10: 73 74 2d 3e 7b 68 64 69 72 7d 29 3b 0a 0a 20 20 st->{hdir});..
1b20: 20 20 6d 79 20 24 63 75 72 72 64 73 6b 20 3d 20 my $currdsk =
1b30: 22 62 69 6e 2f 76 33 64 2e 72 6b 30 35 22 3b 0a "bin/v3d.rk05";.
1b40: 20 20 20 20 6d 79 20 24 63 75 72 72 64 6c 7a 20 my $currdlz
1b50: 3d 20 73 75 62 73 74 72 20 28 24 63 75 72 72 64 = substr ($currd
1b60: 73 6b 2c 20 30 2c 20 6c 65 6e 67 74 68 20 28 24 sk, 0, length ($
1b70: 63 75 72 72 64 73 6b 29 20 2d 20 32 29 20 2e 20 currdsk) - 2) .
1b80: 27 6c 7a 27 3b 0a 20 20 20 20 6d 79 20 24 74 61 'lz';. my $ta
1b90: 72 67 65 74 20 20 3d 20 27 6f 73 38 2d 73 79 73 rget = 'os8-sys
1ba0: 27 3b 0a 0a 20 20 20 20 23 20 43 6f 6e 66 69 67 ';.. # Config
1bb0: 75 72 65 20 74 68 65 20 74 65 73 74 20 64 69 73 ure the test dis
1bc0: 6b 20 69 6d 61 67 65 0a 20 20 20 20 73 79 73 74 k image. syst
1bd0: 65 6d 20 22 2e 2e 2f 2e 2e 2f 2e 2e 2f 63 6f 6e em "../../../con
1be0: 66 69 67 75 72 65 20 24 74 65 73 74 2d 3e 7b 6f figure $test->{o
1bf0: 70 74 73 74 72 7d 20 3e 20 63 66 67 2e 6c 6f 67 ptstr} > cfg.log
1c00: 20 32 3e 26 31 22 0a 20 20 20 20 20 20 20 20 20 2>&1".
1c10: 20 20 20 61 6e 64 20 64 69 65 20 22 46 61 69 6c and die "Fail
1c20: 65 64 20 74 6f 20 63 6f 6e 66 69 67 75 72 65 20 ed to configure
1c30: 24 74 65 73 74 2d 3e 7b 6e 61 6d 65 7d 21 5c 6e $test->{name}!\n
1c40: 22 3b 0a 20 20 20 20 23 20 57 65 20 75 73 65 64 ";. # We used
1c50: 20 74 6f 20 6c 69 6e 6b 20 62 69 6e 61 72 69 65 to link binarie
1c60: 73 20 68 65 72 65 2c 20 62 75 74 20 74 68 65 72 s here, but ther
1c70: 65 20 61 72 65 20 6d 6f 72 65 20 6e 6f 77 2e 0a e are more now..
1c80: 20 20 20 20 23 20 53 6f 20 6f 75 72 20 74 61 72 # So our tar
1c90: 67 65 74 2c 20 6f 73 38 2d 73 79 73 20 6e 6f 77 get, os8-sys now
1ca0: 20 69 6e 73 74 61 6c 6c 73 20 62 69 6e 61 72 69 installs binari
1cb0: 65 73 20 61 6e 64 20 6c 69 62 72 61 72 69 65 73 es and libraries
1cc0: 20 77 65 20 6e 65 65 64 2e 0a 20 20 20 20 6f 70 we need.. op
1cd0: 65 6e 20 6d 79 20 24 69 74 66 2c 20 27 3e 27 2c en my $itf, '>',
1ce0: 20 27 6d 65 64 69 61 2f 6f 73 38 2f 69 6e 69 74 'media/os8/init
1cf0: 2e 74 78 27 20 20 20 20 20 20 20 20 20 20 20 20 .tx'
1d00: 20 23 20 61 76 6f 69 64 20 61 20 70 6f 69 6e 74 # avoid a point
1d10: 6c 65 73 73 20 64 69 66 66 0a 20 20 20 20 20 20 less diff.
1d20: 20 20 20 20 20 20 6f 72 20 64 69 65 20 22 43 61 or die "Ca
1d30: 6e 6e 6f 74 20 6f 76 65 72 77 72 69 74 65 20 69 nnot overwrite i
1d40: 6e 69 74 2e 74 78 20 77 69 74 68 20 6e 65 75 74 nit.tx with neut
1d50: 72 61 6c 20 76 65 72 73 69 6f 6e 3a 20 24 21 5c ral version: $!\
1d60: 6e 22 3b 0a 20 20 20 20 70 72 69 6e 74 20 24 69 n";. print $i
1d70: 74 66 20 22 54 45 53 54 2d 4f 53 38 2d 52 55 4e tf "TEST-OS8-RUN
1d80: 20 42 55 49 4c 54 20 54 48 49 53 20 44 49 53 4b BUILT THIS DISK
1d90: 20 49 4d 41 47 45 2e 5c 6e 5c 6e 22 3b 0a 20 20 IMAGE.\n\n";.
1da0: 20 20 63 6c 6f 73 65 20 24 69 74 66 3b 0a 0a 20 close $itf;..
1db0: 20 20 20 23 20 42 75 69 6c 64 20 74 68 65 20 74 # Build the t
1dc0: 65 73 74 20 64 69 73 6b 20 69 6d 61 67 65 0a 20 est disk image.
1dd0: 20 20 20 70 72 69 6e 74 20 22 42 75 69 6c 64 69 print "Buildi
1de0: 6e 67 20 24 63 75 72 72 64 73 6b 20 66 6f 72 20 ng $currdsk for
1df0: 74 65 73 74 20 24 74 65 73 74 2d 3e 7b 6e 61 6d test $test->{nam
1e00: 65 7d 20 28 50 49 44 20 24 50 49 44 29 2e 2e 2e e} (PID $PID)...
1e10: 5c 6e 22 3b 0a 20 20 20 20 73 79 73 74 65 6d 20 \n";. system
1e20: 22 6d 61 6b 65 20 24 74 61 72 67 65 74 20 3e 20 "make $target >
1e30: 6d 61 6b 65 2e 6c 6f 67 20 32 3e 26 31 22 0a 20 make.log 2>&1".
1e40: 20 20 20 20 20 20 20 20 20 20 20 61 6e 64 20 64 and d
1e50: 69 65 20 22 46 61 69 6c 65 64 20 74 6f 20 62 75 ie "Failed to bu
1e60: 69 6c 64 20 24 63 75 72 72 64 73 6b 21 5c 6e 22 ild $currdsk!\n"
1e70: 3b 0a 0a 20 20 20 20 23 20 51 75 69 63 6b 6c 79 ;.. # Quickly
1e80: 20 63 6f 6d 70 72 65 73 73 20 74 68 65 20 74 65 compress the te
1e90: 73 74 20 64 69 73 6b 3a 20 77 65 20 64 6f 6e 27 st disk: we don'
1ea0: 74 20 77 61 6e 74 20 74 6f 20 73 74 6f 72 65 20 t want to store
1eb0: 61 6c 6c 20 74 68 65 0a 20 20 20 20 23 20 22 61 all the. # "a
1ec0: 69 72 22 20 69 6e 20 61 6e 20 52 4b 30 35 20 69 ir" in an RK05 i
1ed0: 6e 20 6f 75 72 20 74 65 73 74 20 63 6f 72 70 75 n our test corpu
1ee0: 73 2e 0a 20 20 20 20 73 79 73 74 65 6d 28 22 6c s.. system("l
1ef0: 7a 34 20 2d 71 20 24 63 75 72 72 64 73 6b 20 3e z4 -q $currdsk >
1f00: 20 24 63 75 72 72 64 6c 7a 22 29 3b 0a 0a 20 20 $currdlz");..
1f10: 20 20 69 66 20 28 6e 6f 74 20 2d 66 20 24 74 65 if (not -f $te
1f20: 73 74 2d 3e 7b 6c 6f 67 7d 20 6f 72 20 6e 6f 74 st->{log} or not
1f30: 20 2d 66 20 24 74 65 73 74 2d 3e 7b 72 6b 6c 7a -f $test->{rklz
1f40: 7d 29 20 7b 0a 20 20 20 20 20 20 20 20 23 20 54 }) {. # T
1f50: 68 69 73 20 74 65 73 74 20 68 61 73 6e 27 74 20 his test hasn't
1f60: 72 75 6e 20 68 65 72 65 20 79 65 74 2c 20 73 6f run here yet, so
1f70: 20 73 61 76 65 20 69 74 20 61 73 20 6f 75 72 20 save it as our
1f80: 65 78 65 6d 70 6c 61 72 20 66 6f 72 0a 20 20 20 exemplar for.
1f90: 20 20 20 20 20 23 20 74 68 69 73 20 6f 70 74 73 # this opts
1fa0: 74 72 2c 20 74 6f 20 62 65 20 63 6f 6d 70 61 72 tr, to be compar
1fb0: 65 64 20 74 6f 20 66 75 74 75 72 65 20 62 75 69 ed to future bui
1fc0: 6c 64 73 2e 0a 20 20 20 20 20 20 20 20 73 61 6e lds.. san
1fd0: 69 74 69 7a 65 5f 6c 6f 67 20 28 24 63 75 72 72 itize_log ($curr
1fe0: 6c 6f 67 2c 20 24 74 65 73 74 2d 3e 7b 6c 6f 67 log, $test->{log
1ff0: 7d 29 3b 0a 20 20 20 20 20 20 20 20 6d 6f 76 65 });. move
2000: 20 28 24 63 75 72 72 64 6c 7a 2c 20 24 74 65 73 ($currdlz, $tes
2010: 74 2d 3e 7b 72 6b 6c 7a 7d 29 3b 0a 0a 20 20 20 t->{rklz});..
2020: 20 20 20 20 20 23 20 4c 6f 67 20 74 68 65 20 6d # Log the m
2030: 61 70 70 69 6e 67 20 62 65 74 77 65 65 6e 20 74 apping between t
2040: 68 65 20 68 61 73 68 20 61 6e 64 20 74 68 65 20 he hash and the
2050: 6f 70 74 69 6f 6e 73 20 69 74 0a 20 20 20 20 20 options it.
2060: 20 20 20 23 20 72 65 70 72 65 73 65 6e 74 73 2c # represents,
2070: 20 73 6f 20 74 68 65 20 75 73 65 72 20 63 61 6e so the user can
2080: 20 72 65 76 65 72 73 65 20 69 74 2e 0a 20 20 20 reverse it..
2090: 20 20 20 20 20 70 72 69 6e 74 20 24 74 65 73 74 print $test
20a0: 73 5f 6d 66 20 22 24 74 65 73 74 2d 3e 7b 68 61 s_mf "$test->{ha
20b0: 73 68 7d 20 20 24 74 65 73 74 2d 3e 7b 6f 70 74 sh} $test->{opt
20c0: 73 74 72 7d 5c 6e 22 3b 0a 20 20 20 20 20 20 20 str}\n";.
20d0: 20 24 67 65 6e 65 72 61 74 65 64 7b 24 74 65 73 $generated{$tes
20e0: 74 2d 3e 7b 68 61 73 68 7d 7d 20 3d 20 31 3b 0a t->{hash}} = 1;.
20f0: 20 20 20 20 7d 0a 20 20 20 20 65 6c 73 69 66 20 }. elsif
2100: 28 63 6f 6d 70 61 72 65 5f 72 6b 6c 7a 20 28 24 (compare_rklz ($
2110: 63 75 72 72 64 6c 7a 2c 20 24 74 65 73 74 2d 3e currdlz, $test->
2120: 7b 72 6b 6c 7a 7d 29 29 20 7b 0a 20 20 20 20 20 {rklz})) {.
2130: 20 20 20 23 20 57 65 20 68 61 64 20 74 68 69 73 # We had this
2140: 20 74 65 73 74 20 65 78 61 6d 70 6c 61 72 20 68 test examplar h
2150: 65 72 65 20 61 6c 72 65 61 64 79 20 61 6e 64 20 ere already and
2160: 6f 6e 20 72 65 2d 64 6f 69 6e 67 20 69 74 20 77 on re-doing it w
2170: 65 0a 20 20 20 20 20 20 20 20 23 20 67 6f 74 20 e. # got
2180: 74 68 65 20 73 61 6d 65 20 72 65 73 75 6c 74 2e the same result.
2190: 0a 20 20 20 20 20 20 20 20 70 72 69 6e 74 20 63 . print c
21a0: 6f 6c 6f 72 65 64 28 5b 27 67 72 65 65 6e 27 5d olored(['green']
21b0: 2c 20 22 6d 6b 6f 73 38 20 24 74 65 73 74 2d 3e , "mkos8 $test->
21c0: 7b 6e 61 6d 65 7d 20 74 65 73 74 20 70 61 73 73 {name} test pass
21d0: 65 64 2e 22 29 2c 20 22 5c 6e 22 3b 0a 20 20 20 ed."), "\n";.
21e0: 20 20 20 20 20 24 74 65 73 74 65 64 7b 24 74 65 $tested{$te
21f0: 73 74 2d 3e 7b 68 61 73 68 7d 7d 20 3d 20 31 3b st->{hash}} = 1;
2200: 0a 20 20 20 20 7d 0a 20 20 20 20 65 6c 73 65 20 . }. else
2210: 7b 0a 20 20 20 20 20 20 20 20 23 20 54 68 69 73 {. # This
2220: 20 62 75 69 6c 64 20 72 65 73 75 6c 74 65 64 20 build resulted
2230: 69 6e 20 61 20 64 69 66 66 65 72 65 6e 63 65 2c in a difference,
2240: 20 73 6f 20 79 65 6c 6c 20 61 6e 64 20 73 61 76 so yell and sav
2250: 65 20 74 68 65 0a 20 20 20 20 20 20 20 20 23 20 e the. #
2260: 72 65 73 75 6c 74 73 20 66 6f 72 20 6d 61 6e 75 results for manu
2270: 61 6c 20 63 6f 6d 70 61 72 69 73 6f 6e 2e 0a 20 al comparison..
2280: 20 20 20 20 20 20 20 6d 79 20 24 66 64 69 66 66 my $fdiff
2290: 20 3d 20 22 24 74 65 73 74 2d 3e 7b 68 64 69 72 = "$test->{hdir
22a0: 7d 2f 66 61 69 6c 2e 64 69 66 66 22 3b 0a 20 20 }/fail.diff";.
22b0: 20 20 20 20 20 20 6d 79 20 24 66 61 69 6c 6c 6f my $faillo
22c0: 67 20 3d 20 22 24 74 65 73 74 2d 3e 7b 68 64 69 g = "$test->{hdi
22d0: 72 7d 2f 66 61 69 6c 2e 6c 6f 67 22 3b 0a 20 20 r}/fail.log";.
22e0: 20 20 20 20 20 20 73 61 6e 69 74 69 7a 65 5f 6c sanitize_l
22f0: 6f 67 20 28 24 63 75 72 72 6c 6f 67 2c 20 24 66 og ($currlog, $f
2300: 61 69 6c 6c 6f 67 29 3b 0a 20 20 20 20 20 20 20 aillog);.
2310: 20 6d 6f 76 65 20 28 24 63 75 72 72 64 6c 7a 2c move ($currdlz,
2320: 20 24 74 65 73 74 2d 3e 7b 68 64 69 72 7d 20 2e $test->{hdir} .
2330: 20 27 2f 66 61 69 6c 2e 72 6b 6c 7a 27 29 3b 0a '/fail.rklz');.
2340: 20 20 20 20 20 20 20 20 73 79 73 74 65 6d 20 22 system "
2350: 64 69 66 66 20 2d 77 75 20 24 74 65 73 74 2d 3e diff -wu $test->
2360: 7b 6c 6f 67 7d 20 24 66 61 69 6c 6c 6f 67 20 3e {log} $faillog >
2370: 20 24 66 64 69 66 66 22 3b 0a 20 20 20 20 20 20 $fdiff";.
2380: 20 20 70 72 69 6e 74 20 63 6f 6c 6f 72 65 64 28 print colored(
2390: 5b 27 62 6f 6c 64 20 72 65 64 27 5d 2c 20 27 52 ['bold red'], 'R
23a0: 45 53 55 4c 54 20 44 49 46 46 45 52 53 21 20 20 ESULT DIFFERS!
23b0: 53 65 65 20 74 65 73 74 2f 27 2c 0a 20 20 20 20 See test/',.
23c0: 20 20 20 20 20 20 20 20 20 20 20 20 73 75 62 73 subs
23d0: 74 72 28 24 66 64 69 66 66 2c 20 36 29 29 2c 20 tr($fdiff, 6)),
23e0: 22 5c 6e 22 3b 0a 20 20 20 20 20 20 20 20 24 74 "\n";. $t
23f0: 65 73 74 65 64 7b 24 74 65 73 74 2d 3e 7b 68 61 ested{$test->{ha
2400: 73 68 7d 7d 20 3d 20 30 3b 0a 20 20 20 20 7d 0a sh}} = 0;. }.
2410: 0a 20 20 20 20 73 79 73 74 65 6d 28 22 63 64 20 . system("cd
2420: 2e 2e 20 3b 20 72 6d 20 2d 66 72 20 24 50 49 44 .. ; rm -fr $PID
2430: 22 29 3b 20 20 20 20 20 20 23 20 2d 66 20 62 65 "); # -f be
2440: 63 61 75 73 65 20 74 68 65 72 65 20 61 72 65 20 cause there are
2450: 72 65 61 64 2d 6f 6e 6c 79 20 66 69 6c 65 73 0a read-only files.
2460: 0a 20 20 20 20 72 65 74 75 72 6e 3b 0a 7d 0a 0a . return;.}..
2470: 0a 23 23 23 23 20 72 65 6d 6f 76 65 5f 6d 69 73 .#### remove_mis
2480: 73 69 6e 67 20 23 23 23 23 23 23 23 23 23 23 23 sing ###########
2490: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
24a0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
24b0: 23 23 23 23 23 23 23 23 23 0a 23 20 49 6d 70 6c #########.# Impl
24c0: 65 6d 65 6e 74 73 20 2d 65 3a 20 67 69 76 65 6e ements -e: given
24d0: 20 61 20 6c 69 73 74 20 6f 66 20 6d 6b 6f 73 38 a list of mkos8
24e0: 20 6f 70 74 69 6f 6e 73 2c 20 72 65 74 75 72 6e options, return
24f0: 73 20 6f 6e 6c 79 20 74 68 6f 73 65 20 66 6f 72 s only those for
2500: 0a 23 20 77 68 69 63 68 20 77 65 20 68 61 76 65 .# which we have
2510: 20 61 20 76 61 6c 69 64 20 74 65 73 74 20 73 65 a valid test se
2520: 74 2e 0a 0a 73 75 62 20 72 65 6d 6f 76 65 5f 6d t...sub remove_m
2530: 69 73 73 69 6e 67 0a 7b 0a 20 20 20 20 6d 79 20 issing.{. my
2540: 28 40 74 65 73 74 73 29 20 3d 20 40 5f 3b 0a 20 (@tests) = @_;.
2550: 20 20 20 6d 79 20 24 61 6c 6c 20 3d 20 40 74 65 my $all = @te
2560: 73 74 73 3b 0a 0a 20 20 20 20 23 20 46 69 72 73 sts;.. # Firs
2570: 74 20 72 65 61 64 20 69 6e 20 74 68 65 20 73 65 t read in the se
2580: 74 20 6f 66 20 70 72 65 62 75 69 6c 74 20 74 65 t of prebuilt te
2590: 73 74 73 2c 20 66 69 6c 74 65 72 69 6e 67 20 6f sts, filtering o
25a0: 75 74 20 74 68 6f 73 65 20 74 68 61 74 0a 20 20 ut those that.
25b0: 20 20 23 20 72 65 66 65 72 20 74 6f 20 6f 75 74 # refer to out
25c0: 70 75 74 20 66 69 6c 65 73 20 74 68 61 74 20 64 put files that d
25d0: 6f 20 6e 6f 74 20 65 78 69 73 74 20 68 65 72 65 o not exist here
25e0: 2e 20 20 28 54 68 69 73 20 68 61 70 70 65 6e 73 . (This happens
25f0: 20 77 68 65 6e 0a 20 20 20 20 23 20 63 6f 70 79 when. # copy
2600: 69 6e 67 20 6f 76 65 72 20 74 68 65 20 6d 61 6e ing over the man
2610: 69 66 65 73 74 20 66 69 6c 65 20 62 75 74 20 6f ifest file but o
2620: 6e 6c 79 20 61 20 73 75 62 73 65 74 20 6f 66 20 nly a subset of
2630: 74 68 65 20 61 63 74 75 61 6c 0a 20 20 20 20 23 the actual. #
2640: 20 74 65 73 74 20 6f 75 74 70 75 74 20 66 69 6c test output fil
2650: 65 73 2e 29 0a 20 20 20 20 6d 79 20 25 65 78 69 es.). my %exi
2660: 73 74 69 6e 67 3b 0a 20 20 20 20 6d 79 20 24 67 sting;. my $g
2670: 65 6e 6e 65 64 20 3d 20 30 3b 0a 20 20 20 20 6d enned = 0;. m
2680: 79 20 24 6d 66 66 20 3d 20 27 74 65 73 74 2f 74 y $mff = 'test/t
2690: 65 73 74 73 2d 6d 61 6e 69 66 65 73 74 2e 74 78 ests-manifest.tx
26a0: 74 27 3b 0a 20 20 20 20 6f 70 65 6e 20 6d 79 20 t';. open my
26b0: 24 6d 66 2c 20 27 3c 27 2c 20 24 6d 66 66 20 6f $mf, '<', $mff o
26c0: 72 20 64 69 65 20 22 43 6f 75 6c 64 20 6e 6f 74 r die "Could not
26d0: 20 72 65 61 64 20 66 72 6f 6d 20 24 6d 66 66 3a read from $mff:
26e0: 20 24 21 5c 6e 22 3b 0a 20 20 20 20 77 68 69 6c $!\n";. whil
26f0: 65 20 28 3c 24 6d 66 3e 29 20 7b 0a 20 20 20 20 e (<$mf>) {.
2700: 20 20 20 20 63 68 6f 6d 70 3b 0a 20 20 20 20 20 chomp;.
2710: 20 20 20 6d 79 20 28 24 68 61 73 68 2c 20 40 6f my ($hash, @o
2720: 70 74 73 29 20 3d 20 73 70 6c 69 74 20 27 20 27 pts) = split ' '
2730: 3b 0a 20 20 20 20 20 20 20 20 6d 79 20 24 64 69 ;. my $di
2740: 72 20 3d 20 27 74 65 73 74 2f 27 20 2e 20 24 68 r = 'test/' . $h
2750: 61 73 68 3b 0a 20 20 20 20 20 20 20 20 69 66 20 ash;. if
2760: 28 2d 64 20 24 64 69 72 20 61 6e 64 20 2d 66 20 (-d $dir and -f
2770: 22 24 64 69 72 2f 6c 61 73 74 2e 72 6b 6c 7a 22 "$dir/last.rklz"
2780: 20 61 6e 64 20 2d 66 20 22 24 64 69 72 2f 6c 61 and -f "$dir/la
2790: 73 74 2e 6c 6f 67 22 29 20 7b 0a 20 20 20 20 20 st.log") {.
27a0: 20 20 20 20 20 20 20 24 65 78 69 73 74 69 6e 67 $existing
27b0: 7b 6a 6f 69 6e 20 27 20 27 2c 20 40 6f 70 74 73 {join ' ', @opts
27c0: 7d 20 3d 20 24 68 61 73 68 3b 0a 20 20 20 20 20 } = $hash;.
27d0: 20 20 20 7d 0a 20 20 20 20 20 20 20 20 2b 2b 24 }. ++$
27e0: 67 65 6e 6e 65 64 3b 0a 20 20 20 20 7d 0a 20 20 genned;. }.
27f0: 20 20 63 6c 6f 73 65 20 24 6d 66 3b 0a 0a 20 20 close $mf;..
2800: 20 20 23 20 4e 6f 77 20 66 69 6c 74 65 72 20 74 # Now filter t
2810: 68 65 20 74 65 73 74 20 73 65 74 20 74 6f 20 72 he test set to r
2820: 65 6d 6f 76 65 20 74 68 6f 73 65 20 74 68 61 74 emove those that
2830: 20 64 6f 20 6e 6f 74 20 65 78 69 73 74 0a 20 20 do not exist.
2840: 20 20 6d 79 20 40 66 69 6c 74 65 72 65 64 20 3d my @filtered =
2850: 20 67 72 65 70 20 7b 20 24 65 78 69 73 74 69 6e grep { $existin
2860: 67 7b 24 5f 2d 3e 7b 6f 70 74 73 74 72 7d 7d 20 g{$_->{optstr}}
2870: 7d 20 40 74 65 73 74 73 3b 0a 20 20 20 20 70 72 } @tests;. pr
2880: 69 6e 74 20 22 46 69 6c 74 65 72 65 64 20 24 67 int "Filtered $g
2890: 65 6e 6e 65 64 20 6f 66 20 24 61 6c 6c 20 74 65 enned of $all te
28a0: 73 74 73 20 64 6f 77 6e 20 74 6f 20 22 2c 20 73 sts down to ", s
28b0: 63 61 6c 61 72 28 40 66 69 6c 74 65 72 65 64 29 calar(@filtered)
28c0: 2c 0a 20 20 20 20 20 20 20 20 20 20 20 20 22 20 ,. "
28d0: 66 6f 72 20 2d 65 2e 5c 6e 22 3b 0a 20 20 20 20 for -e.\n";.
28e0: 72 65 74 75 72 6e 20 40 66 69 6c 74 65 72 65 64 return @filtered
28f0: 3b 0a 7d 0a 0a 0a 23 23 23 23 20 72 65 70 6f 72 ;.}...#### repor
2900: 74 2a 20 23 23 23 23 23 23 23 23 23 23 23 23 23 t* #############
2910: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2920: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2930: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 23 ##############.#
2940: 20 50 72 69 6e 74 20 6f 6e 2d 65 78 69 74 20 73 Print on-exit s
2950: 74 61 74 75 73 20 72 65 70 6f 72 74 2e 0a 0a 73 tatus report...s
2960: 75 62 20 72 65 70 6f 72 74 5f 70 61 72 74 0a 7b ub report_part.{
2970: 0a 20 20 20 20 6d 79 20 28 24 70 61 72 74 72 65 . my ($partre
2980: 66 2c 20 24 6b 69 6e 64 29 20 3d 20 40 5f 3b 0a f, $kind) = @_;.
2990: 0a 20 20 20 20 72 65 74 75 72 6e 20 75 6e 6c 65 . return unle
29a0: 73 73 20 6b 65 79 73 20 25 24 70 61 72 74 72 65 ss keys %$partre
29b0: 66 3b 0a 0a 20 20 20 20 6d 79 20 28 24 73 75 63 f;.. my ($suc
29c0: 63 65 73 73 65 73 2c 20 24 74 72 69 65 73 29 20 cesses, $tries)
29d0: 3d 20 28 30 2c 20 30 29 3b 0a 20 20 20 20 66 6f = (0, 0);. fo
29e0: 72 20 6d 79 20 24 73 20 28 76 61 6c 75 65 73 20 r my $s (values
29f0: 25 24 70 61 72 74 72 65 66 29 20 7b 0a 20 20 20 %$partref) {.
2a00: 20 20 20 20 20 2b 2b 24 74 72 69 65 73 3b 0a 20 ++$tries;.
2a10: 20 20 20 20 20 20 20 2b 2b 24 73 75 63 63 65 73 ++$succes
2a20: 73 65 73 20 69 66 20 24 73 3b 0a 20 20 20 20 7d ses if $s;. }
2a30: 0a 0a 20 20 20 20 6d 79 20 24 65 78 74 72 61 20 .. my $extra
2a40: 3d 20 24 73 75 63 63 65 73 73 65 73 20 3d 3d 20 = $successes ==
2a50: 24 74 72 69 65 73 20 3f 20 27 27 20 3a 20 22 20 $tries ? '' : "
2a60: 6f 66 20 24 74 72 69 65 73 22 3b 0a 20 20 20 20 of $tries";.
2a70: 70 72 69 6e 74 20 63 6f 6c 6f 72 65 64 20 28 5b print colored ([
2a80: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
2a90: 20 24 73 75 63 63 65 73 73 65 73 20 3d 3d 20 30 $successes == 0
2aa0: 20 3f 20 27 62 6f 6c 64 20 72 65 64 27 20 3a 0a ? 'bold red' :.
2ab0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2ac0: 20 20 20 20 24 73 75 63 63 65 73 73 65 73 20 21 $successes !
2ad0: 3d 20 24 74 72 69 65 73 20 3f 0a 20 20 20 20 20 = $tries ?.
2ae0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2af0: 20 20 20 27 62 6f 6c 64 20 79 65 6c 6c 6f 77 27 'bold yellow'
2b00: 20 3a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 :.
2b10: 20 20 20 20 20 20 20 20 20 20 20 27 67 72 65 65 'gree
2b20: 6e 27 0a 20 20 20 20 20 20 20 20 20 20 20 20 5d n'. ]
2b30: 2c 0a 20 20 20 20 20 20 20 20 20 20 20 20 22 53 ,. "S
2b40: 75 63 63 65 73 73 66 75 6c 6c 79 20 24 6b 69 6e uccessfully $kin
2b50: 64 20 24 73 75 63 63 65 73 73 65 73 24 65 78 74 d $successes$ext
2b60: 72 61 20 74 65 73 74 73 2e 5c 6e 22 29 3b 0a 7d ra tests.\n");.}
2b70: 0a 0a 73 75 62 20 72 65 70 6f 72 74 0a 7b 0a 20 ..sub report.{.
2b80: 20 20 20 70 72 69 6e 74 20 22 5c 6e 22 2c 20 27 print "\n", '
2b90: 3d 27 20 78 20 37 39 2c 20 22 5c 6e 22 3b 0a 20 =' x 79, "\n";.
2ba0: 20 20 20 72 65 70 6f 72 74 5f 70 61 72 74 20 28 report_part (
2bb0: 5c 25 67 65 6e 65 72 61 74 65 64 2c 20 27 67 65 \%generated, 'ge
2bc0: 6e 65 72 61 74 65 64 27 29 3b 0a 20 20 20 20 72 nerated');. r
2bd0: 65 70 6f 72 74 5f 70 61 72 74 20 28 5c 25 74 65 eport_part (\%te
2be0: 73 74 65 64 2c 20 20 20 20 27 62 75 69 6c 74 27 sted, 'built'
2bf0: 29 3b 0a 20 20 20 20 70 72 69 6e 74 20 22 5c 6e );. print "\n
2c00: 22 3b 0a 0a 20 20 20 20 72 65 74 75 72 6e 3b 0a ";.. return;.
2c10: 7d 0a 0a 0a 23 23 23 23 20 6d 61 69 6e 20 23 23 }...#### main ##
2c20: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2c30: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2c40: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2c50: 23 23 23 23 23 23 23 23 23 23 23 23 0a 0a 23 20 ############..#
2c60: 50 61 72 73 65 20 63 6f 6d 6d 61 6e 64 20 6c 69 Parse command li
2c70: 6e 65 0a 6d 79 20 25 63 6c 6f 70 74 73 3b 0a 67 ne.my %clopts;.g
2c80: 65 74 6f 70 74 73 28 27 65 67 6e 73 76 31 27 2c etopts('egnsv1',
2c90: 20 5c 25 63 6c 6f 70 74 73 29 20 6f 72 20 64 69 \%clopts) or di
2ca0: 65 20 22 46 61 69 6c 65 64 20 74 6f 20 70 61 72 e "Failed to par
2cb0: 73 65 20 63 6f 6d 6d 61 6e 64 20 6c 69 6e 65 21 se command line!
2cc0: 5c 6e 22 3b 0a 24 64 72 79 5f 72 75 6e 20 3d 20 \n";.$dry_run =
2cd0: 24 63 6c 6f 70 74 73 7b 6e 7d 3b 0a 24 65 78 69 $clopts{n};.$exi
2ce0: 73 74 69 6e 67 5f 6f 6e 6c 79 20 3d 20 24 63 6c sting_only = $cl
2cf0: 6f 70 74 73 7b 65 7d 3b 0a 24 67 65 6e 65 72 61 opts{e};.$genera
2d00: 74 65 5f 6f 6e 6c 79 20 3d 20 24 63 6c 6f 70 74 te_only = $clopt
2d10: 73 7b 67 7d 3b 0a 24 73 68 75 66 66 6c 65 20 3d s{g};.$shuffle =
2d20: 20 24 63 6c 6f 70 74 73 7b 73 7d 3b 0a 24 76 65 $clopts{s};.$ve
2d30: 72 62 6f 73 65 20 3d 20 24 63 6c 6f 70 74 73 7b rbose = $clopts{
2d40: 76 7d 3b 0a 24 73 69 6e 67 6c 65 5f 63 6f 72 65 v};.$single_core
2d50: 20 3d 20 24 63 6c 6f 70 74 73 7b 31 7d 3b 0a 0a = $clopts{1};..
2d60: 23 20 49 6e 69 74 20 67 6c 6f 62 61 6c 20 72 65 # Init global re
2d70: 73 6f 75 72 63 65 73 0a 6d 6b 64 69 72 20 27 74 sources.mkdir 't
2d80: 65 73 74 27 3b 0a 73 79 73 74 65 6d 28 22 72 6d est';.system("rm
2d90: 20 2d 72 66 20 74 65 73 74 2f 74 6d 70 22 29 3b -rf test/tmp");
2da0: 0a 6d 6b 64 69 72 20 27 74 65 73 74 2f 74 6d 70 .mkdir 'test/tmp
2db0: 27 3b 0a 6f 70 65 6e 20 24 74 65 73 74 73 5f 6d ';.open $tests_m
2dc0: 66 2c 20 27 3e 3e 27 2c 20 27 74 65 73 74 2f 74 f, '>>', 'test/t
2dd0: 65 73 74 73 2d 6d 61 6e 69 66 65 73 74 2e 74 78 ests-manifest.tx
2de0: 74 27 0a 20 20 20 20 20 20 20 20 6f 72 20 64 69 t'. or di
2df0: 65 20 22 43 61 6e 6e 6f 74 20 61 70 70 65 6e 64 e "Cannot append
2e00: 20 74 6f 20 74 65 73 74 20 6d 61 6e 69 66 65 73 to test manifes
2e10: 74 3a 20 24 21 5c 6e 22 3b 0a 24 53 49 47 7b 49 t: $!\n";.$SIG{I
2e20: 4e 54 7d 20 3d 20 24 53 49 47 7b 54 45 52 4d 7d NT} = $SIG{TERM}
2e30: 20 3d 20 73 75 62 20 7b 20 72 65 70 6f 72 74 3b = sub { report;
2e40: 20 65 78 69 74 20 31 20 7d 3b 0a 24 53 49 47 7b exit 1 };.$SIG{
2e50: 50 49 50 45 7d 20 3d 20 27 49 47 4e 4f 52 45 27 PIPE} = 'IGNORE'
2e60: 3b 0a 0a 23 20 47 65 74 20 61 6c 6c 20 63 75 72 ;..# Get all cur
2e70: 72 65 6e 74 20 2d 2d 2a 2d 6f 73 38 2d 2a 20 6f rent --*-os8-* o
2e80: 70 74 69 6f 6e 73 2c 20 66 69 6c 74 65 72 69 6e ptions, filterin
2e90: 67 20 6f 75 74 20 74 68 6f 73 65 20 77 65 20 6b g out those we k
2ea0: 6e 6f 77 20 73 68 6f 75 6c 64 0a 23 20 6e 6f 74 now should.# not
2eb0: 20 62 65 20 74 72 69 65 64 20 66 6f 72 20 74 68 be tried for th
2ec0: 69 73 3a 0a 23 0a 23 20 2a 20 20 20 4e 6f 20 2d is:.#.# * No -
2ed0: 2d 6f 73 38 2d 6d 69 6e 69 6d 61 6c 20 62 65 63 -os8-minimal bec
2ee0: 61 75 73 65 20 74 68 61 74 20 6a 75 73 74 20 74 ause that just t
2ef0: 75 72 6e 73 20 6f 6e 20 61 6c 6c 20 2d 2d 64 69 urns on all --di
2f00: 73 61 62 6c 65 2d 6f 73 38 2d 2a 20 0a 23 20 20 sable-os8-* .#
2f10: 20 20 20 6f 70 74 69 6f 6e 73 2c 20 73 6f 20 69 options, so i
2f20: 74 27 73 20 61 6c 72 65 61 64 79 20 63 6f 76 65 t's already cove
2f30: 72 65 64 2e 0a 23 20 2a 20 20 20 4e 6f 20 2d 2d red..# * No --
2f40: 64 69 73 61 62 6c 65 2d 6f 73 38 2d 73 72 63 20 disable-os8-src
2f50: 62 65 63 61 75 73 65 20 77 65 20 64 6f 6e 27 74 because we don't
2f60: 20 74 65 73 74 20 74 68 65 20 73 72 63 20 64 69 test the src di
2f70: 73 6b 3b 20 69 74 27 73 0a 23 20 20 20 20 20 61 sk; it's.# a
2f80: 6c 77 61 79 73 20 67 65 6e 65 72 61 74 65 64 20 lways generated
2f90: 74 68 65 20 73 61 6d 65 20 77 61 79 2e 0a 23 20 the same way..#
2fa0: 2a 20 20 20 4e 6f 20 2d 2d 64 69 73 61 62 6c 65 * No --disable
2fb0: 2d 6f 73 38 2d 66 6f 63 61 6c 20 62 65 63 61 75 -os8-focal becau
2fc0: 73 65 20 69 74 20 64 69 73 61 62 6c 65 73 20 74 se it disables t
2fd0: 68 65 20 6f 74 68 65 72 20 74 77 6f 20 46 4f 43 he other two FOC
2fe0: 41 4c 0a 23 20 20 20 20 20 6f 70 74 69 6f 6e 73 AL.# options
2ff0: 2c 20 77 68 69 63 68 20 77 65 27 72 65 20 61 6c , which we're al
3000: 72 65 61 64 79 20 67 6f 69 6e 67 20 74 6f 20 74 ready going to t
3010: 65 73 74 20 73 69 6e 67 6c 79 20 61 6e 64 20 74 est singly and t
3020: 6f 67 65 74 68 65 72 2e 0a 6d 79 20 40 63 6d 64 ogether..my @cmd
3030: 20 3d 20 28 0a 20 20 20 20 22 2e 2f 63 6f 6e 66 = (. "./conf
3040: 69 67 75 72 65 20 2d 2d 68 65 6c 70 22 2c 0a 20 igure --help",.
3050: 20 20 20 22 67 72 65 70 20 2d 2d 20 2d 6f 73 38 "grep -- -os8
3060: 2d 22 2c 0a 20 20 20 20 22 73 65 64 20 2d 45 65 -",. "sed -Ee
3070: 20 27 73 2f 5e 20 2b 2f 2f 27 22 2c 0a 20 20 20 's/^ +//'",.
3080: 20 22 63 75 74 20 2d 66 31 20 2d 64 27 20 27 22 "cut -f1 -d' '"
3090: 2c 0a 20 20 20 20 22 67 72 65 70 20 2d 76 20 2d ,. "grep -v -
30a0: 65 20 27 6f 73 38 2d 6d 69 6e 69 6d 61 6c 27 20 e 'os8-minimal'
30b0: 2d 65 20 27 6f 73 38 2d 73 72 63 27 20 2d 65 20 -e 'os8-src' -e
30c0: 27 6f 73 38 2d 66 6f 63 61 6c 5c 24 27 22 0a 29 'os8-focal\$'".)
30d0: 3b 0a 6f 70 65 6e 20 6d 79 20 24 6f 63 6d 64 2c ;.open my $ocmd,
30e0: 20 27 2d 7c 27 2c 20 6a 6f 69 6e 28 27 7c 27 2c '-|', join('|',
30f0: 20 40 63 6d 64 29 20 6f 72 20 64 69 65 20 22 46 @cmd) or die "F
3100: 61 69 6c 65 64 20 74 6f 20 67 65 74 20 6f 73 38 ailed to get os8
3110: 20 6f 70 74 69 6f 6e 20 73 65 74 3a 20 24 21 5c option set: $!\
3120: 6e 22 3b 0a 6d 79 20 40 63 66 67 4f 70 74 73 20 n";.my @cfgOpts
3130: 3d 20 3c 24 6f 63 6d 64 3e 3b 0a 63 6c 6f 73 65 = <$ocmd>;.close
3140: 20 24 6f 63 6d 64 3b 0a 63 68 6f 6d 70 20 40 63 $ocmd;.chomp @c
3150: 66 67 4f 70 74 73 3b 0a 0a 23 20 47 65 6e 65 72 fgOpts;..# Gener
3160: 61 74 65 20 61 6c 6c 20 70 6f 73 73 69 62 6c 65 ate all possible
3170: 20 70 65 72 6d 75 74 61 74 69 6f 6e 73 20 6f 66 permutations of
3180: 20 74 68 6f 73 65 20 6f 70 74 69 6f 6e 73 2e 20 those options.
3190: 20 53 68 75 66 66 6c 65 20 74 68 65 6d 20 69 66 Shuffle them if
31a0: 0a 23 20 72 65 71 75 65 73 74 65 64 2e 0a 73 75 .# requested..su
31b0: 62 73 65 74 73 20 5c 26 63 6f 6e 73 74 72 75 63 bsets \&construc
31c0: 74 5f 74 65 73 74 2c 20 40 63 66 67 4f 70 74 73 t_test, @cfgOpts
31d0: 3b 0a 40 74 65 73 74 73 20 3d 20 72 65 6d 6f 76 ;.@tests = remov
31e0: 65 5f 6d 69 73 73 69 6e 67 28 40 74 65 73 74 73 e_missing(@tests
31f0: 29 20 69 66 20 24 65 78 69 73 74 69 6e 67 5f 6f ) if $existing_o
3200: 6e 6c 79 3b 0a 40 74 65 73 74 73 20 3d 20 73 68 nly;.@tests = sh
3210: 75 66 66 6c 65 20 40 74 65 73 74 73 20 69 66 20 uffle @tests if
3220: 24 73 68 75 66 66 6c 65 3b 0a 0a 23 20 52 75 6e $shuffle;..# Run
3230: 20 74 68 65 20 74 65 73 74 73 0a 6d 79 20 24 74 the tests.my $t
3240: 64 69 72 20 3d 20 61 62 73 5f 70 61 74 68 28 64 dir = abs_path(d
3250: 69 72 6e 61 6d 65 28 24 30 29 29 3b 0a 6d 79 20 irname($0));.my
3260: 24 63 6f 72 65 73 20 3d 20 24 73 69 6e 67 6c 65 $cores = $single
3270: 5f 63 6f 72 65 20 3f 20 31 20 3a 20 69 6e 74 28 _core ? 1 : int(
3280: 60 24 74 64 69 72 2f 63 6f 72 65 63 6f 75 6e 74 `$tdir/corecount
3290: 60 29 3b 0a 6d 79 20 24 70 6c 20 3d 20 50 61 72 `);.my $pl = Par
32a0: 61 6c 6c 65 6c 3a 3a 4c 6f 6f 70 73 2d 3e 6e 65 allel::Loops->ne
32b0: 77 28 24 63 6f 72 65 73 29 3b 0a 24 70 6c 2d 3e w($cores);.$pl->
32c0: 73 68 61 72 65 20 28 5c 25 67 65 6e 65 72 61 74 share (\%generat
32d0: 65 64 2c 20 5c 25 74 65 73 74 65 64 29 3b 0a 24 ed, \%tested);.$
32e0: 70 6c 2d 3e 66 6f 72 65 61 63 68 20 28 20 5c 40 pl->foreach ( \@
32f0: 74 65 73 74 73 2c 20 5c 26 64 6f 5f 74 65 73 74 tests, \&do_test
3300: 29 3b 0a 0a 72 65 70 6f 72 74 3b 0a );..report;.