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/si/benchmarks/verify/test.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 / si / benchmarks / verify / test.om` 225 lines ยท 6319 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 2 note si/benchmarks/verify/test.om: positive & negative control test suite for 3 note benchmarks-mv bundle validator, MEASURED vs MODELED discriminator, and ceiling comparator. 4 note Compose with: 5 note si/directives/om2.om om/tls/sha2.om si/benchmarks/verify/bundle.om si/benchmarks/verify/test.om 6 7 text t_pass "PASS " 8 text t_fail "FAIL " 9 text t_nl "\n" 10 11 text t_c1 "evidence_class_label_parsing_positive_and_negative" 12 text t_c2 "measured_vs_modeled_anti_laundering_discriminator" 13 text t_c3 "qualification_gate_refuses_modeled_and_estimated" 14 text t_c4 "quantile_monotonicity_and_negative_controls" 15 text t_c5 "bundle_metadata_sha_samples_and_throughput_controls" 16 text t_c6 "hardware_ceiling_and_regression_basis_point_comparator" 17 text t_c7 "bundle_digest_determinism_and_tamper_sensitivity" 18 text t_done "PASS benchmarks-verify all 7 test suites passed\n" 19 20 text t_lbl_m "MEASURED" 21 text t_lbl_mod "MODELED" 22 text t_lbl_est "ESTIMATED" 23 text t_lbl_syn "SYNTHETIC" 24 text t_lbl_bad "MEASURED_EST" 25 26 text t_sha40_ok "`3a9fe6de80123456789abcdef0123456789abcde`" 27 text t_sha40_bad "`3a9fe6de`" 28 text t_sha64_ok "`34d611ca0415eab1728d3234911d90e74af17ba9ab0c581d559f48274d7ca6d3`" 29 text t_sha64_bad "bad" 30 31 fn report_case name view uchar * ok bool to int 32 if ok 33 w1 = bm_write_all int 1 t_pass 34 w2 = bm_write_all int 1 name 35 w3 = bm_write_all int 1 t_nl 36 if and w1 and w2 w3 37 ret int 0 38 end 39 ret int 1 40 end 41 w4 = bm_write_all int 1 t_fail 42 w5 = bm_write_all int 1 name 43 w6 = bm_write_all int 1 t_nl 44 if and w4 and w5 w6 45 ret int 1 46 end 47 ret int 1 48 end 49 50 fn test_class_labels to bool 51 if ne bm_parse_class t_lbl_m BM_CLASS_MEASURED 52 ret false 53 end 54 if ne bm_parse_class t_lbl_mod BM_CLASS_MODELED 55 ret false 56 end 57 if ne bm_parse_class t_lbl_est BM_CLASS_ESTIMATED 58 ret false 59 end 60 if ne bm_parse_class t_lbl_syn BM_CLASS_SYNTHETIC 61 ret false 62 end 63 note Negative control: ambiguous hybrid label rejected 64 if ne bm_parse_class t_lbl_bad ulong 0 65 ret false 66 end 67 ret true 68 end 69 70 fn test_discriminator to bool 71 note Clean hardware-measured run with 100 samples passes 72 if ne bm_discriminate_class BM_CLASS_MEASURED ulong 100 true false false BM_OK 73 ret false 74 end 75 note MODELED run with extrapolated=true is allowed as MODELED 76 if ne bm_discriminate_class BM_CLASS_MODELED ulong 0 false false true BM_OK 77 ret false 78 end 79 note Negative controls: extrapolated or missing HW receipt labeled MEASURED MUST be refused 80 if ne bm_discriminate_class BM_CLASS_MEASURED ulong 100 true false true BM_ERR_MODELED_AS_MEASURED 81 ret false 82 end 83 if ne bm_discriminate_class BM_CLASS_MEASURED ulong 100 false false false BM_ERR_MODELED_AS_MEASURED 84 ret false 85 end 86 if ne bm_discriminate_class BM_CLASS_MEASURED ulong 100 true true false BM_ERR_DIRTY_TREE 87 ret false 88 end 89 if ne bm_discriminate_class BM_CLASS_MEASURED ulong 0 true false false BM_ERR_TOO_FEW_SAMPLES 90 ret false 91 end 92 ret true 93 end 94 95 fn test_qualification_gate to bool 96 if ne bm_allow_qualification BM_CLASS_MEASURED BM_OK 97 ret false 98 end 99 if ne bm_allow_qualification BM_CLASS_MODELED BM_ERR_NOT_MEASURED 100 ret false 101 end 102 if ne bm_allow_qualification BM_CLASS_ESTIMATED BM_ERR_NOT_MEASURED 103 ret false 104 end 105 if ne bm_allow_qualification BM_CLASS_SYNTHETIC BM_ERR_NOT_MEASURED 106 ret false 107 end 108 ret true 109 end 110 111 fn test_quantiles to bool 112 if ne bm_validate_quantiles ulong 100 ulong 120 ulong 150 ulong 180 ulong 210 BM_OK 113 ret false 114 end 115 note Negative controls: zero min, p50 < min, p95 < p50, p99 < p95, max < p99 116 if ne bm_validate_quantiles ulong 0 ulong 120 ulong 150 ulong 180 ulong 210 BM_ERR_NONMONOTONIC_Q 117 ret false 118 end 119 if ne bm_validate_quantiles ulong 130 ulong 120 ulong 150 ulong 180 ulong 210 BM_ERR_NONMONOTONIC_Q 120 ret false 121 end 122 if ne bm_validate_quantiles ulong 100 ulong 160 ulong 150 ulong 180 ulong 210 BM_ERR_NONMONOTONIC_Q 123 ret false 124 end 125 if ne bm_validate_quantiles ulong 100 ulong 120 ulong 190 ulong 180 ulong 210 BM_ERR_NONMONOTONIC_Q 126 ret false 127 end 128 if ne bm_validate_quantiles ulong 100 ulong 120 ulong 150 ulong 220 ulong 210 BM_ERR_NONMONOTONIC_Q 129 ret false 130 end 131 ret true 132 end 133 134 fn test_bundle_meta to bool 135 if ne bm_validate_bundle_shas t_sha40_ok t_sha64_ok BM_OK 136 ret false 137 end 138 if ne bm_validate_bundle_counts ulong 50 ulong 30 ulong 1200 BM_OK 139 ret false 140 end 141 if ne bm_validate_bundle_shas t_sha40_bad t_sha64_ok BM_ERR_BAD_SHA 142 ret false 143 end 144 if ne bm_validate_bundle_shas t_sha40_ok t_sha64_bad BM_ERR_BAD_SHA 145 ret false 146 end 147 if ne bm_validate_bundle_counts ulong 10 ulong 30 ulong 1200 BM_ERR_TOO_FEW_SAMPLES 148 ret false 149 end 150 if ne bm_validate_bundle_counts ulong 50 ulong 30 ulong 0 BM_ERR_ZERO_THROUGHPUT 151 ret false 152 end 153 ret true 154 end 155 156 fn test_ceiling_and_regression to bool 157 note Ceiling check: 240 GB/s <= 273 GB/s passes; 300 GB/s > 273 GB/s refused 158 if ne bm_check_ceiling ulong 240 ulong 273 BM_OK 159 ret false 160 end 161 if ne bm_check_ceiling ulong 300 ulong 273 BM_ERR_EXCEEDS_CEILING 162 ret false 163 end 164 if ne bm_check_ceiling ulong 100 ulong 0 BM_ERR_EXCEEDS_CEILING 165 ret false 166 end 167 note Regression check: 500 bps (5%) budget on baseline 1000us -> 1050us passes, 1051us refused 168 if ne bm_check_latency_regression ulong 1000 ulong 1050 ulong 500 BM_OK 169 ret false 170 end 171 if ne bm_check_latency_regression ulong 1000 ulong 1051 ulong 500 BM_ERR_REGRESSION 172 ret false 173 end 174 if ne bm_check_latency_regression ulong 0 ulong 100 ulong 500 BM_ERR_ZERO_BASELINE 175 ret false 176 end 177 note Throughput floor check 178 if ne bm_check_throughput_floor ulong 1000 ulong 950 BM_OK 179 ret false 180 end 181 if ne bm_check_throughput_floor ulong 949 ulong 950 BM_ERR_BELOW_FLOOR 182 ret false 183 end 184 ret true 185 end 186 187 fn test_bundle_digest to bool 188 m = new ulong 4 0 189 put m 0 BM_CLASS_MEASURED 190 put m 1 ulong 100 191 put m 2 ulong 120 192 put m 3 ulong 180 193 d1 = new uchar 32 0 194 d2 = new uchar 32 0 195 bm_bundle_digest m t_sha40_ok d1 196 bm_bundle_digest m t_sha40_ok d2 197 if not bm_digest_eq d1 d2 198 ret false 199 end 200 put m 0 BM_CLASS_MODELED 201 bm_bundle_digest m t_sha40_ok d2 202 if bm_digest_eq d1 d2 203 ret false 204 end 205 ret true 206 end 207 208 fn main to int 209 fail = int 0 210 fail = add fail report_case t_c1 test_class_labels 211 fail = add fail report_case t_c2 test_discriminator 212 fail = add fail report_case t_c3 test_qualification_gate 213 fail = add fail report_case t_c4 test_quantiles 214 fail = add fail report_case t_c5 test_bundle_meta 215 fail = add fail report_case t_c6 test_ceiling_and_regression 216 fail = add fail report_case t_c7 test_bundle_digest 217 if ne fail int 0 218 ret int 1 219 end 220 ok = bm_write_all int 1 t_done 221 if not ok 222 ret int 1 223 end 224 ret int 0 225 end