-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_test.sh
More file actions
executable file
·651 lines (577 loc) · 18.8 KB
/
run_test.sh
File metadata and controls
executable file
·651 lines (577 loc) · 18.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
#!/usr/bin/env bash
set -euo pipefail
BIN=./build/tools/driver/Tensorium_cc
UNIT_BIN=./build/tools/Tester/Tensorium_unittests
OUT=/tmp/tensorium_tests
mkdir -p "$OUT"
PIPELINE_BASE=(
--tensorium-stencil-lower
--tensorium-einstein-lower
--tensorium-einstein-analyze-einsum
--tensorium-einstein-canonicalize
--tensorium-einstein-validate
--dump-mlir
)
PIPELINE_DISS=(
--tensorium-stencil-lower
--tensorium-dissipation
--tensorium-einstein-lower
--tensorium-einstein-analyze-einsum
--tensorium-einstein-canonicalize
--tensorium-einstein-validate
)
VALID_TESTS=(
tests/00_simple_op.tns
tests/01_scalar_minimal.tn
tests/02_scalar_with_parameter.tn
tests/03_spacial_derivatives.tn
tests/04_metric_simple.tn
tests/05_tensor_contraction.tn
tests/06_nested_contraction.tn
tests/07_bssn_reduced.tn
tests/11_test_tensorium_types.tn
tests/12_test_non_canonical_index.tn
tests/16_valid_permutation.tn
tests/18_valid_scalar_contraction.tn
tests/20_valid_heavy_contraction.tn
tests/21_test_full.tn
tests/22_BSSN_minimal.tn
tests/23_bssn_like_with_riemann_contract.tn
tests/24_Ricci_conformal_flat.tn
tests/25_deriv_stencil.tn
tests/semantic/diff/05_laplacian_executable_not_supported.tn
tests/50_large_tensor_mix.tn
tests/51_large_tensor_flux.tn
tests/56_metric_decl_ok.tn
tests/58_nabla_scalar.tn
tests/59_nabla_expand.tn
tests/31_temp_valid_scalar.tn
tests/semantic/robustness/04_explicit_parameter_declaration.tn
tests/60_valid_index_offset.tn
tests/61_valid_field_mixed_tensor.tn
tests/62_valid_trace_builtin.tn
tests/63_valid_laplacian_builtin.tn
tests/64_valid_nabla_contravariant_scalar.tn
tests/68_valid_nabla_covector.tn
tests/69_valid_nabla_mixed_tensor.tn
tests/70_valid_nabla_contravariant_vector.tn
tests/73_valid_nabla_contravariant_covector.tn
tests/74_valid_nabla_contravariant_mixed_tensor.tn
)
EXTERN_TESTS=(
tests/34_executable_extern_declared.tn
tests/39_valid_extern_call.tn
)
ERROR_TESTS=(
tests/08_error_invalid_index.tn
tests/09_error_bad_resolution.tn
tests/10_no_simulation.tn
tests/13__error_free_index_unassigned.tn
tests/14_error_duplicate_free_index.tn
tests/15__error_self_contraction.tn
tests/17_error_hidden_index.tn
tests/19_error_unused_index.tn
tests/26_error_unsupported_emit.tn
tests/29_executable_unknown_scalar_call_error.tn
tests/35_executable_extern_missing.tn
tests/32_temp_invalid_tensor_rhs.tn
tests/33_temp_use_before_def.tn
tests/38_error_extern_mixedtensor_duplicate_attr.tn
tests/40_error_extern_arity.tn
tests/41_error_extern_variance.tn
tests/43_error_extern_tensor_return_exec.tn
tests/52_error_tensor_add_variance.tn
tests/53_error_contract_free_index.tn
tests/54_error_dt_assign_rank.tn
tests/55_error_implicit_contraction.tn
tests/57_error_metric_rank.tn
tests/58_error_non_dt_field_assign.tn
tests/65_error_nabla_contravariant_missing_inverse_metric.tn
tests/66_error_dimension_non_integer.tn
tests/67_error_spatial_order_non_integer.tn
tests/71_error_nabla_tensor_missing_metric.tn
tests/72_error_nabla_tensor_requires_indices.tn
)
SEMANTIC_EINSTEIN_VALID_TESTS=(
tests/semantic/einstein/01_valid_contraction.tn
tests/semantic/einstein/04_valid_two_sums.tn
tests/semantic/einstein/canon/01_contract_ij.tn
tests/semantic/einstein/canon/02_contract_mn.tn
)
SEMANTIC_EINSTEIN_ERROR_TESTS=(
"tests/semantic/einstein/02_invalid_variance_contraction.tn|requires explicit metric or inverse metric"
"tests/semantic/einstein/03_collision_trace.tn|Implicit trace"
"tests/semantic/einstein/05_capture_requires_rename.tn|Index collision: symbol"
)
SEMANTIC_DIFF_VALID_TESTS=(
tests/semantic/diff/01_partial_scalar.tn
tests/semantic/diff/02_partial_vector_rank_plus_one.tn
tests/semantic/diff/03_covariant_with_gamma.tn
tests/semantic/diff/05_laplacian_executable_not_supported.tn
)
SEMANTIC_DIFF_ERROR_TESTS=(
"tests/semantic/diff/04_covariant_without_gamma_error.tn|nabla on non-scalar tensor requires either"
)
SEMANTIC_SIMULATION_ERROR_TESTS=(
"tests/semantic/simulation/01_missing_block.tn|E1001: missing simulation block in executable mode"
"tests/semantic/simulation/02_missing_time_block.tn|simulation block requires 'time { dt = ... integrator = ... }'"
"tests/semantic/simulation/03_missing_spatial_block.tn|simulation block requires 'spatial { scheme = ... derivative = ... order = ... }'"
"tests/semantic/simulation/04_time_missing_integrator.tn|time block requires 'integrator = euler|rk3|rk4'"
"tests/semantic/simulation/05_duplicate_dimension_entry.tn|duplicate 'dimension' entry in simulation block"
)
SEMANTIC_SIMULATION_SYMBOLIC_WARN_TESTS=(
"tests/semantic/simulation/01_missing_block.tn|W1001: missing simulation block in symbolic mode"
)
SEMANTIC_ROBUSTNESS_ERROR_TESTS=(
"tests/semantic/robustness/01_unknown_identifier_strict.tn|Unknown identifier: alph"
"tests/semantic/robustness/02_evolution_scope_isolated.tn|Unknown identifier: tmp"
"tests/semantic/robustness/03_field_metric_name_collision.tn|Name collision: field 'g' conflicts with metric 'g'"
"tests/semantic/robustness/05_initial_data_unknown_parameter.tn|uses unknown identifier 'M'"
"tests/semantic/robustness/06_temp_use_before_def_validate.tn|temporary 'K' referenced before definition"
)
INITIAL_DATA_ERROR_TESTS=(
"tests/semantic/initial_data/01_invalid_spherical_coord.tn|uses coordinate 'x' incompatible with simulation coordinates"
"tests/semantic/initial_data/02_symmetry_violation.tn|metric4 symmetry violation"
"tests/semantic/initial_data/06_unsupported_builtin.tn|uses unsupported scalar function 'cos'"
)
INITIAL_DATA_MLIR_ERROR_TESTS=(
"tests/semantic/initial_data/03_missing_gammau_binding.tn|split_3p1 does not bind gammaU"
"tests/semantic/initial_data/04_nonsymmetric_metric_not_supported.tn|decompose3p1_from_metric requires symmetric metric components"
)
INITIAL_DATA_VALID_TESTS=(
tests/semantic/initial_data/offdiag_metric.tn
tests/semantic/initial_data/05_shift_metric_not_supported.tn
)
GR_FIXTURES=(
tests/fixtures/gr/schwarzschild_2d.tn
tests/fixtures/gr/schwarzschild_3d.tn
tests/fixtures/gr/schwarzschild_christoffel_3d.tn
tests/fixtures/gr/schwarzschild_ricci_3d.tn
tests/fixtures/gr/minkowski_ricci_3d.tn
tests/fixtures/gr/reissner_nordstrom_3d.tn
tests/fixtures/gr/reissner_nordstrom_christoffel_3d.tn
tests/fixtures/gr/spatial_offdiag_3d.tn
tests/fixtures/gr/kerr_like_3d.tn
tests/fixtures/gr/kerr_like_christoffel_3d.tn
)
SYMBOLIC_VALID_TESTS=(
tests/28_symbolic_unknown_scalar_call_ok.tn
tests/36_symbolic_unknown_scalar_call_ok.tn
tests/37_valid_extern_tensor_type.tn
tests/42_symbolic_extern_tensor_return.tn
)
SYMBOLIC_ERROR_TESTS=(
tests/30_symbolic_call_nonscalar_arg_error.tn
)
SYMBOLIC_MLIR_TESTS=()
SYMBOLIC_TENSOR_FAIL_TESTS=(
tests/44_symbolic_extern_tensor_mlir.tn
)
echo "=============================="
echo " RUN INTERNAL UNIT TESTS"
echo "=============================="
"$UNIT_BIN"
echo
echo "=============================="
echo " RUN VALID TESTS"
echo "=============================="
for f in "${VALID_TESTS[@]}"; do
echo "[OK EXPECTED] $f"
"$BIN" --mlir-best-effort "${PIPELINE_DISS[@]}" --dump-mlir "$f" \
> "$OUT/$(basename "$f").mlir"
done
PRIMARY_MLIR="$OUT/$(basename ${VALID_TESTS[0]}).mlir"
if ! grep -q "tensorium.field" "$PRIMARY_MLIR"; then
echo "ERROR: expected tensorium.field types in $PRIMARY_MLIR"
exit 1
fi
LAPLACIAN_MLIR="$OUT/$(basename tests/semantic/diff/05_laplacian_executable_not_supported.tn).mlir"
if ! grep -q "tensorium.contract" "$LAPLACIAN_MLIR"; then
echo "ERROR: expected tensorium.contract in laplacian lowering output"
exit 1
fi
echo
echo "=============================="
echo " TEST EMIT ARTIFACT FLAGS"
echo "=============================="
EMIT_MLIR_OUT="$OUT/emit_scalar.mlir"
EMIT_LLVM_OUT="$OUT/emit_scalar.ll"
"$BIN" --emit-mlir "$EMIT_MLIR_OUT" tests/01_scalar_minimal.tn > /dev/null
if [[ ! -s "$EMIT_MLIR_OUT" ]]; then
echo "ERROR: --emit-mlir did not produce output file"
exit 1
fi
if ! grep -q "module" "$EMIT_MLIR_OUT"; then
echo "ERROR: --emit-mlir output does not look like MLIR module"
exit 1
fi
"$BIN" --emit-llvm "$EMIT_LLVM_OUT" tests/01_scalar_minimal.tn > /dev/null
if [[ ! -s "$EMIT_LLVM_OUT" ]]; then
echo "ERROR: --emit-llvm did not produce output file"
exit 1
fi
if ! grep -q "define" "$EMIT_LLVM_OUT"; then
echo "ERROR: --emit-llvm output does not look like LLVM IR"
exit 1
fi
echo
echo "=============================="
echo " RUN EXTERN DECL TESTS"
echo "=============================="
for f in "${EXTERN_TESTS[@]}"; do
echo "[OK EXPECTED - NO MLIR] $f"
"$BIN" "$f" > /dev/null
echo "[FAIL EXPECTED - MLIR EXTERN LOWERING] $f"
TMP_ERR=$(mktemp)
if "$BIN" "${PIPELINE_BASE[@]}" "$f" > "$TMP_ERR" 2>&1; then
echo "ERROR: $f was expected to fail during MLIR emission"
cat "$TMP_ERR"
rm -f "$TMP_ERR"
exit 1
fi
if ! grep -q "extern function" "$TMP_ERR"; then
echo "ERROR: expected extern lowering error message"
cat "$TMP_ERR"
rm -f "$TMP_ERR"
exit 1
fi
rm -f "$TMP_ERR"
done
echo
echo "=============================="
echo " RUN ERROR TESTS"
echo "=============================="
for f in "${ERROR_TESTS[@]}"; do
echo "[FAIL EXPECTED] $f"
if "$BIN" "${PIPELINE_BASE[@]}" "$f" > /dev/null 2>&1; then
echo "ERROR: $f was expected to fail but passed"
exit 1
fi
done
echo
echo "=============================="
echo " RUN SEMANTIC EINSTEIN TESTS"
echo "=============================="
for f in "${SEMANTIC_EINSTEIN_VALID_TESTS[@]}"; do
echo "[SEMANTIC OK EXPECTED] $f"
"$BIN" --validate "$f" > /dev/null
done
for entry in "${SEMANTIC_EINSTEIN_ERROR_TESTS[@]}"; do
f=${entry%%|*}
msg=${entry#*|}
echo "[SEMANTIC FAIL EXPECTED] $f"
TMP_ERR=$(mktemp)
if "$BIN" --validate "$f" > "$TMP_ERR" 2>&1; then
echo "ERROR: $f was expected to fail but passed"
cat "$TMP_ERR"
rm -f "$TMP_ERR"
exit 1
fi
if ! grep -q "$msg" "$TMP_ERR"; then
echo "ERROR: expected semantic diagnostic '$msg' in $f"
cat "$TMP_ERR"
rm -f "$TMP_ERR"
exit 1
fi
rm -f "$TMP_ERR"
done
echo
echo "=============================="
echo " RUN SEMANTIC DIFF TESTS"
echo "=============================="
for f in "${SEMANTIC_DIFF_VALID_TESTS[@]}"; do
echo "[SEMANTIC OK EXPECTED] $f"
"$BIN" --validate "$f" > /dev/null
done
for entry in "${SEMANTIC_DIFF_ERROR_TESTS[@]}"; do
f=${entry%%|*}
msg=${entry#*|}
echo "[SEMANTIC FAIL EXPECTED] $f"
TMP_ERR=$(mktemp)
if "$BIN" --validate "$f" > "$TMP_ERR" 2>&1; then
echo "ERROR: $f was expected to fail but passed"
cat "$TMP_ERR"
rm -f "$TMP_ERR"
exit 1
fi
if ! grep -q "$msg" "$TMP_ERR"; then
echo "ERROR: expected diff diagnostic '$msg' in $f"
cat "$TMP_ERR"
rm -f "$TMP_ERR"
exit 1
fi
rm -f "$TMP_ERR"
done
echo
echo "=============================="
echo " RUN SEMANTIC SIMULATION TESTS"
echo "=============================="
for entry in "${SEMANTIC_SIMULATION_ERROR_TESTS[@]}"; do
f=${entry%%|*}
msg=${entry#*|}
echo "[SEMANTIC FAIL EXPECTED] $f"
TMP_ERR=$(mktemp)
if "$BIN" --validate "$f" > "$TMP_ERR" 2>&1; then
echo "ERROR: $f was expected to fail but passed"
cat "$TMP_ERR"
rm -f "$TMP_ERR"
exit 1
fi
if ! grep -q "$msg" "$TMP_ERR"; then
echo "ERROR: expected simulation diagnostic '$msg' in $f"
cat "$TMP_ERR"
rm -f "$TMP_ERR"
exit 1
fi
rm -f "$TMP_ERR"
done
for entry in "${SEMANTIC_SIMULATION_SYMBOLIC_WARN_TESTS[@]}"; do
f=${entry%%|*}
msg=${entry#*|}
echo "[SYMBOLIC WARN EXPECTED] $f"
TMP_ERR=$(mktemp)
if ! "$BIN" --symbolic "$f" > "$TMP_ERR" 2>&1; then
echo "ERROR: symbolic mode unexpectedly failed for $f"
cat "$TMP_ERR"
rm -f "$TMP_ERR"
exit 1
fi
if ! grep -q "$msg" "$TMP_ERR"; then
echo "ERROR: expected symbolic warning '$msg' in $f"
cat "$TMP_ERR"
rm -f "$TMP_ERR"
exit 1
fi
rm -f "$TMP_ERR"
done
echo
echo "=============================="
echo " RUN SEMANTIC ROBUSTNESS TESTS"
echo "=============================="
for entry in "${SEMANTIC_ROBUSTNESS_ERROR_TESTS[@]}"; do
f=${entry%%|*}
msg=${entry#*|}
echo "[SEMANTIC FAIL EXPECTED] $f"
TMP_ERR=$(mktemp)
if "$BIN" --validate "$f" > "$TMP_ERR" 2>&1; then
echo "ERROR: $f was expected to fail but passed"
cat "$TMP_ERR"
rm -f "$TMP_ERR"
exit 1
fi
if ! grep -q "$msg" "$TMP_ERR"; then
echo "ERROR: expected robustness diagnostic '$msg' in $f"
cat "$TMP_ERR"
rm -f "$TMP_ERR"
exit 1
fi
rm -f "$TMP_ERR"
done
echo
echo "=============================="
echo " RUN GR FIXTURE CHECKS"
echo "=============================="
for f in "${GR_FIXTURES[@]}"; do
echo "[GR OK EXPECTED] $f"
"$BIN" --validate "$f" > /dev/null
OUT_FILE="$OUT/$(basename "$f").backend.txt"
"$BIN" --dump-backend-expr "$f" > "$OUT_FILE"
if ! grep -q "contraction(" "$OUT_FILE"; then
echo "ERROR: expected explicit contraction op in backend IR for $f"
exit 1
fi
if ! grep -q "partial_" "$OUT_FILE"; then
echo "ERROR: expected explicit partial derivative op in backend IR for $f"
exit 1
fi
done
echo
echo "=============================="
echo " RUN INITIAL DATA VALID TESTS"
echo "=============================="
for f in "${INITIAL_DATA_VALID_TESTS[@]}"; do
echo "[INITIAL_DATA OK EXPECTED] $f"
"$BIN" "${PIPELINE_BASE[@]}" "$f" > /dev/null
done
echo
echo "=============================="
echo " RUN INITIAL DATA PARAM LOWERING CHECK"
echo "=============================="
RN_INIT_FIXTURE=tests/fixtures/gr/reissner_nordstrom_3d.tn
RN_INIT_OUT="$OUT/reissner_nordstrom_init.mlir"
"$BIN" --tensorium-metric-lower --tensorium-init-std-lower --dump-mlir \
"$RN_INIT_FIXTURE" > "$RN_INIT_OUT"
if ! grep -q "tensorium_init_point" "$RN_INIT_OUT"; then
echo "ERROR: expected tensorium_init_point after init-to-std lowering"
exit 1
fi
if ! grep -q "tensorium.init.param_names" "$RN_INIT_OUT"; then
echo "ERROR: expected param metadata on tensorium_init_point"
exit 1
fi
if ! grep -q "\"Q\"" "$RN_INIT_OUT"; then
echo "ERROR: expected Q runtime parameter in init lowering metadata"
exit 1
fi
echo
echo "=============================="
echo " RUN INITIAL DATA ERROR TESTS"
echo "=============================="
for entry in "${INITIAL_DATA_ERROR_TESTS[@]}"; do
f=${entry%%|*}
msg=${entry#*|}
echo "[INITIAL_DATA FAIL EXPECTED] $f"
TMP_ERR=$(mktemp)
if "$BIN" --validate "$f" > "$TMP_ERR" 2>&1; then
echo "ERROR: $f was expected to fail but passed"
cat "$TMP_ERR"
rm -f "$TMP_ERR"
exit 1
fi
if ! grep -q "$msg" "$TMP_ERR"; then
echo "ERROR: expected initial_data diagnostic '$msg' in $f"
cat "$TMP_ERR"
rm -f "$TMP_ERR"
exit 1
fi
rm -f "$TMP_ERR"
done
echo
echo "=============================="
echo " RUN INITIAL DATA MLIR ERROR TESTS"
echo "=============================="
for entry in "${INITIAL_DATA_MLIR_ERROR_TESTS[@]}"; do
f=${entry%%|*}
msg=${entry#*|}
echo "[INITIAL_DATA MLIR FAIL EXPECTED] $f"
TMP_ERR=$(mktemp)
if "$BIN" "${PIPELINE_BASE[@]}" "$f" > "$TMP_ERR" 2>&1; then
echo "ERROR: $f was expected to fail during MLIR emission"
cat "$TMP_ERR"
rm -f "$TMP_ERR"
exit 1
fi
if ! grep -q "$msg" "$TMP_ERR"; then
echo "ERROR: expected MLIR initial_data diagnostic '$msg' in $f"
cat "$TMP_ERR"
rm -f "$TMP_ERR"
exit 1
fi
rm -f "$TMP_ERR"
done
echo
echo "=============================="
echo " RUN SCHWARZSCHILD 3+1 MLIR SMOKE"
echo "=============================="
SPLIT_FIXTURE=tests/fixtures/gr/schwarzschild_3d.tn
"$BIN" "${PIPELINE_BASE[@]}" "$SPLIT_FIXTURE" > /dev/null
echo
echo "=============================="
echo " RUN SYMBOLIC TESTS"
echo "=============================="
for f in "${SYMBOLIC_VALID_TESTS[@]}"; do
echo "[SYMBOLIC OK EXPECTED] $f"
"$BIN" --symbolic "$f" > /dev/null
done
echo
echo "=============================="
echo " RUN TYPE ANNOTATION TEST"
echo "=============================="
TYPE_TEST=tests/45_type_annotation.tn
TYPE_OUT="$OUT/type_annotation.log"
"$BIN" --symbolic --dump-indexed --dump-backend-expr "$TYPE_TEST" \
> "$TYPE_OUT"
if ! grep -F -q "v[field;i][u=1,d=0]" "$TYPE_OUT"; then
echo "ERROR: missing indexed type annotation in $TYPE_TEST"
exit 1
fi
if ! grep -F -q "phi[field][u=0,d=0]" "$TYPE_OUT"; then
echo "ERROR: missing scalar type annotation in $TYPE_TEST"
exit 1
fi
for f in "${SYMBOLIC_ERROR_TESTS[@]}"; do
echo "[SYMBOLIC FAIL EXPECTED] $f"
if "$BIN" --symbolic "$f" > /dev/null 2>&1; then
echo "ERROR: $f was expected to fail but passed"
exit 1
fi
done
if ((${#SYMBOLIC_MLIR_TESTS[@]})); then
echo
echo "=============================="
echo " RUN SYMBOLIC MLIR TESTS"
echo "=============================="
for f in "${SYMBOLIC_MLIR_TESTS[@]}"; do
echo "[SYMBOLIC MLIR EXPECTED] $f"
"$BIN" --symbolic --dump-mlir "$f" \
> "$OUT/$(basename "$f").symbolic.mlir"
done
fi
echo
echo "=============================="
echo " RUN SYMBOLIC TENSOR FAIL TESTS"
echo "=============================="
for f in "${SYMBOLIC_TENSOR_FAIL_TESTS[@]}"; do
echo "[SYMBOLIC MLIR FAIL EXPECTED] $f"
TMP_ERR=$(mktemp)
if "$BIN" --symbolic --dump-mlir "$f" > "$TMP_ERR" 2>&1; then
echo "ERROR: $f was expected to fail during MLIR emission"
cat "$TMP_ERR"
rm -f "$TMP_ERR"
exit 1
fi
if ! grep -q "extern function" "$TMP_ERR"; then
echo "ERROR: expected extern tensor lowering error, got:"
cat "$TMP_ERR"
rm -f "$TMP_ERR"
exit 1
fi
rm -f "$TMP_ERR"
done
echo
echo "=============================="
echo " RUN BSSN DEFAULT LLVM PIPELINE"
echo "=============================="
BSSN_DEFAULT_LL="$OUT/07_bssn_reduced.default.ll"
RAW_BSSN_LL="$(mktemp)"
"$BIN" --dump-llvm-ir tests/07_bssn_reduced.tn > "$RAW_BSSN_LL"
awk '
/^\[Tensorium\]/ {exit}
{print}
' "$RAW_BSSN_LL" > "$BSSN_DEFAULT_LL"
rm -f "$RAW_BSSN_LL"
if ! grep -q "define void @tensorium_rhs_grid_affine" "$BSSN_DEFAULT_LL"; then
echo "ERROR: expected default LLVM pipeline to lower BSSN RHS grid kernel"
exit 1
fi
echo
echo "=============================="
echo " RUN BSSN RHS LLVM SMOKE"
echo "=============================="
bash tools/dev/test_bssn_reduced_ll.sh
echo
echo "=============================="
echo " RUN BSSN RK2 LLVM SMOKE"
echo "=============================="
bash tools/dev/test_bssn_reduced_rk2_ll.sh
echo
echo "=============================="
echo " RUN BSSN MINIMAL LLVM SMOKE"
echo "=============================="
bash tools/dev/test_bssn_minimal_ll.sh
echo
echo "=============================="
echo " RUN LLVM IR COMPILE+RUN SMOKE"
echo "=============================="
bash tools/dev/test_schwarzschild_ll.sh
bash tools/dev/test_schwarzschild_christoffel_ll.sh
bash tools/dev/test_reissner_christoffel_ll.sh
bash tools/dev/test_kerr_like_christoffel_ll.sh
bash tools/dev/test_minkowski_ricci_ll.sh
bash tools/dev/test_schwarzschild_ricci_ll.sh
bash tools/dev/test_covariant_rank1_ll.sh
echo
echo "=============================="
echo " ALL TESTS PASSED"
echo " MLIR outputs in $OUT"
echo "=============================="