Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/protocol/synapse/board/tests/run.om # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / protocol / synapse / board / tests / run.om` 1515 lines ยท 25100 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 2 note tests/run.om: build synapse-board with tools/build.om, then run its positive and negative cases in a 3 note fresh directory (replaces tests/run.sh). README.md (Test) holds the one command that compiles it, 4 note from the repository root, with the pinned omc. 5 note usage: run OMEGA_SRC TEST_ROOT [--update-golden] (from the repository root) 6 note It first compiles the build driver from OMEGA_SRC/om/tls/sha2.om and tools/build.om into TEST_ROOT/bin/build 7 note (unit TEST_ROOT/build.unit.om, omc's messages TEST_ROOT/build.err), so a stale build/build is never used. 8 note TEST_ROOT must not exist yet; its parent must. It is created and left for inspection. 9 note --update-golden rewrites tests/golden from the fixture render (review the diff before committing). 10 note The live serve case runs only when this host has a local address inside 100.64.0.0/10 (read from 11 note /proc/net/fib_trie); otherwise it is NOT_RUN. It binds that address on port 18731 for one GET. 12 note Prints PASS, FAIL and NOT_RUN lines and a SUMMARY line. Exit 0 only if every case that ran passed; 13 note 1 when a case failed or the build failed; 64 usage or TEST_ROOT already exists. 14 15 text tuse "usage: run OMEGA_SRC TEST_ROOT [--update-golden] (from the synapse-board repository root)\n" 16 text texists "run: TEST_ROOT exists or cannot be created; give a new path\n" 17 text tupd "--update-golden" 18 text tunit "/build.unit.om" 19 text tbldb "/bin/build" 20 text tblde "/build.err" 21 text tsha2 "/om/tls/sha2.om" 22 text tbldom "tools/build.om" 23 text tomc "/seed/out/omc" 24 text tom2 "om2\n" 25 text tbin "/bin" 26 text tbinb "/bin/synapse-board" 27 text tfx "tests/fixtures/" 28 text tgd "tests/golden/" 29 text tout "/out.txt" 30 text terr "/err.txt" 31 text tsout "/serve.out" 32 text tserr "/serve.err" 33 text tr1 "/r1" 34 text tr2 "/r2" 35 text tr3 "/r3" 36 text tn1 "/n1" 37 text tn2 "/n2" 38 text tnope "/nope.jsonl" 39 text tbmd "/BOARD.md" 40 text tidx "/index.html" 41 text tfbmd "BOARD.md" 42 text tfidx "index.html" 43 text fcl "claims.jsonl" 44 text fmap "map.jsonl" 45 text ffind "findings.jsonl" 46 text fbcl "bad-claims.jsonl" 47 text fbmap "bad-map.jsonl" 48 text arender "render" 49 text aserve "serve" 50 text adelete "delete" 51 text aclaims "--claims" 52 text amap "--map" 53 text afind "--findings" 54 text aout "--out" 55 text anow "--now" 56 text ahead "--head" 57 text adir "--dir" 58 text abind "--bind" 59 text amax "--max" 60 text abogus "--bogus" 61 text a1 "1" 62 text vnow "2026-10-27T02:00:00Z" 63 text vhead "`0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef`" 64 text vbadnow "2026" 65 text vbadhead "XYZ" 66 text b0 "0.0.0.0:18731" 67 text b127 "127.0.0.1:18731" 68 text b128 "100.128.0.1:18731" 69 text b63 "100.63.255.255:18731" 70 text bnoport "100.64.0.1" 71 text bok "100.64.0.1:18731" 72 text wjson1 "{\"ok\":true,\"files\":2,\"active\":6,\"conflicts\":1,\"findings\":3,\"repos\":9,\"head\":\"" 73 text wjson2 "\"}" 74 text tpass "PASS " 75 text tfail "FAIL " 76 text tnotrun "NOT_RUN live serve (no 100.64.0.0/10 address on this host)\n" 77 text trc " (rc=" 78 text twant ", want " 79 text tclose ")" 80 text tnl "\n" 81 text tstderr " stderr: " 82 text tsum "SUMMARY pass=" 83 text tsumf " fail=" 84 text tsumn " not_run=" 85 text tnote "NOTE golden rewritten: " 86 text tkeep ": render output unreadable, golden kept\n" 87 text tnowr ": cannot write the golden in full\n" 88 text tfd " first difference at byte " 89 text tlg " (golden " 90 text tlr " bytes, rendered " 91 text tnot " not in " 92 text tdots ".." 93 text ton " on " 94 text tcolon ":" 95 text tsp " (" 96 text tplus " (+" 97 text tgot " got " 98 note case names 99 text nbuild "build" 100 text nrender "render-fixture" 101 text nrjson "render stdout json" 102 text ngold "golden " 103 text ntmp "no leftover .tmp" 104 text nupd "update-golden " 105 text nhs "html has no 0 590 while gt n 0 bound `9223372036854775807` 591 if ne get ga sub n 1 10 592 break 593 end 594 n = sub n 1 595 end 596 a = len wjson1 597 b = len vhead 598 if ne n add add a b len wjson2 599 ret false 600 end 601 for i ulong a 602 if ne get ga i get wjson1 i 603 ret false 604 end 605 end 606 for i ulong b 607 if ne get ga add a i get vhead i 608 ret false 609 end 610 end 611 for i ulong len wjson2 612 if ne get ga add add a b i get wjson2 i 613 ret false 614 end 615 end 616 ret true 617 end 618 note tmpleft: a directory entry of TEST_ROOT/r1 ends in .tmp (or the directory cannot be listed) 619 fn tmpleft to bool 620 pr tr1 621 note getdents64 records land in gde (host directory words take a sized array, not a run-time pool) 622 fd = openp 540672 0 623 if lt fd 0 624 ret true 625 end 626 for it ulong 999999 627 r = getdnts int fd gde 0 65536 628 if le r 0 629 c = fclose int fd 630 ret lt r 0 631 end 632 p = ulong 0 633 while lt p ulong r bound 65536 634 if tmpent p 635 c = fclose int fd 636 ret true 637 end 638 p = add p add ulong get gde add p 16 shl ulong get gde add p 17 8 639 end 640 end 641 c = fclose int fd 642 ret true 643 end 644 fn tmpent p ulong to bool 645 q = add p 19 646 n = ulong 0 647 while ne get gde add q n 0 bound 256 648 n = add n 1 649 end 650 k = len ktmp 651 if lt n k 652 ret false 653 end 654 for i ulong k 655 if ne get gde add q add sub n k i get ktmp i 656 ret false 657 end 658 end 659 ret true 660 end 661 note ogold: print the golden path of file w (0 BOARD.md, 1 index.html) 662 fn ogold w ulong to void 663 o tgd 664 if eq w 0 665 o tfbmd 666 else 667 o tfidx 668 end 669 end 670 note updgold: rewrite each golden from the fixture render; a golden is kept when the render cannot be read, 671 note and a write that cannot complete is a FAIL 672 fn updgold to void 673 for w ulong 2 674 pr tr1 675 if eq w 0 676 pt tbmd 677 else 678 pt tidx 679 end 680 r = load 0 681 if lt r 0 682 bad nupd 683 ogold w 684 o tkeep 685 continue 686 end 687 pclr 688 pt tgd 689 if eq w 0 690 pt tfbmd 691 else 692 pt tfidx 693 end 694 fd = openp 524865 420 695 if lt fd 0 696 bad nupd 697 ogold w 698 o tnowr 699 continue 700 end 701 full = wga int fd get gn 8 702 c = fclose int fd 703 if not full 704 bad nupd 705 ogold w 706 o tnowr 707 continue 708 end 709 o tnote 710 ogold w 711 onl 712 end 713 end 714 715 fn render1 to void 716 rfull tr1 717 expect nrender 0 718 pr tout 719 judge jsonok nrjson 720 end 721 fn golden to void 722 c = cmp2 tfbmd true 723 if c 724 ok ngold 725 else 726 bad ngold 727 end 728 o tfbmd 729 if not c 730 diffnote 731 end 732 onl 733 c = cmp2 tfidx true 734 if c 735 ok ngold 736 else 737 bad ngold 738 end 739 o tfidx 740 if not c 741 diffnote 742 end 743 onl 744 judge not tmpleft ntmp 745 end 746 note escaping: the fixture intent carries 747 fn escapes to void 748 pr3 tr1 tfidx 749 r = load 0 750 k = gt r 0 751 judge and k not has kscript true nhs 752 judge and k has kesc false nhe 753 judge and k not has kjs false njs 754 judge and k has ksafe false nsafe 755 judge and k not has kquo false nquo 756 judge and k not active nact 757 pr3 tr1 tfbmd 758 r = load 0 759 k = gt r 0 760 judge and k not has kscript true nms 761 judge and k has kesc false nme 762 judge and k has kpipe false npipe 763 judge and k has klapsed false nlap 764 judge and k has kinf false ninf 765 judge and k has kcycle false ncyc 766 end 767 note diffnote: after cmp2, where TEST_ROOT/r1/f (ga) and the golden (gb) first differ 768 fn diffnote to void 769 a = get gn 8 770 b = get gn 9 771 m = a 772 if lt b m 773 m = b 774 end 775 i = ulong 0 776 while lt i m bound `9223372036854775807` 777 if ne get ga i get gb i 778 break 779 end 780 i = add i 1 781 end 782 o tfd 783 onum i 784 o tlg 785 onum b 786 o tlr 787 onum a 788 o tclose 789 end 790 fn active to bool 791 if or has kscript true has kiframe true 792 ret true 793 end 794 if or has kobject true has kembed true 795 ret true 796 end 797 if or has klink true has kimg true 798 ret true 799 end 800 ret or has ksrc true has krefresh true 801 end 802 fn again to void 803 rfull tr2 804 expect nagain 0 805 rfull tr2 806 expect nover 0 807 c = and cmp2 tfbmd false cmp2 tfidx false 808 judge c ndet 809 end 810 811 note ======== clock: without --now the generated-by time is the current UTC second 812 note days: days since 1970-01-01 of a proleptic Gregorian date (days-from-civil) 813 fn days y ulong m ulong d ulong to ulong 814 yy = y 815 if le m 2 816 yy = sub yy 1 817 end 818 era = div yy 400 819 yoe = sub yy mul era 400 820 mm = add m 9 821 if gt m 2 822 mm = sub m 3 823 end 824 doy = add div add mul 153 mm 2 5 sub d 1 825 doe = add mul yoe 365 div yoe 4 826 doe = add sub doe div yoe 100 doy 827 era = mul era 146097 828 ret sub add era doe 719468 829 end 830 fn tsc c uchar to bool 831 ret or or and ge c 48 le c 57 or eq c 84 eq c 90 or eq c 58 eq c 45 832 end 833 note tsfind: copy into gts the [0-9TZ:-]* run between " at " and a "_" that ends a line of ga 834 fn tsfind to bool 835 n = get gn 8 836 for e ulong n 837 if eq get ga e 95 838 nl = true 839 if lt add e 1 n 840 nl = eq get ga add e 1 10 841 end 842 if nl 843 s = e 844 while gt s 0 bound `9223372036854775807` 845 if not tsc get ga sub s 1 846 break 847 end 848 s = sub s 1 849 end 850 if and ge s 4 lt sub e s 64 851 if attxt sub s 4 852 put gtl 0 sub e s 853 for i ulong sub e s 854 put gts i get ga add s i 855 end 856 ret true 857 end 858 end 859 end 860 end 861 end 862 ret false 863 end 864 fn attxt p ulong to bool 865 for i ulong 4 866 if ne get ga add p i get kat i 867 ret false 868 end 869 end 870 ret true 871 end 872 fn dig p ulong k ulong to ulong 873 v = ulong 0 874 for i ulong k 875 c = get gts add p i 876 if or lt c 48 gt c 57 877 ret `4294967296` 878 end 879 v = add mul v 10 ulong sub c 48 880 end 881 ret v 882 end 883 note tsval: gts as Unix seconds when it is YYYY-MM-DDTHH:MM:SSZ, else 0 884 fn tsval to ulong 885 if ne get gtl 0 20 886 ret 0 887 end 888 if or ne get gts 10 84 ne get gts 19 90 889 ret 0 890 end 891 y = dig 0 4 892 mo = dig 5 2 893 d = dig 8 2 894 h = dig 11 2 895 mi = dig 14 2 896 se = dig 17 2 897 if or gt y 9999 or gt mo 12 lt mo 1 898 ret 0 899 end 900 if or gt d 31 lt d 1 901 ret 0 902 end 903 if or gt h 23 or gt mi 59 gt se 60 904 ret 0 905 end 906 t = days y mo d 907 t = add mul t 24 h 908 t = add mul t 60 mi 909 ret add mul t 60 se 910 end 911 fn clock to void 912 put gn 12 div ulong realns `1000000000` 913 rbase 914 ka aout 915 ar tr3 916 expect nclock 0 917 put gn 13 div ulong realns `1000000000` 918 pr3 tr3 tfbmd 919 r = load 0 920 put gtl 0 0 921 f = tsfind 922 tv = tsval 923 c = and ge tv get gn 12 le tv get gn 13 924 if c 925 ok nciso 926 o tsp 927 else 928 bad nciso 929 o tsp 930 end 931 r = write 1 gts 0 get gtl 0 932 if not c 933 o tnot 934 onum get gn 12 935 o tdots 936 onum get gn 13 937 end 938 o tclose 939 onl 940 judge has khu false nhu 941 judge has knone false nnone 942 end 943 944 note ======== negative cases 945 fn neg1 to void 946 cmdmiss 0 947 expect nmc 4 948 cmdmiss 1 949 expect nmm 4 950 rbase 951 ka afind 952 ar tnope 953 ka aout 954 ar tn2 955 expect nmf 0 956 cmd 957 ka arender 958 ka aclaims 959 af fbcl 960 ka amap 961 af fmap 962 ka aout 963 ar tn1 964 expect nbc 65 965 pr terr 966 r = load 0 967 judge has kc2 false nbc2 968 cmd 969 ka arender 970 ka aclaims 971 af fcl 972 ka amap 973 af fbmap 974 ka aout 975 ar tn1 976 expect nbm 65 977 pr3 tn1 tfbmd 978 fd = openp 524288 0 979 if ge fd 0 980 c = fclose int fd 981 end 982 judge lt fd 0 nnw 983 end 984 note cmdmiss: render with a missing claims file (w 0) or map file (w 1), out TEST_ROOT/n1 985 fn cmdmiss w ulong to void 986 cmd 987 ka arender 988 ka aclaims 989 if eq w 0 990 ar tnope 991 else 992 af fcl 993 end 994 ka amap 995 if eq w 1 996 ar tnope 997 else 998 af fmap 999 end 1000 ka aout 1001 ar tn1 1002 end 1003 fn neg2 to void 1004 rbase 1005 expect nno 64 1006 rn1 1007 ka anow 1008 ka vbadnow 1009 expect nbn 64 1010 rn1 1011 ka ahead 1012 ka vbadhead 1013 expect nbh 64 1014 rn1 1015 ka abogus 1016 ka a1 1017 expect nuf 64 1018 cmd 1019 ka arender 1020 ka aclaims 1021 af fcl 1022 ka aclaims 1023 af fcl 1024 ka amap 1025 af fmap 1026 ka aout 1027 ar tn1 1028 expect ndf 64 1029 cmd 1030 expect nnc 64 1031 cmd 1032 ka adelete 1033 ka aout 1034 ar tn1 1035 expect nbcmd 64 1036 end 1037 fn rn1 to void 1038 rbase 1039 ka aout 1040 ar tn1 1041 end 1042 note sv: serve --dir TEST_ROOT/r1 --bind b --max 1 1043 fn sv b view uchar * to void 1044 cmd 1045 ka aserve 1046 ka adir 1047 ar tr1 1048 ka abind 1049 ka b 1050 ka amax 1051 ka a1 1052 end 1053 fn neg3 to void 1054 sv b0 1055 expect ns0 64 1056 sv b127 1057 expect ns127 64 1058 sv b128 1059 expect ns128 64 1060 sv b63 1061 expect ns63 64 1062 sv bnoport 1063 expect nsnp 64 1064 cmd 1065 ka aserve 1066 ka abind 1067 ka bok 1068 ka amax 1069 ka a1 1070 expect nsnd 64 1071 cmd 1072 ka aserve 1073 ka adir 1074 ar tr1 1075 ka abind 1076 ka bok 1077 ka aout 1078 ar tr1 1079 expect nsrf 64 1080 end 1081 1082 note ======== live serve on this host's tailnet address (GET only, read-only, one connection) 1083 note octet: the decimal at ga[p..), with its end in gn 14; 256 when absent or out of range 1084 fn octet p ulong to ulong 1085 v = ulong 0 1086 n = ulong 0 1087 while lt add p n get gn 8 bound 4 1088 c = get ga add p n 1089 if or lt c 48 gt c 57 1090 break 1091 end 1092 v = add mul v 10 ulong sub c 48 1093 n = add n 1 1094 end 1095 put gn 14 add p n 1096 if or eq n 0 gt v 255 1097 ret 256 1098 end 1099 ret v 1100 end 1101 note addrat: the dotted address at ga[p..) in host order, or 0 when it is not one 1102 fn addrat p ulong to ulong 1103 a = ulong 0 1104 q = p 1105 for i ulong 4 1106 v = octet q 1107 if eq v 256 1108 ret 0 1109 end 1110 a = add shl a 8 v 1111 q = get gn 14 1112 if lt i 3 1113 if or ge q get gn 8 ne get ga q 46 1114 ret 0 1115 end 1116 q = add q 1 1117 end 1118 end 1119 ret a 1120 end 1121 fn at2 p ulong t view uchar * to bool 1122 if gt add p len t get gn 8 1123 ret false 1124 end 1125 for i ulong len t 1126 if ne get ga add p i get t i 1127 ret false 1128 end 1129 end 1130 ret true 1131 end 1132 note tailnet: the first local /32 inside 100.64.0.0/10 in /proc/net/fib_trie, or 0 1133 fn tailnet to ulong 1134 pclr 1135 pt kfib 1136 r = load 0 1137 if lt r 0 1138 ret 0 1139 end 1140 last = ulong 0 1141 for p ulong get gn 8 1142 if at2 p kdash 1143 last = addrat add p len kdash 1144 end 1145 if at2 p kloc 1146 if eq and last `4290772992` `1681915904` 1147 ret last 1148 end 1149 end 1150 end 1151 ret 0 1152 end 1153 note paddr: append the dotted form of gn 11 and ":18731" to gp 1154 fn pnum v ulong to void 1155 if ge v 100 1156 pc uchar add div v 100 48 1157 end 1158 if ge v 10 1159 pc uchar add rem div v 10 10 48 1160 end 1161 pc uchar add rem v 10 48 1162 end 1163 fn paddr to void 1164 a = get gn 11 1165 pnum shr a 24 1166 pc 46 1167 pnum and shr a 16 255 1168 pc 46 1169 pnum and shr a 8 255 1170 pc 46 1171 pnum and a 255 1172 end 1173 fn pport to void 1174 pc 58 1175 pnum 187 1176 pnum 31 1177 end 1178 note serving: TEST_ROOT/serve.out shows the server is up 1179 fn serving to bool 1180 pr tsout 1181 r = load 0 1182 if lt r 0 1183 ret false 1184 end 1185 ret has kserving false 1186 end 1187 note get: one GET / to the tailnet address; status into gn 15 and the body into gb from offset 0 1188 fn sendreq fd int to bool 1189 pclr 1190 pt kget1 1191 crlf 1192 pt khost 1193 paddr 1194 pport 1195 crlf 1196 pt kget2 1197 crlf 1198 crlf 1199 w = send fd gp 0 get gn 2 0 1200 ret eq w long get gn 2 1201 end 1202 fn crlf to void 1203 pc 13 1204 pc 10 1205 end 1206 fn httpget to void 1207 put gn 15 0 1208 put gn 9 0 1209 fd = socknew 2 1 0 1210 if lt fd 0 1211 ret 1212 end 1213 sa = new uchar 16 0 1214 put sa 0 2 1215 put sa 2 uchar 73 1216 put sa 3 uchar 43 1217 a = get gn 11 1218 put sa 4 uchar shr a 24 1219 put sa 5 uchar and shr a 16 255 1220 put sa 6 uchar and shr a 8 255 1221 put sa 7 uchar and a 255 1222 r = connect int fd sa 0 16 1223 if or lt r 0 not sendreq int fd 1224 c = fclose int fd 1225 ret 1226 end 1227 recvall int fd 1228 c = fclose int fd 1229 parse 1230 end 1231 fn recvall fd int to void 1232 p = ulong 0 1233 for it ulong 999999 1234 if not growp 1 add p 65536 1235 ret 1236 end 1237 w = waitio fd 1 `5000000000` 1238 if le w 0 1239 ret 1240 end 1241 r = recv fd gde 0 65536 0 1242 if le r 0 1243 put gn 9 p 1244 ret 1245 end 1246 for i ulong ulong r 1247 put gb add p i get gde i 1248 end 1249 p = add p ulong r 1250 put gn 9 p 1251 end 1252 end 1253 note parse: status code of gb's response into gn 15; the body moved to the front of gb, its length gn 9 1254 fn parse to void 1255 n = get gn 9 1256 if lt n 12 1257 ret 1258 end 1259 s = ulong 0 1260 for i ulong 3 1261 c = get gb add 9 i 1262 if or lt c 48 gt c 57 1263 ret 1264 end 1265 s = add mul s 10 ulong sub c 48 1266 end 1267 put gn 15 s 1268 for i ulong sub n 3 1269 if hdrend i 1270 b = add i 4 1271 for j ulong sub n b 1272 put gb j get gb add b j 1273 end 1274 put gn 9 sub n b 1275 ret 1276 end 1277 end 1278 put gn 15 0 1279 end 1280 fn hdrend i ulong to bool 1281 if or ne get gb i 13 ne get gb add i 1 10 1282 ret false 1283 end 1284 ret and eq get gb add i 2 13 eq get gb add i 3 10 1285 end 1286 fn live to void 1287 a = tailnet 1288 if eq a 0 1289 put gn 6 add get gn 6 1 1290 o tnotrun 1291 ret 1292 end 1293 put gn 11 a 1294 k0 1295 pr tbinb 1296 kp 1297 ka aserve 1298 ka adir 1299 ar tr1 1300 ka abind 1301 pclr 1302 paddr 1303 pport 1304 kp 1305 ka amax 1306 ka a1 1307 put gn 7 2 1308 pid = spawn 1309 if lt pid 0 1310 bad nsexit 1311 onl 1312 ret 1313 end 1314 for i ulong 50 1315 if serving 1316 break 1317 end 1318 s = sleepns `100000000` 1319 end 1320 httpget 1321 livewait pid 1322 liveres 1323 end 1324 fn livewait pid long to void 1325 e = long -1 1326 for i ulong 50 1327 e = reap pid 1 1328 if ge e 0 1329 break 1330 end 1331 s = sleepns `100000000` 1332 end 1333 if ge e 0 1334 ok nsexit 1335 onl 1336 ret 1337 end 1338 k = killpid int pid 9 1339 e = reap pid 0 1340 bad nsexit 1341 onl 1342 end 1343 fn liveres to void 1344 pr3 tr1 tfidx 1345 r = load 0 1346 c = and eq get gn 15 200 sameab 1347 if c 1348 ok nlive 1349 o ton 1350 pclr 1351 paddr 1352 pport 1353 w = write 1 gp 0 get gn 2 1354 else 1355 bad nlive 1356 o tsp 1357 onum get gn 15 1358 o tclose 1359 end 1360 onl 1361 end 1362 1363 note ======== main 1364 note posrc: append OMEGA_SRC to gp 1365 fn posrc to void 1366 for i ulong get gn 1 1367 pc get gosrc i 1368 end 1369 end 1370 note wga: write ga[0..n) to fd in full 1371 fn wga fd int n ulong to bool 1372 p = ulong 0 1373 while lt p n bound `9223372036854775807` 1374 w = write fd ga p sub n p 1375 if le w 0 1376 ret false 1377 end 1378 p = add p ulong w 1379 end 1380 ret true 1381 end 1382 note catto: append the file named by gp to fd 1383 fn catto fd int to bool 1384 r = load 0 1385 if lt r 0 1386 ret false 1387 end 1388 ret wga fd get gn 8 1389 end 1390 note mkdriver: compose om2 + OMEGA_SRC/om/tls/sha2.om + tools/build.om into TEST_ROOT/build.unit.om and 1391 note compile it with OMEGA_SRC's omc into TEST_ROOT/bin/build (omc's messages in TEST_ROOT/build.err), so 1392 note the build driver is always the one in this tree, never a stale build/build 1393 fn mkdriver to bool 1394 pr tunit 1395 fd = openp 524865 420 1396 if lt fd 0 1397 ret false 1398 end 1399 w = write int fd tom2 0 len tom2 1400 okw = eq w 4 1401 pclr 1402 posrc 1403 pt tsha2 1404 ok1 = catto int fd 1405 pclr 1406 pt tbldom 1407 ok2 = catto int fd 1408 c = fclose int fd 1409 if not and okw and ok1 ok2 1410 ret false 1411 end 1412 k0 1413 pclr 1414 posrc 1415 pt tomc 1416 kp 1417 put gn 7 3 1418 rc = runk 1419 ret eq rc 0 1420 end 1421 fn build to bool 1422 if not mkdriver 1423 ret false 1424 end 1425 k0 1426 pr tbldb 1427 kp 1428 pclr 1429 posrc 1430 kp 1431 pr tbinb 1432 kp 1433 put gn 7 0 1434 rc = runk 1435 ret eq rc 0 1436 end 1437 fn summary to int 1438 o tsum 1439 onum get gn 4 1440 o tsumf 1441 onum get gn 5 1442 o tsumn 1443 onum get gn 6 1444 onl 1445 if eq get gn 5 0 1446 ret 0 1447 end 1448 ret 1 1449 end 1450 fn setup to bool 1451 pr tbin 1452 n = get gn 0 1453 r = makedir groot 0 n 493 1454 if lt r 0 1455 ret false 1456 end 1457 r = makedir gp 0 get gn 2 493 1458 ret ge r 0 1459 end 1460 fn main to int 1461 na = argcnt 1462 if or lt na 3 gt na 4 1463 r = write 2 tuse 0 len tuse 1464 ret 64 1465 end 1466 n = argread 1 gosrc 0 4096 1467 m = argread 2 groot 0 4096 1468 if or lt n 1 lt m 1 1469 r = write 2 tuse 0 len tuse 1470 ret 64 1471 end 1472 put gn 1 ulong n 1473 put gn 0 ulong m 1474 upd = false 1475 if eq na 4 1476 k = argread 3 gp 0 64 1477 upd = and eq k long len tupd at2gp 1478 if not upd 1479 r = write 2 tuse 0 len tuse 1480 ret 64 1481 end 1482 end 1483 if not setup 1484 r = write 2 texists 0 len texists 1485 ret 64 1486 end 1487 if not build 1488 bad nbuild 1489 onl 1490 ret 1 1491 end 1492 ok nbuild 1493 onl 1494 render1 1495 if upd 1496 updgold 1497 end 1498 golden 1499 escapes 1500 again 1501 clock 1502 neg1 1503 neg2 1504 neg3 1505 live 1506 ret summary 1507 end 1508 fn at2gp to bool 1509 for i ulong len tupd 1510 if ne get gp i get tupd i 1511 ret false 1512 end 1513 end 1514 ret true 1515 end