From f9bae99c0f2b366007e6d53d86952732a131047e Mon Sep 17 00:00:00 2001 From: paul Date: Tue, 10 Nov 2026 00:53:16 +0000 Subject: [PATCH 01/11] tests: portable shell tools, so the shell suite runs on OpenBSD OpenBSD's userland differs from GNU/macOS/FreeBSD in ways a test script must not depend on, and each showed up as a failure that read as a product bug: - tests/lib/syslibs.sh: -ldl and -lrt only on Linux (BSDs and macOS have dlopen and shm in libc; the linker fails outright on -ldl there). - tests/lib/portable.sh: head_c (no head -c), sha256_of (no shasum), copy_listed (no tar -T), dyn_syms (nm -D/-gU/-g), file_desc (file prints "data" for wasm/COFF/Mach-O and "AArch64"), od_uint (od zero-pads -tu). - 75 `grep "a\|b"` became `grep -E "a|b"`: OpenBSD's grep reads `\|` as a literal pipe, so the warnings filter of ~35 tests let warnings into compared output and positive matches never matched. - `\b`, `\s` became POSIX classes; `grep -r --exclude=NAME` became find. - http_proxy_direct_equivalence compares Content-Length after the port rewrite (the echoed body holds the port; OpenBSD's ephemeral range includes four-digit ports). Co-Authored-By: Claude --- ...25917Z-changed-openbsd-test-portability.md | 1 + tests/compiler/test_msvc_compat.sh | 2 +- .../integration/abi_matrix/test_abi_matrix.sh | 3 +- .../integration/abi_policy/test_abi_policy.sh | 1 + .../test_actor_ref_field_reject.sh | 2 +- .../test_actor_state_ref_name_not_type.sh | 4 +- .../test_actor_state_typed_declarations.sh | 2 +- .../test_ae_add_binary_package.sh | 9 +- .../test_ae_add_release_artifact.sh | 5 +- tests/integration/ae_help/test_ae_help.sh | 3 +- .../aea_artifacts/test_aea_artifacts.sh | 3 +- .../test_aether_cfn_proc_address.sh | 3 +- .../test_aether_extern_param_annotation.sh | 3 +- .../test_aether_extern_struct.sh | 3 +- .../test_aether_fnptr_call.sh | 3 +- .../test_array_field_length.sh | 2 +- .../test_assign_to_call_result.sh | 2 +- .../test_binary_import_ownership.sh | 1 + .../test_cache_key_runtime_headers.sh | 5 +- .../test_call_non_closure_reject.sh | 4 +- .../test_canonical_repo_url.sh | 13 ++- .../test_ci_coverage_smoke.sh | 3 +- .../test_closure_capture_compound_assign.sh | 2 +- .../test_closure_cell_borrowed_string.sh | 2 +- .../test_closure_destructure_rebind_reject.sh | 2 +- .../test_closure_param_reassign.sh | 2 +- .../test_closure_param_shadows_local_type.sh | 2 +- .../test_closure_volatile_array_capture.sh | 4 +- .../test_closure_write_through_capture.sh | 6 +- .../test_condition_continuation_pipe.sh | 2 +- .../test_const_dependency_order.sh | 4 +- .../test_contrib_vulkan_portability.sh | 2 +- .../emit_csrc_cross/test_emit_csrc_cross.sh | 11 +-- tests/integration/emit_lib/test_emit_lib.sh | 3 +- .../test_emit_lib_accounts.sh | 1 + .../test_emit_lib_clause_sets.sh | 3 +- .../test_emit_lib_composite.sh | 3 +- .../test_emit_lib_execution_frame.sh | 1 + .../test_emit_lib_keeps_main.sh | 10 +-- .../test_emit_lib_kind_safe.sh | 3 +- .../emit_lib_lists/test_emit_lib_lists.sh | 3 +- .../emit_lib_net/test_emit_lib_net.sh | 3 +- .../test_emit_lib_primitives.sh | 3 +- .../test_emit_lib_typed_ptr.sh | 3 +- .../test_emit_lib_unsupported.sh | 2 +- .../test_emit_lib_windows_dll.sh | 4 +- .../test_emit_lib_with_capability.sh | 2 +- .../test_eval_order_left_to_right.sh | 2 +- .../f32_arithmetic/test_f32_arithmetic.sh | 2 +- .../test_fixed_array_capture_and_state.sh | 2 +- tests/integration/fmt_gate/test_fmt_gate.sh | 3 +- .../test_fn_param_call_dispatch.sh | 2 +- .../test_fs_open_binary_mode.sh | 2 +- .../test_function_clause_string_pattern.sh | 2 +- .../test_host_bridge_import_link.sh | 2 +- .../test_host_child_signal_safe.sh | 3 +- .../test_http_h2_concurrent_dispatch.sh | 3 +- .../test_http_proxy_direct_equivalence.sh | 29 +++++- .../test_http_reverse_proxy.sh | 3 +- .../test_http_script_gateway.sh | 1 + .../test_http_server_chunked_request.sh | 7 +- .../test_http_stream_upload.sh | 7 +- .../test_imported_const_expr_type.sh | 2 +- tests/integration/lane_math/test_lane_math.sh | 2 +- .../integration/lane_types/test_lane_types.sh | 2 +- tests/integration/lane_wide/test_lane_wide.sh | 2 +- .../test_lsp_protocol_roundtrip.sh | 7 +- tests/integration/manifest/test_manifest.sh | 3 +- .../test_match_arm_defer_scope.sh | 2 +- .../test_module_struct_name_collision.sh | 2 +- .../namespace_basic/test_namespace_basic.sh | 3 +- .../test_namespace_multifile.sh | 3 +- tests/integration/notify/test_notify.sh | 3 +- .../test_order_effects_scaling.sh | 2 +- .../test_package_staging_cleanup.sh | 3 +- .../test_packed_array_index_view.sh | 2 +- .../test_packed_array_inline_access.sh | 2 +- .../test_postfix_increment_value.sh | 2 +- .../test_ptr_into_string_error.sh | 2 +- .../test_ptr_return_int_zero_inference.sh | 6 +- .../test_release_contrib_c_modules.sh | 2 +- .../test_runtime_headers_strict_c11.sh | 2 +- .../test_sandbox_child_signal_safe.sh | 3 +- .../test_sandbox_dlopen_dlerror.sh | 3 +- .../test_sandbox_dlopen_libc.sh | 3 +- .../test_sandbox_empty_grants.sh | 3 +- .../test_sandbox_grant_overflow.sh | 3 +- .../test_sandbox_grant_transport.sh | 3 +- .../test_sandbox_nested_libraries.sh | 1 + .../test_sandbox_spawn_family.sh | 1 + .../test_sandbox_unique_shm.sh | 3 +- .../test_select_missing_platform.sh | 2 +- tests/integration/size_mode/test_size_mode.sh | 11 +-- .../test_sized_array_params_eval_order.sh | 2 +- .../test_slice_raw_view_holds_nothing.sh | 2 +- .../test_spawn_signal_mask_reset.sh | 3 +- .../test_spawn_stdio_inherited.sh | 3 +- .../test_sqlite_amalgamation_fetch.sh | 3 +- .../test_sqlite_vendored_native.sh | 1 + tests/integration/step_word/test_step_word.sh | 1 + .../test_struct_argument_mismatch.sh | 2 +- .../test_tcp_connect_timeout.sh | 2 +- .../tcp_listen_on/test_tcp_listen_on.sh | 2 +- .../test_try_written_volatile_c.sh | 4 +- .../wasi_panic_link/test_wasi_panic_link.sh | 7 +- .../test_wasm_emit_lib_exports.sh | 5 +- .../test_written_type_sibling_branch.sh | 2 +- tests/lib/portable.sh | 89 +++++++++++++++++++ tests/lib/syslibs.sh | 15 ++++ tests/run_macos_leaks.sh | 2 +- 110 files changed, 320 insertions(+), 145 deletions(-) create mode 100644 new_changelogs/20261109T225917Z-changed-openbsd-test-portability.md create mode 100644 tests/lib/portable.sh create mode 100644 tests/lib/syslibs.sh diff --git a/new_changelogs/20261109T225917Z-changed-openbsd-test-portability.md b/new_changelogs/20261109T225917Z-changed-openbsd-test-portability.md new file mode 100644 index 000000000..87cfdedfc --- /dev/null +++ b/new_changelogs/20261109T225917Z-changed-openbsd-test-portability.md @@ -0,0 +1 @@ +- **The shell test suite runs on OpenBSD** (`tests/lib/portable.sh`, `tests/lib/syslibs.sh`, `tests/lib/test_openssl_conf.sh`, and the tests that use them). Hand-written C link lines name `-ldl`/`-lrt` only on Linux (`$AE_DL_LIBS`, `$AE_RT_LIBS`); `head -c`, `sha256sum`/`shasum`, `tar -T`, `nm -D`, `od -tu` (OpenBSD zero-pads it) and `file` (which prints `data` for wasm, COFF and Mach-O, and `AArch64` for `aarch64`) go through `head_c`, `sha256_of`, `copy_listed`, `dyn_syms`, `od_uint` and `file_desc`; the 75 `grep "a\|b"` alternations, which OpenBSD's grep reads as a literal `|` (so a "warning filter" let warnings into compared output), are `grep -E`; `\b` and `\s` are POSIX classes; `grep -r --exclude` is `find` (OpenBSD matches `--exclude` against the whole path). `x509 -req` is told `-sha256`: LibreSSL signs with SHA-1 by default and the pure TLS stack rightly refuses that. Tests whose subject cannot exist on the host skip and say why: `ae version install` where there is no release build, musl targets where zig cannot build musl's libc.a, dual-stack `::` where sockets are IPv6-only, the poisoning allocator where libc has no `malloc_usable_size`, FORTIFY where libc has no `__*_chk`, `spawn_sandboxed` off Linux and FreeBSD, and the checks that need OpenSSL's `ssl_conf`, `s_server -cert_chain`, `s_client -sigalgs` or Ed25519 certificates in TLS. diff --git a/tests/compiler/test_msvc_compat.sh b/tests/compiler/test_msvc_compat.sh index 92755a378..bdbd058a1 100755 --- a/tests/compiler/test_msvc_compat.sh +++ b/tests/compiler/test_msvc_compat.sh @@ -483,7 +483,7 @@ if [ -n "$use_gcc" ] && [ "${MSVC_COMPAT_SWEEP:-0}" = 1 ]; then for b in "$SWEEP_TMP"/bad_*; do n="${b#"$SWEEP_TMP"/bad_}" echo " $(cat "$b")" - grep -B1 -A2 "braced-groups\|fatal error" "$SWEEP_TMP/$n.log" 2>/dev/null | head -8 | sed 's/^/ /' + grep -B1 -A2 -E "braced-groups|fatal error" "$SWEEP_TMP/$n.log" 2>/dev/null | head -8 | sed 's/^/ /' done echo " [FAIL] $bad of the sweep's programs have GCC extensions on the non-GCC path" exit 1 diff --git a/tests/integration/abi_matrix/test_abi_matrix.sh b/tests/integration/abi_matrix/test_abi_matrix.sh index a285aadf4..181092c97 100644 --- a/tests/integration/abi_matrix/test_abi_matrix.sh +++ b/tests/integration/abi_matrix/test_abi_matrix.sh @@ -41,6 +41,7 @@ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)" +. "$ROOT/tests/lib/syslibs.sh" AE="$ROOT/build/ae" CC="${CC:-cc}" export AETHER_STACK_TRACE=0 @@ -269,7 +270,7 @@ preflight: refused, the library was made for Aether runtime "*) ;; esac if (cd "$TMP/oldsh" && cp "$SCRIPT_DIR/app.ae" . && AETHER_HOME="$ROOT" "$AE" build app.ae -o app > app_build.log 2>&1); then bad "this importer took the $old_version shared-runtime library" - elif ! grep -q "host ABI level 0\|was made for the Aether runtime" "$TMP/oldsh/app_build.log"; then + elif ! grep -q -E "host ABI level 0|was made for the Aether runtime" "$TMP/oldsh/app_build.log"; then bad "this importer's refusal of the $old_version shared-runtime library says why" "$TMP/oldsh/app_build.log" grep -A2 '^note: .* could not be loaded' "$TMP/oldsh/app_build.log" | sed 's/^/ /' fi diff --git a/tests/integration/abi_policy/test_abi_policy.sh b/tests/integration/abi_policy/test_abi_policy.sh index c5a2af230..c36a12d5f 100644 --- a/tests/integration/abi_policy/test_abi_policy.sh +++ b/tests/integration/abi_policy/test_abi_policy.sh @@ -17,6 +17,7 @@ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)" +. "$ROOT/tests/lib/syslibs.sh" AE="$ROOT/build/ae" AETHERC="$ROOT/build/aetherc" CC="${CC:-cc}" diff --git a/tests/integration/actor_ref_field_reject/test_actor_ref_field_reject.sh b/tests/integration/actor_ref_field_reject/test_actor_ref_field_reject.sh index b8431e294..c826caaab 100644 --- a/tests/integration/actor_ref_field_reject/test_actor_ref_field_reject.sh +++ b/tests/integration/actor_ref_field_reject/test_actor_ref_field_reject.sh @@ -24,7 +24,7 @@ refused() { fail "aetherc accepted $1" "$TMPDIR/err.log" fi grep -q "$2" "$TMPDIR/err.log" || fail "$1: no error containing '$2'" "$TMPDIR/err.log" - if grep -q "request for member\|not a structure or union" "$TMPDIR/err.log"; then + if grep -q -E "request for member|not a structure or union" "$TMPDIR/err.log"; then fail "$1 reached the C compiler" "$TMPDIR/err.log" fi } diff --git a/tests/integration/actor_state_ref_name_not_type/test_actor_state_ref_name_not_type.sh b/tests/integration/actor_state_ref_name_not_type/test_actor_state_ref_name_not_type.sh index dd6fdf7d1..4941dcc04 100644 --- a/tests/integration/actor_state_ref_name_not_type/test_actor_state_ref_name_not_type.sh +++ b/tests/integration/actor_state_ref_name_not_type/test_actor_state_ref_name_not_type.sh @@ -69,7 +69,7 @@ AE want="v 30 hops 3 3" -got="$("$AE" run "$tmp/main.ae" 2>&1 | tr -d '\r' | grep -v "^warning\|^ *-->\|^ *[0-9]* |\|^ *|\|^Type checking\|^$")" +got="$("$AE" run "$tmp/main.ae" 2>&1 | tr -d '\r' | grep -v -E "^warning|^ *-->|^ *[0-9]* [|]|^ *[|]|^Type checking|^$")" if [ "$got" != "$want" ]; then echo " [FAIL] actor_state_ref_name_not_type: wrong output" printf 'got:\n%s\nwant:\n%s\n' "$got" "$want" | sed 's/^/ /' @@ -172,7 +172,7 @@ main() { println("hits ${s.hits} ${t.hits} tally ${m} greeted ${gh} ${hh}") } AE -got="$("$AE" run "$tmp/uses.ae" 2>&1 | tr -d '\r' | grep -v "^warning\|^ *-->\|^ *[0-9]* |\|^ *|\|^Type checking\|^$")" +got="$("$AE" run "$tmp/uses.ae" 2>&1 | tr -d '\r' | grep -v -E "^warning|^ *-->|^ *[0-9]* [|]|^ *[|]|^Type checking|^$")" if [ "$got" != "hits 10 2 tally 42 greeted 1 1" ]; then echo " [FAIL] actor_state_ref_name_not_type: a reference field used from outside the actor" printf 'got:\n%s\nwant:\nhits 10 2 tally 42 greeted 1 1\n' "$got" | sed 's/^/ /' diff --git a/tests/integration/actor_state_typed_declarations/test_actor_state_typed_declarations.sh b/tests/integration/actor_state_typed_declarations/test_actor_state_typed_declarations.sh index 5ff4674d4..7ae76a1f6 100644 --- a/tests/integration/actor_state_typed_declarations/test_actor_state_typed_declarations.sh +++ b/tests/integration/actor_state_typed_declarations/test_actor_state_typed_declarations.sh @@ -74,7 +74,7 @@ AE want="b8 4 h16 9 big 50 null 1 q null" -got="$("$AE" run "$tmp/main.ae" 2>&1 | tr -d '\r' | grep -v "^warning\|^ *-->\|^ *[0-9]* |\|^ *|\|^Type checking\|^$")" +got="$("$AE" run "$tmp/main.ae" 2>&1 | tr -d '\r' | grep -v -E "^warning|^ *-->|^ *[0-9]* [|]|^ *[|]|^Type checking|^$")" if [ "$got" != "$want" ]; then echo " [FAIL] actor_state_typed_declarations: wrong output" printf 'got:\n%s\nwant:\n%s\n' "$got" "$want" | sed 's/^/ /' diff --git a/tests/integration/ae_add_binary_package/test_ae_add_binary_package.sh b/tests/integration/ae_add_binary_package/test_ae_add_binary_package.sh index a70eceaa3..0fc7eca39 100755 --- a/tests/integration/ae_add_binary_package/test_ae_add_binary_package.sh +++ b/tests/integration/ae_add_binary_package/test_ae_add_binary_package.sh @@ -31,6 +31,7 @@ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)" +. "$ROOT/tests/lib/portable.sh" AE="$ROOT/build/ae" [ -n "${EXE_EXT:-}" ] && AE="$AE$EXE_EXT" @@ -43,9 +44,7 @@ case "$(uname -s)" in *) command -v curl >/dev/null 2>&1 || { echo " [SKIP] ae_add_binary_package: curl needed for the file:// forge"; exit 0; } ;; esac -if command -v sha256sum >/dev/null 2>&1; then SHA="sha256sum" -elif command -v shasum >/dev/null 2>&1; then SHA="shasum -a 256" -else echo " [SKIP] ae_add_binary_package: no sha256 tool"; exit 0; fi +SHA=sha256_of # The binary-package path is per-host-triple; on a host we can't name a triple # for, ae_host_triple() returns NULL and everything correctly falls to git. @@ -107,7 +106,7 @@ mk_binpkg() { asset="$STEM-$tag-$TRIPLE$EXT" # A small but real binary payload (not a real dlopen target — this test # exercises ae add's FETCH + INSTALL, not loading). - head -c 4096 /dev/urandom > "$d/$asset" + head_c 4096 /dev/urandom > "$d/$asset" if [ "$mode" = "badsum" ]; then echo "0000000000000000000000000000000000000000000000000000000000000000 $asset" > "$d/$asset.sha256" elif [ "$mode" = "nosum" ]; then @@ -122,7 +121,7 @@ mk_binpkg() { *) FT="linux-x86_64"; FEXT=".so" ;; esac fasset="$STEM-$tag-$FT$FEXT" - head -c 4096 /dev/urandom > "$d/$fasset" + head_c 4096 /dev/urandom > "$d/$fasset" ( cd "$d" && $SHA "$fasset" | awk -v n="$fasset" '{print $1" "n}' > "$fasset.sha256" ) } mk_binpkg v1.0.0 ok diff --git a/tests/integration/ae_add_release_artifact/test_ae_add_release_artifact.sh b/tests/integration/ae_add_release_artifact/test_ae_add_release_artifact.sh index 3a5cc9759..f828937e3 100755 --- a/tests/integration/ae_add_release_artifact/test_ae_add_release_artifact.sh +++ b/tests/integration/ae_add_release_artifact/test_ae_add_release_artifact.sh @@ -25,6 +25,7 @@ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)" +. "$ROOT/tests/lib/portable.sh" . "$ROOT/tests/lib/server_jobs.sh" AE="$ROOT/build/ae" [ -n "${EXE_EXT:-}" ] && AE="$AE$EXE_EXT" @@ -32,9 +33,7 @@ AE="$ROOT/build/ae" [ -x "$AE" ] || { echo " [SKIP] ae_add_release_artifact: ae not built"; exit 0; } command -v python3 >/dev/null 2>&1 || { echo " [SKIP] ae_add_release_artifact: python3 needed to serve fixtures"; exit 0; } command -v tar >/dev/null 2>&1 || { echo " [SKIP] ae_add_release_artifact: tar needed"; exit 0; } -if command -v sha256sum >/dev/null 2>&1; then SHA="sha256sum" -elif command -v shasum >/dev/null 2>&1; then SHA="shasum -a 256" -else echo " [SKIP] ae_add_release_artifact: no sha256 tool"; exit 0; fi +SHA=sha256_of # The artifact path is per-host-triple; on a host we publish no assets # for, ae_host_triple() returns NULL and everything correctly falls back diff --git a/tests/integration/ae_help/test_ae_help.sh b/tests/integration/ae_help/test_ae_help.sh index 714e014f8..1d928e3f8 100755 --- a/tests/integration/ae_help/test_ae_help.sh +++ b/tests/integration/ae_help/test_ae_help.sh @@ -6,6 +6,7 @@ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)" +. "$ROOT/tests/lib/portable.sh" AE="$ROOT/build/ae" TMPDIR="$(mktemp -d)" @@ -140,7 +141,7 @@ main() { } EOF out=$("$AE" help "$TMPDIR/json.ae" --json 2>&1) -first=$(printf '%s' "$out" | head -c 1) +first=$(printf '%s' "$out" | head_c 1) last=$(printf '%s' "$out" | tr -d '\n' | tail -c 1) if [ "$first" = "{" ] && [ "$last" = "}" ]; then echo " [PASS] --json emits a single JSON object" diff --git a/tests/integration/aea_artifacts/test_aea_artifacts.sh b/tests/integration/aea_artifacts/test_aea_artifacts.sh index 4eadfeb2b..d348060eb 100755 --- a/tests/integration/aea_artifacts/test_aea_artifacts.sh +++ b/tests/integration/aea_artifacts/test_aea_artifacts.sh @@ -11,6 +11,7 @@ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)" +. "$ROOT/tests/lib/portable.sh" AETHERC="$ROOT/build/aetherc" [ -f "$AETHERC.exe" ] && AETHERC="$AETHERC.exe" EXE="" @@ -187,7 +188,7 @@ if grep -q "not using .*/md2.aea: source changed since the artifact was built" " else bad "edited source not detected"; cat "$T/edit_trace.txt"; fi # 6. A damaged artifact is ignored, not trusted. -head -c 200 "$MODS/std/cryptography/sha3.aea" > "$T/short.aea" +head_c 200 "$MODS/std/cryptography/sha3.aea" > "$T/short.aea" cp "$T/short.aea" "$MODS/std/cryptography/sha3.aea" aec_trace app.ae "$T/damaged.c" 2>"$T/dmg_trace.txt" from_source app.ae "$T/damaged_src.c" 2>/dev/null diff --git a/tests/integration/aether_cfn_proc_address/test_aether_cfn_proc_address.sh b/tests/integration/aether_cfn_proc_address/test_aether_cfn_proc_address.sh index 6ff91bebd..4e407fac5 100755 --- a/tests/integration/aether_cfn_proc_address/test_aether_cfn_proc_address.sh +++ b/tests/integration/aether_cfn_proc_address/test_aether_cfn_proc_address.sh @@ -22,6 +22,7 @@ set -e SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)" +. "$ROOT/tests/lib/syslibs.sh" AETHERC="$ROOT/build/aetherc" if [ ! -x "$AETHERC" ]; then @@ -142,7 +143,7 @@ for d in "$ROOT" "$ROOT/runtime" "$ROOT/runtime/actors" "$ROOT/runtime/scheduler done if ! ${CC:-cc} $INCLUDES -o "$tmpdir/app_bin" "$tmpdir/app.gen.c" "$tmpdir/glue.c" \ - "$ROOT/build/libaether.a" -lpthread -ldl -lm 2>"$tmpdir/cc.err"; then + "$ROOT/build/libaether.a" -lpthread $AE_DL_LIBS -lm 2>"$tmpdir/cc.err"; then echo " [FAIL] aether_cfn_proc_address: C compile returned non-zero" sed 's/^/ /' "$tmpdir/cc.err" exit 1 diff --git a/tests/integration/aether_extern_param_annotation/test_aether_extern_param_annotation.sh b/tests/integration/aether_extern_param_annotation/test_aether_extern_param_annotation.sh index 1b54a5ee6..51913ed04 100755 --- a/tests/integration/aether_extern_param_annotation/test_aether_extern_param_annotation.sh +++ b/tests/integration/aether_extern_param_annotation/test_aether_extern_param_annotation.sh @@ -14,6 +14,7 @@ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)" +. "$ROOT/tests/lib/syslibs.sh" AETHERC="$ROOT/build/aetherc" if [ ! -x "$AETHERC" ]; then @@ -89,7 +90,7 @@ INC=$(find "$PREFIX/include/aether" -type d 2>/dev/null | sed 's|^|-I|' | tr '\n ${CC:-cc} -O2 -Wall -Wextra -Werror $INC \ "$tmpdir/positive.c" "$tmpdir/helper.c" \ -L"$PREFIX/lib/aether" -laether \ - -pthread -lm -ldl \ + -pthread -lm $AE_DL_LIBS \ -o "$tmpdir/positive" >/dev/null 2>"$tmpdir/link.err" || { echo " [FAIL] positive case link failed" head -3 "$tmpdir/link.err" diff --git a/tests/integration/aether_extern_struct/test_aether_extern_struct.sh b/tests/integration/aether_extern_struct/test_aether_extern_struct.sh index 932233b69..ca6aa2bad 100755 --- a/tests/integration/aether_extern_struct/test_aether_extern_struct.sh +++ b/tests/integration/aether_extern_struct/test_aether_extern_struct.sh @@ -21,6 +21,7 @@ set -e SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)" +. "$ROOT/tests/lib/syslibs.sh" AETHERC="$ROOT/build/aetherc" AE="$ROOT/build/ae" @@ -292,7 +293,7 @@ if ! ${CC:-cc} -c -o "$tmpdir/case4_glue.o" "$tmpdir/case4_glue.c" \ exit 1 fi if ! ${CC:-cc} -o "$tmpdir/case4_bin" "$tmpdir/case4.gen.o" "$tmpdir/case4_glue.o" \ - "$ROOT/build/libaether.a" -lpthread -ldl -lm 2>"$tmpdir/case4.gcc.err"; then + "$ROOT/build/libaether.a" -lpthread $AE_DL_LIBS -lm 2>"$tmpdir/case4.gcc.err"; then echo " [FAIL] case 4: gcc failed linking" cat "$tmpdir/case4.gcc.err" | sed 's/^/ /' exit 1 diff --git a/tests/integration/aether_fnptr_call/test_aether_fnptr_call.sh b/tests/integration/aether_fnptr_call/test_aether_fnptr_call.sh index edc240281..29bc18608 100755 --- a/tests/integration/aether_fnptr_call/test_aether_fnptr_call.sh +++ b/tests/integration/aether_fnptr_call/test_aether_fnptr_call.sh @@ -18,6 +18,7 @@ set -e SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)" +. "$ROOT/tests/lib/syslibs.sh" AETHERC="$ROOT/build/aetherc" if [ ! -x "$AETHERC" ]; then @@ -188,7 +189,7 @@ done if ! ${CC:-cc} $INCLUDES -o "$tmpdir/case4_bin" \ "$tmpdir/case4.gen.c" "$tmpdir/case4_glue.c" \ - "$ROOT/build/libaether.a" -lpthread -ldl -lm 2>"$tmpdir/case4.gcc.err"; then + "$ROOT/build/libaether.a" -lpthread $AE_DL_LIBS -lm 2>"$tmpdir/case4.gcc.err"; then echo " [FAIL] case 4: gcc returned non-zero" cat "$tmpdir/case4.gcc.err" | sed 's/^/ /' exit 1 diff --git a/tests/integration/array_field_length/test_array_field_length.sh b/tests/integration/array_field_length/test_array_field_length.sh index 5a7379fc8..2eb68582f 100644 --- a/tests/integration/array_field_length/test_array_field_length.sh +++ b/tests/integration/array_field_length/test_array_field_length.sh @@ -90,7 +90,7 @@ main() { println("${v.xs[3]} ${w.xs[1]} ${w.xs[3]} ${s.names[0]} ${string.length(s.names[2])} ${t.names[2]}") } AE -got="$("$AE" run "$tmp/ok.ae" 2>&1 | tr -d '\r' | grep -v "^warning\|^ *-->\|^ *[0-9]* |\|^ *|\|^Type checking\|^$")" +got="$("$AE" run "$tmp/ok.ae" 2>&1 | tr -d '\r' | grep -v -E "^warning|^ *-->|^ *[0-9]* [|]|^ *[|]|^Type checking|^$")" if [ "$got" != "4 6 0 x 0 c" ]; then echo " [FAIL] array_field_length: arrays of the field's length and shorter literals" printf 'got:\n%s\nwant:\n4 6 0 x 0 c\n' "$got" | sed 's/^/ /' diff --git a/tests/integration/assign_to_call_result/test_assign_to_call_result.sh b/tests/integration/assign_to_call_result/test_assign_to_call_result.sh index 580cd3c03..9186f5875 100644 --- a/tests/integration/assign_to_call_result/test_assign_to_call_result.sh +++ b/tests/integration/assign_to_call_result/test_assign_to_call_result.sh @@ -128,7 +128,7 @@ main() { println("${q.x} ${q.y} ${g.cells[1]}") } AE -got="$("$AE" run good.ae 2>&1 | tr -d '\r' | grep -v "^warning\|^ *-->\|^ *[0-9]* |\|^ *|\|^Type checking\|^$")" +got="$("$AE" run good.ae 2>&1 | tr -d '\r' | grep -v -E "^warning|^ *-->|^ *[0-9]* [|]|^ *[|]|^Type checking|^$")" if [ "$got" != "5 7 20" ]; then echo " [FAIL] assign_to_call_result: an assignment through a returned pointer stopped working" printf 'got:\n%s\nwant:\n5 7 20\n' "$got" | sed 's/^/ /' diff --git a/tests/integration/binary_import_ownership/test_binary_import_ownership.sh b/tests/integration/binary_import_ownership/test_binary_import_ownership.sh index 5ad24b6e8..5143e6ffe 100644 --- a/tests/integration/binary_import_ownership/test_binary_import_ownership.sh +++ b/tests/integration/binary_import_ownership/test_binary_import_ownership.sh @@ -17,6 +17,7 @@ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)" +. "$ROOT/tests/lib/syslibs.sh" AE="$ROOT/build/ae" [ -x "$AE" ] || [ -x "$AE.exe" ] || { echo " [SKIP] binary_import_ownership: ae not built"; exit 0; } CC="${CC:-cc}" diff --git a/tests/integration/cache_key_runtime_headers/test_cache_key_runtime_headers.sh b/tests/integration/cache_key_runtime_headers/test_cache_key_runtime_headers.sh index bd50f31d3..fc052ac5b 100644 --- a/tests/integration/cache_key_runtime_headers/test_cache_key_runtime_headers.sh +++ b/tests/integration/cache_key_runtime_headers/test_cache_key_runtime_headers.sh @@ -15,6 +15,7 @@ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)" +. "$ROOT/tests/lib/portable.sh" fail() { echo " [FAIL] cache_key_runtime_headers: $1"; exit 1; } @@ -35,8 +36,8 @@ for f in "ae$EXE" "aetherc$EXE" libaether.a aether_manifest.o; do done # The headers, in one process (each process costs tens of milliseconds on # Windows). -(cd "$ROOT" && find runtime std include -name '*.h' 2>/dev/null | tar cf - -T -) | - (cd "$TREE" && tar xf -) || fail "could not copy the headers" +(cd "$ROOT" && find runtime std include -name '*.h' 2>/dev/null | copy_listed "$TREE") || + fail "could not copy the headers" AE="$TREE/build/ae$EXE" probe="$TREE/runtime/utils/zz_cache_key_probe.h" diff --git a/tests/integration/call_non_closure_reject/test_call_non_closure_reject.sh b/tests/integration/call_non_closure_reject/test_call_non_closure_reject.sh index 7c875f9e6..9325e6457 100644 --- a/tests/integration/call_non_closure_reject/test_call_non_closure_reject.sh +++ b/tests/integration/call_non_closure_reject/test_call_non_closure_reject.sh @@ -38,7 +38,7 @@ expect_reject() { grep -qF "$2" "$1.txt" || fail "$1: missing '$2'" "$1.txt" grep -qF -- "--> main.ae:5:10" "$1.txt" || fail "$1: not reported at the argument" "$1.txt" grep -qF "$3" "$1.txt" || fail "$1: missing help '$3'" "$1.txt" - if grep -q "has no member named\|not a structure or union" "$1.txt"; then + if grep -q -E "has no member named|not a structure or union" "$1.txt"; then fail "$1: still reported by the C compiler" "$1.txt" fi } @@ -105,7 +105,7 @@ main() { AE want="boxed 4 2 6 11 6 8" -got="$("$AE" run main.ae 2>&1 | tr -d '\r' | grep -v "^warning\|^ *-->\|^ *[0-9]* |\|^ *|\|^Type checking\|^$")" +got="$("$AE" run main.ae 2>&1 | tr -d '\r' | grep -v -E "^warning|^ *-->|^ *[0-9]* [|]|^ *[|]|^Type checking|^$")" if [ "$got" != "$want" ]; then echo " [FAIL] call_non_closure_reject: a closure callee stopped working" printf 'got:\n%s\nwant:\n%s\n' "$got" "$want" | sed 's/^/ /' diff --git a/tests/integration/canonical_repo_url/test_canonical_repo_url.sh b/tests/integration/canonical_repo_url/test_canonical_repo_url.sh index fed56aefb..e288f9a0b 100755 --- a/tests/integration/canonical_repo_url/test_canonical_repo_url.sh +++ b/tests/integration/canonical_repo_url/test_canonical_repo_url.sh @@ -33,13 +33,12 @@ STALE_OWNERS="nicolasmd87 aether-lang-${ORG_SUFFIX}" hits="" for owner in $STALE_OWNERS; do stale="$owner/aether" - found=$(grep -rn "$stale" \ - --exclude-dir=.git \ - --exclude-dir=build \ - --exclude-dir=target \ - --exclude=CHANGELOG.md \ - --exclude=CHANGELOG-archive.md \ - . 2>/dev/null | grep -Ev '^\.?/?benchmarks/json/corpus/') + # find, not `grep -r --exclude`: OpenBSD's grep matches --exclude against + # the whole path ("./CHANGELOG.md"), so the changelogs were not excluded. + found=$(find . \( -name .git -o -name build -o -name target \) -prune -o \ + -type f ! -name CHANGELOG.md ! -name CHANGELOG-archive.md \ + ! -path './benchmarks/json/corpus/*' \ + -exec grep -n "$stale" /dev/null {} + 2>/dev/null) [ -n "$found" ] && hits="${hits}${found} " done diff --git a/tests/integration/ci_coverage_smoke/test_ci_coverage_smoke.sh b/tests/integration/ci_coverage_smoke/test_ci_coverage_smoke.sh index 5b07c6ff5..4da4ad185 100755 --- a/tests/integration/ci_coverage_smoke/test_ci_coverage_smoke.sh +++ b/tests/integration/ci_coverage_smoke/test_ci_coverage_smoke.sh @@ -10,6 +10,7 @@ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)" +. "$ROOT/tests/lib/syslibs.sh" AETHERC="$ROOT/build/aetherc" AE="$ROOT/build/ae" @@ -86,7 +87,7 @@ if ! (cd "$tmpdir" && gcc --coverage -O0 -g $INC_FLAGS \ fi if ! (cd "$tmpdir" && gcc --coverage cov_demo.o \ -L"$PREFIX/lib/aether" -laether \ - -lpthread -lm -ldl \ + -lpthread -lm $AE_DL_LIBS \ -o cov_demo 2>"$tmpdir/link.err"); then echo " [FAIL] ci_coverage_smoke: gcc --coverage link failed" head -5 "$tmpdir/link.err" diff --git a/tests/integration/closure_capture_compound_assign/test_closure_capture_compound_assign.sh b/tests/integration/closure_capture_compound_assign/test_closure_capture_compound_assign.sh index 9845b0dbc..f21d39acf 100644 --- a/tests/integration/closure_capture_compound_assign/test_closure_capture_compound_assign.sh +++ b/tests/integration/closure_capture_compound_assign/test_closure_capture_compound_assign.sh @@ -85,7 +85,7 @@ decl 212 float 2.5 count 5 try 5" -got="$("$AE" run "$tmp/main.ae" 2>&1 | tr -d '\r' | grep -v "^warning\|^ *-->\|^ *[0-9]* |\|^ *|\|^Type checking\|^$")" +got="$("$AE" run "$tmp/main.ae" 2>&1 | tr -d '\r' | grep -v -E "^warning|^ *-->|^ *[0-9]* [|]|^ *[|]|^Type checking|^$")" if [ "$got" != "$want" ]; then echo " [FAIL] closure_capture_compound_assign: wrong values" printf 'got:\n%s\nwant:\n%s\n' "$got" "$want" | sed 's/^/ /' diff --git a/tests/integration/closure_cell_borrowed_string/test_closure_cell_borrowed_string.sh b/tests/integration/closure_cell_borrowed_string/test_closure_cell_borrowed_string.sh index efbf36586..ef9c89b66 100644 --- a/tests/integration/closure_cell_borrowed_string/test_closure_cell_borrowed_string.sh +++ b/tests/integration/closure_cell_borrowed_string/test_closure_cell_borrowed_string.sh @@ -74,7 +74,7 @@ want="3 ab7 3 ab7 ab7 ab7? ab7 ab7/3 ab7" -got="$("$AE" run "$tmp/main.ae" 2>&1 | tr -d '\r' | grep -v "^warning\|^ *-->\|^ *[0-9]* |\|^ *|\|^Type checking\|^$")" +got="$("$AE" run "$tmp/main.ae" 2>&1 | tr -d '\r' | grep -v -E "^warning|^ *-->|^ *[0-9]* [|]|^ *[|]|^Type checking|^$")" if [ "$got" != "$want" ]; then echo " [FAIL] closure_cell_borrowed_string: the caller's string did not survive the closure's store" printf 'got:\n%s\nwant:\n%s\n' "$got" "$want" | sed 's/^/ /' diff --git a/tests/integration/closure_destructure_rebind_reject/test_closure_destructure_rebind_reject.sh b/tests/integration/closure_destructure_rebind_reject/test_closure_destructure_rebind_reject.sh index 5b1947b1d..07b93ec10 100644 --- a/tests/integration/closure_destructure_rebind_reject/test_closure_destructure_rebind_reject.sh +++ b/tests/integration/closure_destructure_rebind_reject/test_closure_destructure_rebind_reject.sh @@ -43,7 +43,7 @@ expect_reject() { tr -d '\r' < "$1.log" > "$1.txt" grep -qF "$2" "$1.txt" || fail "$1: missing '$2'" "$1.txt" grep -qF -- "--> main.ae:$3" "$1.txt" || fail "$1: not reported at the slot ($3)" "$1.txt" - if grep -q "makes pointer from integer\|incompatible types" "$1.txt"; then + if grep -q -E "makes pointer from integer|incompatible types" "$1.txt"; then fail "$1: still reported by the C compiler" "$1.txt" fi } diff --git a/tests/integration/closure_param_reassign/test_closure_param_reassign.sh b/tests/integration/closure_param_reassign/test_closure_param_reassign.sh index 99bd97707..dac0ee228 100644 --- a/tests/integration/closure_param_reassign/test_closure_param_reassign.sh +++ b/tests/integration/closure_param_reassign/test_closure_param_reassign.sh @@ -61,7 +61,7 @@ k 12 in! outer left 0" -got="$("$AE" run "$tmp/main.ae" 2>&1 | tr -d '\r' | grep -v "^warning\|^ *-->\|^ *[0-9]* |\|^ *|\|^Type checking\|^$")" +got="$("$AE" run "$tmp/main.ae" 2>&1 | tr -d '\r' | grep -v -E "^warning|^ *-->|^ *[0-9]* [|]|^ *[|]|^Type checking|^$")" if [ "$got" != "$want" ]; then echo " [FAIL] closure_param_reassign: wrong output" printf 'got:\n%s\nwant:\n%s\n' "$got" "$want" | sed 's/^/ /' diff --git a/tests/integration/closure_param_shadows_local_type/test_closure_param_shadows_local_type.sh b/tests/integration/closure_param_shadows_local_type/test_closure_param_shadows_local_type.sh index efd3eceb5..21cd1e569 100644 --- a/tests/integration/closure_param_shadows_local_type/test_closure_param_shadows_local_type.sh +++ b/tests/integration/closure_param_shadows_local_type/test_closure_param_shadows_local_type.sh @@ -62,7 +62,7 @@ string-shadow 33 outer text int-shadow 2.5 outer 7" -got="$("$AE" run "$tmp/main.ae" 2>&1 | tr -d '\r' | grep -v "^warning\|^ *-->\|^ *[0-9]* |\|^ *|\|^Type checking\|^$")" +got="$("$AE" run "$tmp/main.ae" 2>&1 | tr -d '\r' | grep -v -E "^warning|^ *-->|^ *[0-9]* [|]|^ *[|]|^Type checking|^$")" if [ "$got" != "$want" ]; then echo " [FAIL] closure_param_shadows_local_type: wrong output" printf 'got:\n%s\nwant:\n%s\n' "$got" "$want" | sed 's/^/ /' diff --git a/tests/integration/closure_volatile_array_capture/test_closure_volatile_array_capture.sh b/tests/integration/closure_volatile_array_capture/test_closure_volatile_array_capture.sh index eb35135c4..d4265c45a 100644 --- a/tests/integration/closure_volatile_array_capture/test_closure_volatile_array_capture.sh +++ b/tests/integration/closure_volatile_array_capture/test_closure_volatile_array_capture.sh @@ -86,8 +86,8 @@ for src in main.c main_nogcc.c; do sed 's/^/ /' "$tmp/cc.log" | head -20 fail "$src does not compile" fi - if grep -qi "discards\|volatile" "$tmp/cc.log"; then - grep -i "discards\|volatile" "$tmp/cc.log" | sed 's/^/ /' | head -10 + if grep -qi -E "discards|volatile" "$tmp/cc.log"; then + grep -i -E "discards|volatile" "$tmp/cc.log" | sed 's/^/ /' | head -10 fail "$src: a volatile array is passed where a plain one is expected" fi done diff --git a/tests/integration/closure_write_through_capture/test_closure_write_through_capture.sh b/tests/integration/closure_write_through_capture/test_closure_write_through_capture.sh index 048ac4c33..25471e31a 100644 --- a/tests/integration/closure_write_through_capture/test_closure_write_through_capture.sh +++ b/tests/integration/closure_write_through_capture/test_closure_write_through_capture.sh @@ -171,7 +171,7 @@ nested 6 100 loop 2 2 1 1 float 4 string a aab!!" -got="$("$AE" run "$tmp/arrays.ae" 2>&1 | tr -d '\r' | grep -v "^warning\|^ *-->\|^ *[0-9]* |\|^ *|\|^Type checking\|^$")" +got="$("$AE" run "$tmp/arrays.ae" 2>&1 | tr -d '\r' | grep -v -E "^warning|^ *-->|^ *[0-9]* [|]|^ *[|]|^Type checking|^$")" if [ "$got" != "$want_arrays" ]; then echo " [FAIL] closure_write_through_capture: a write to a captured array did not reach the caller" printf 'got:\n%s\nwant:\n%s\n' "$got" "$want_arrays" | sed 's/^/ /' @@ -212,7 +212,7 @@ main() { println("state ${n}") } AE -got="$("$AE" run "$tmp/actor.ae" 2>&1 | tr -d '\r' | grep -v "^warning\|^ *-->\|^ *[0-9]* |\|^ *|\|^Type checking\|^$")" +got="$("$AE" run "$tmp/actor.ae" 2>&1 | tr -d '\r' | grep -v -E "^warning|^ *-->|^ *[0-9]* [|]|^ *[|]|^Type checking|^$")" if [ "$got" != "state 704" ]; then echo " [FAIL] closure_write_through_capture: a handler-local array written by a closure" printf '%s\n' "$got" | head -5 | sed 's/^/ /' @@ -252,7 +252,7 @@ field 7 nested 15 element 9 rec ab!+ 2 box n2" -got="$("$AE" run "$tmp/main.ae" 2>&1 | tr -d '\r' | grep -v "^warning\|^ *-->\|^ *[0-9]* |\|^ *|\|^Type checking\|^$")" +got="$("$AE" run "$tmp/main.ae" 2>&1 | tr -d '\r' | grep -v -E "^warning|^ *-->|^ *[0-9]* [|]|^ *[|]|^Type checking|^$")" if [ "$got" != "$want" ]; then echo " [FAIL] closure_write_through_capture: wrong values" printf 'got:\n%s\nwant:\n%s\n' "$got" "$want" | sed 's/^/ /' diff --git a/tests/integration/condition_continuation_pipe/test_condition_continuation_pipe.sh b/tests/integration/condition_continuation_pipe/test_condition_continuation_pipe.sh index e4ce155e0..963f7cd8a 100755 --- a/tests/integration/condition_continuation_pipe/test_condition_continuation_pipe.sh +++ b/tests/integration/condition_continuation_pipe/test_condition_continuation_pipe.sh @@ -26,7 +26,7 @@ log="$tmpdir/cc.log" if ! grep -q '^error' "$log"; then echo " [FAIL] leading-|| condition reported no error" fail=1 -elif ! grep -qi "closure parameters" "$log" || ! grep -qi "previous line\|parenthesise\|wrapped condition" "$log"; then +elif ! grep -qi "closure parameters" "$log" || ! grep -Eqi "previous line|parenthesise|wrapped condition" "$log"; then echo " [FAIL] leading-|| error doesn't explain the wrapped-condition cause + fix" echo " got:"; sed 's/^/ /' "$log" | head -4 fail=1 diff --git a/tests/integration/const_dependency_order/test_const_dependency_order.sh b/tests/integration/const_dependency_order/test_const_dependency_order.sh index 0a31e3f8a..060c95913 100644 --- a/tests/integration/const_dependency_order/test_const_dependency_order.sh +++ b/tests/integration/const_dependency_order/test_const_dependency_order.sh @@ -31,7 +31,7 @@ fail() { # run run() { - got="$("$AE" run "$1" 2>&1 | tr -d '\r' | grep -v "^warning\|^ *-->\|^ *[0-9]* |\|^ *|\|^Type checking\|^$")" + got="$("$AE" run "$1" 2>&1 | tr -d '\r' | grep -v -E "^warning|^ *-->|^ *[0-9]* [|]|^ *[|]|^Type checking|^$")" if [ "$got" != "$2" ]; then printf ' [FAIL] const_dependency_order: %s\ngot:\n%s\nwant:\n%s\n' \ "$1" "$got" "$2" | sed '2,$s/^/ /' @@ -89,7 +89,7 @@ expect_cycle() { tr -d '\r' < "$1.log" > "$1.txt" grep -qF -- "--> $2" "$1.txt" || fail "$1: not reported at $2" "$1.txt" grep -qF "$3" "$1.txt" || fail "$1: missing '$3'" "$1.txt" - if grep -q "undeclared\|initializer element is not constant" "$1.txt"; then + if grep -q -E "undeclared|initializer element is not constant" "$1.txt"; then fail "$1: still reported by the C compiler" "$1.txt" fi } diff --git a/tests/integration/contrib_vulkan_portability/test_contrib_vulkan_portability.sh b/tests/integration/contrib_vulkan_portability/test_contrib_vulkan_portability.sh index 060f8241e..c516dd1f7 100755 --- a/tests/integration/contrib_vulkan_portability/test_contrib_vulkan_portability.sh +++ b/tests/integration/contrib_vulkan_portability/test_contrib_vulkan_portability.sh @@ -92,7 +92,7 @@ if ! "$NM_WIN" -u "$TMP/win.o" | grep -q 'LoadLibraryA'; then echo " the _WIN32 arm was compiled out" exit 1 fi -if "$NM_WIN" -u "$TMP/win.o" | grep -q '\bdlopen\b'; then +if "$NM_WIN" -u "$TMP/win.o" | grep -qE '(^|[^A-Za-z0-9_])dlopen([^A-Za-z0-9_]|$)'; then echo " [FAIL] contrib_vulkan_portability: the Windows object references dlopen" exit 1 fi diff --git a/tests/integration/emit_csrc_cross/test_emit_csrc_cross.sh b/tests/integration/emit_csrc_cross/test_emit_csrc_cross.sh index 3f5cebbdf..6777e0868 100755 --- a/tests/integration/emit_csrc_cross/test_emit_csrc_cross.sh +++ b/tests/integration/emit_csrc_cross/test_emit_csrc_cross.sh @@ -21,6 +21,7 @@ set -e SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)" +. "$ROOT/tests/lib/portable.sh" AE="$ROOT/build/ae" SRC="$SCRIPT_DIR/mylib.ae" @@ -86,7 +87,7 @@ if command -v zig >/dev/null 2>&1; then fail "--target=$t --emit=obj was rejected" fi [ -s "$TMP/o_$t.o" ] || fail "no object emitted for $t" - desc="$(file "$TMP/o_$t.o")" + desc="$(file_desc "$TMP/o_$t.o")" case "$desc" in *"$want"*) ;; *) fail "$t object is not $want format: $desc" ;; @@ -121,9 +122,9 @@ if command -v zig >/dev/null 2>&1; then || fail "wasm32-wasi csrc differs; csrc is meant to be target-neutral" "$AE" build --target=wasm32-wasi --emit=obj "$SRC" -o "$TMP/wasi.o" >"$TMP/wasiobj" 2>&1 || { cat "$TMP/wasiobj"; fail "wasm32-wasi --emit=obj was rejected"; } - case "$(file "$TMP/wasi.o")" in + case "$(file_desc "$TMP/wasi.o")" in *WebAssembly*) ;; - *) fail "wasm32-wasi object is not a wasm module: $(file "$TMP/wasi.o")" ;; + *) fail "wasm32-wasi object is not a wasm module: $(file_desc "$TMP/wasi.o")" ;; esac # A full executable link now WORKS for wasm32-wasi (#1655). It was rejected @@ -135,9 +136,9 @@ if command -v zig >/dev/null 2>&1; then cat "$TMP/wasiexe" fail "wasm32-wasi executable link failed" fi - case "$(file "$TMP/app.wasm")" in + case "$(file_desc "$TMP/app.wasm")" in *WebAssembly*) ;; - *) fail "wasi exe is not a wasm module: $(file "$TMP/app.wasm")" ;; + *) fail "wasi exe is not a wasm module: $(file_desc "$TMP/app.wasm")" ;; esac # An ACTOR program must link too. This is the case that caught the real diff --git a/tests/integration/emit_lib/test_emit_lib.sh b/tests/integration/emit_lib/test_emit_lib.sh index e85f5927a..cc95023b2 100755 --- a/tests/integration/emit_lib/test_emit_lib.sh +++ b/tests/integration/emit_lib/test_emit_lib.sh @@ -5,12 +5,13 @@ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)" +. "$ROOT/tests/lib/syslibs.sh" pass=0 fail=0 # Platform: Linux uses .so, macOS .dylib, Windows .dll (which needs no -ldl) -LDL="-ldl" +LDL="$AE_DL_LIBS" case "$(uname -s 2>/dev/null)" in Darwin) LIB_EXT=".dylib" ;; MINGW*|MSYS*|CYGWIN*|Windows_NT) LIB_EXT=".dll"; LDL="" ;; diff --git a/tests/integration/emit_lib_accounts/test_emit_lib_accounts.sh b/tests/integration/emit_lib_accounts/test_emit_lib_accounts.sh index cbd4e4fe2..c93ea5d0a 100644 --- a/tests/integration/emit_lib_accounts/test_emit_lib_accounts.sh +++ b/tests/integration/emit_lib_accounts/test_emit_lib_accounts.sh @@ -20,6 +20,7 @@ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)" +. "$ROOT/tests/lib/syslibs.sh" AE="$ROOT/build/ae" AETHERC="$ROOT/build/aetherc" CC="${CC:-cc}" diff --git a/tests/integration/emit_lib_clause_sets/test_emit_lib_clause_sets.sh b/tests/integration/emit_lib_clause_sets/test_emit_lib_clause_sets.sh index 121c6f326..d6d85b044 100644 --- a/tests/integration/emit_lib_clause_sets/test_emit_lib_clause_sets.sh +++ b/tests/integration/emit_lib_clause_sets/test_emit_lib_clause_sets.sh @@ -27,6 +27,7 @@ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)" +. "$ROOT/tests/lib/syslibs.sh" AE="$ROOT/build/ae" if [ ! -x "$AE" ] && [ ! -x "$AE.exe" ]; then @@ -34,7 +35,7 @@ if [ ! -x "$AE" ] && [ ! -x "$AE.exe" ]; then exit 0 fi -LDL="-ldl" +LDL="$AE_DL_LIBS" case "$(uname -s 2>/dev/null)" in Darwin) LIB_EXT=".dylib" ;; MINGW*|MSYS*|CYGWIN*|Windows_NT) LIB_EXT=".dll"; LDL="" ;; diff --git a/tests/integration/emit_lib_composite/test_emit_lib_composite.sh b/tests/integration/emit_lib_composite/test_emit_lib_composite.sh index 6c3815060..6774b7083 100755 --- a/tests/integration/emit_lib_composite/test_emit_lib_composite.sh +++ b/tests/integration/emit_lib_composite/test_emit_lib_composite.sh @@ -9,6 +9,7 @@ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)" +. "$ROOT/tests/lib/syslibs.sh" LINK_FLAGS="" case "$(uname -s 2>/dev/null)" in @@ -51,7 +52,7 @@ fi # Windows the DLL is found beside the consumer; elsewhere through the rpath. case "$LIB_EXT" in .dll) ;; - *) LINK_FLAGS="-Wl,-rpath,$TMPDIR -ldl" ;; + *) LINK_FLAGS="-Wl,-rpath,$TMPDIR $AE_DL_LIBS" ;; esac # shellcheck disable=SC2086 if ! ${CC:-cc} \ diff --git a/tests/integration/emit_lib_execution_frame/test_emit_lib_execution_frame.sh b/tests/integration/emit_lib_execution_frame/test_emit_lib_execution_frame.sh index 36d21ef2e..d371b5585 100644 --- a/tests/integration/emit_lib_execution_frame/test_emit_lib_execution_frame.sh +++ b/tests/integration/emit_lib_execution_frame/test_emit_lib_execution_frame.sh @@ -19,6 +19,7 @@ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)" +. "$ROOT/tests/lib/syslibs.sh" AE="$ROOT/build/ae" AETHERC="$ROOT/build/aetherc" CC="${CC:-cc}" diff --git a/tests/integration/emit_lib_keeps_main/test_emit_lib_keeps_main.sh b/tests/integration/emit_lib_keeps_main/test_emit_lib_keeps_main.sh index 65bff3abe..e76a7206d 100755 --- a/tests/integration/emit_lib_keeps_main/test_emit_lib_keeps_main.sh +++ b/tests/integration/emit_lib_keeps_main/test_emit_lib_keeps_main.sh @@ -44,6 +44,8 @@ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)" +. "$ROOT/tests/lib/portable.sh" +. "$ROOT/tests/lib/syslibs.sh" AE="$ROOT/build/ae" AETHERC="$ROOT/build/aetherc" @@ -60,17 +62,15 @@ pass=0; fail=0 ok() { echo " [PASS] $1"; pass=$((pass + 1)); } bad() { echo " [FAIL] $1"; fail=$((fail + 1)); } -# Dynamic symbols, portably: a DLL's export table (objdump -p), GNU nm -D, -# else macOS nm -gU (leading '_'). +# Dynamic symbols, portably: a DLL's export table (objdump -p), else +# dyn_syms (tests/lib/portable.sh: GNU nm -D, macOS nm -gU, OpenBSD nm -g). syms() { case "$1" in *.dll) objdump -p "$1" 2>/dev/null | sed -n '/\[Ordinal\/Name Pointer\] Table/,/^$/p' return ;; esac - s="$(nm -D --defined-only "$1" 2>/dev/null || true)" - [ -n "$s" ] || s="$(nm -gU "$1" 2>/dev/null || true)" - printf '%s\n' "$s" + dyn_syms "$1" } exports() { # exports syms "$1" | grep -E "[[:space:]]_?$2\$" >/dev/null diff --git a/tests/integration/emit_lib_kind_safe/test_emit_lib_kind_safe.sh b/tests/integration/emit_lib_kind_safe/test_emit_lib_kind_safe.sh index 8d89279fa..a8e1fada2 100755 --- a/tests/integration/emit_lib_kind_safe/test_emit_lib_kind_safe.sh +++ b/tests/integration/emit_lib_kind_safe/test_emit_lib_kind_safe.sh @@ -20,6 +20,7 @@ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)" +. "$ROOT/tests/lib/syslibs.sh" # The host loads the library by path (dlopen, LoadLibrary on Windows) and # links it for the aether_value_* accessors. Windows finds the DLL beside @@ -33,7 +34,7 @@ esac TMPDIR="$(mktemp -d)" trap 'rm -rf "$TMPDIR"' EXIT LINK_FLAGS="" -[ "$LIB_EXT" = .dll ] || LINK_FLAGS="-Wl,-rpath,$TMPDIR -ldl" +[ "$LIB_EXT" = .dll ] || LINK_FLAGS="-Wl,-rpath,$TMPDIR $AE_DL_LIBS" pass=0 fail=0 diff --git a/tests/integration/emit_lib_lists/test_emit_lib_lists.sh b/tests/integration/emit_lib_lists/test_emit_lib_lists.sh index 8b3edd340..4ec666be4 100755 --- a/tests/integration/emit_lib_lists/test_emit_lib_lists.sh +++ b/tests/integration/emit_lib_lists/test_emit_lib_lists.sh @@ -2,6 +2,7 @@ # List-return test for --emit=lib. SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)" +. "$ROOT/tests/lib/syslibs.sh" # The host loads the library by path (dlopen, LoadLibrary on Windows) and # links it; Windows finds the DLL beside the host, with no rpath or -ldl. @@ -13,7 +14,7 @@ esac TMPDIR="$(mktemp -d)"; trap 'rm -rf "$TMPDIR"' EXIT LINK_FLAGS="" -[ "$LIB_EXT" = .dll ] || LINK_FLAGS="-Wl,-rpath,$TMPDIR -ldl" +[ "$LIB_EXT" = .dll ] || LINK_FLAGS="-Wl,-rpath,$TMPDIR $AE_DL_LIBS" pass=0; fail=0 cd "$SCRIPT_DIR" diff --git a/tests/integration/emit_lib_net/test_emit_lib_net.sh b/tests/integration/emit_lib_net/test_emit_lib_net.sh index 9bf280054..939d0a309 100755 --- a/tests/integration/emit_lib_net/test_emit_lib_net.sh +++ b/tests/integration/emit_lib_net/test_emit_lib_net.sh @@ -7,6 +7,7 @@ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)" +. "$ROOT/tests/lib/syslibs.sh" # The driver loads the library by path: dlopen (-ldl on Linux), or # LoadLibrary on Windows. @@ -14,7 +15,7 @@ LDL="" case "$(uname -s 2>/dev/null)" in MINGW*|MSYS*|CYGWIN*|Windows_NT) LIB_EXT=".dll" ;; Darwin) LIB_EXT=".dylib" ;; - *) LIB_EXT=".so"; LDL="-ldl" ;; + *) LIB_EXT=".so"; LDL="$AE_DL_LIBS" ;; esac TMPDIR="$(mktemp -d)" diff --git a/tests/integration/emit_lib_primitives/test_emit_lib_primitives.sh b/tests/integration/emit_lib_primitives/test_emit_lib_primitives.sh index a1854d8bc..6f5eeaad3 100755 --- a/tests/integration/emit_lib_primitives/test_emit_lib_primitives.sh +++ b/tests/integration/emit_lib_primitives/test_emit_lib_primitives.sh @@ -2,6 +2,7 @@ # int64/bool/float primitive round-trip for --emit=lib. SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)" +. "$ROOT/tests/lib/syslibs.sh" # The host loads the library by path (dlopen, LoadLibrary on Windows) and # links it; Windows finds the DLL beside the host, with no rpath or -ldl. @@ -13,7 +14,7 @@ esac TMPDIR="$(mktemp -d)"; trap 'rm -rf "$TMPDIR"' EXIT LINK_FLAGS="" -[ "$LIB_EXT" = .dll ] || LINK_FLAGS="-Wl,-rpath,$TMPDIR -ldl" +[ "$LIB_EXT" = .dll ] || LINK_FLAGS="-Wl,-rpath,$TMPDIR $AE_DL_LIBS" pass=0; fail=0 cd "$SCRIPT_DIR" diff --git a/tests/integration/emit_lib_typed_ptr/test_emit_lib_typed_ptr.sh b/tests/integration/emit_lib_typed_ptr/test_emit_lib_typed_ptr.sh index 4f42a5694..22b04b27e 100755 --- a/tests/integration/emit_lib_typed_ptr/test_emit_lib_typed_ptr.sh +++ b/tests/integration/emit_lib_typed_ptr/test_emit_lib_typed_ptr.sh @@ -8,6 +8,7 @@ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)" +. "$ROOT/tests/lib/syslibs.sh" # The host loads the library by path: dlopen (-ldl on Linux), or # LoadLibrary on Windows. @@ -15,7 +16,7 @@ LDL="" case "$(uname -s 2>/dev/null)" in MINGW*|MSYS*|CYGWIN*|Windows_NT) LIB_EXT=".dll" ;; Darwin) LIB_EXT=".dylib" ;; - *) LIB_EXT=".so"; LDL="-ldl" ;; + *) LIB_EXT=".so"; LDL="$AE_DL_LIBS" ;; esac TMPDIR="$(mktemp -d)" diff --git a/tests/integration/emit_lib_unsupported/test_emit_lib_unsupported.sh b/tests/integration/emit_lib_unsupported/test_emit_lib_unsupported.sh index 15b17c2f3..d0de2cd4a 100755 --- a/tests/integration/emit_lib_unsupported/test_emit_lib_unsupported.sh +++ b/tests/integration/emit_lib_unsupported/test_emit_lib_unsupported.sh @@ -42,7 +42,7 @@ else # Check (c) — a warning mentions the skipped function. if grep -q "takes_optional" "$TMPDIR/stderr.log" && \ - grep -q "skipping alias stub\|representable in the" "$TMPDIR/stderr.log"; then + grep -q -E "skipping alias stub|representable in the" "$TMPDIR/stderr.log"; then echo " [PASS] warning emitted for unsupported param type" pass=$((pass + 1)) else diff --git a/tests/integration/emit_lib_windows_dll/test_emit_lib_windows_dll.sh b/tests/integration/emit_lib_windows_dll/test_emit_lib_windows_dll.sh index ba7adcbc9..dff79da50 100644 --- a/tests/integration/emit_lib_windows_dll/test_emit_lib_windows_dll.sh +++ b/tests/integration/emit_lib_windows_dll/test_emit_lib_windows_dll.sh @@ -38,7 +38,7 @@ AE # /build, so name it) if ! (cd "$tmp" && "$AE" build --emit=lib mathlib.ae -o "$tmp/libmathlib.dll" > "$tmp/build.log" 2>&1); then echo " [FAIL] emit_lib_windows_dll: ae build --emit=lib failed" - grep -i "undefined\|error" "$tmp/build.log" | head -3 | sed 's/^/ /' + grep -i -E "undefined|error" "$tmp/build.log" | head -3 | sed 's/^/ /' exit 1 fi dll="$(find "$tmp" -name 'libmathlib.dll' | head -1)" @@ -101,7 +101,7 @@ mkdir -p "$tmp/ns" cp "$ROOT/tests/integration/namespace_basic/manifest.ae" "$ROOT/tests/integration/namespace_basic/hello.ae" "$tmp/ns/" if ! (cd "$tmp/ns" && AETHER_HOME="$ROOT" "$AE" build --namespace . > "$tmp/ns.log" 2>&1); then echo " [FAIL] emit_lib_windows_dll: ae build --namespace . failed" - grep -iv "^\s*$" "$tmp/ns.log" | head -4 | sed 's/^/ /' + grep -iv "^[[:space:]]*$" "$tmp/ns.log" | head -4 | sed 's/^/ /' fail=1 elif [ ! -f "$tmp/ns/libgreet.dll" ]; then echo " [FAIL] emit_lib_windows_dll: --namespace did not produce libgreet.dll (named from the manifest)" diff --git a/tests/integration/emit_lib_with_capability/test_emit_lib_with_capability.sh b/tests/integration/emit_lib_with_capability/test_emit_lib_with_capability.sh index 5aedf3ddd..1a6ea6836 100755 --- a/tests/integration/emit_lib_with_capability/test_emit_lib_with_capability.sh +++ b/tests/integration/emit_lib_with_capability/test_emit_lib_with_capability.sh @@ -40,7 +40,7 @@ run_case() { fail=$((fail + 1)) fi else - if [ "$rc" -ne 0 ] && grep -q "capability-empty\|--with=" "$TMPDIR/stderr"; then + if [ "$rc" -ne 0 ] && grep -q -E "capability-empty|--with=" "$TMPDIR/stderr"; then echo " [PASS] $label"; pass=$((pass + 1)) else echo " [FAIL] $label — expected reject (rc=$rc, stderr:)" diff --git a/tests/integration/eval_order_left_to_right/test_eval_order_left_to_right.sh b/tests/integration/eval_order_left_to_right/test_eval_order_left_to_right.sh index 4f485359d..537108d64 100644 --- a/tests/integration/eval_order_left_to_right/test_eval_order_left_to_right.sh +++ b/tests/integration/eval_order_left_to_right/test_eval_order_left_to_right.sh @@ -129,7 +129,7 @@ global 11 23 closure 55 pointer 22 message 12 2" -got="$("$AE" run "$tmp/main.ae" 2>&1 | tr -d '\r' | grep -v "^warning\|^ *-->\|^ *[0-9]* |\|^ *|\|^Type checking\|^$")" +got="$("$AE" run "$tmp/main.ae" 2>&1 | tr -d '\r' | grep -v -E "^warning|^ *-->|^ *[0-9]* [|]|^ *[|]|^Type checking|^$")" if [ "$got" != "$want" ]; then echo " [FAIL] eval_order_left_to_right: operands not evaluated left to right" printf 'got:\n%s\nwant:\n%s\n' "$got" "$want" | sed 's/^/ /' diff --git a/tests/integration/f32_arithmetic/test_f32_arithmetic.sh b/tests/integration/f32_arithmetic/test_f32_arithmetic.sh index 0fa160e97..ac0e1b490 100644 --- a/tests/integration/f32_arithmetic/test_f32_arithmetic.sh +++ b/tests/integration/f32_arithmetic/test_f32_arithmetic.sh @@ -52,7 +52,7 @@ main() { } AE -got="$("$AE" run "$tmp/main.ae" 2>&1 | grep -v "^warning\|^ *-->\|^ *[0-9]* |\|^ *|\|^Type checking\|^$" | tr '\n' ' ')" +got="$("$AE" run "$tmp/main.ae" 2>&1 | grep -v -E "^warning|^ *-->|^ *[0-9]* [|]|^ *[|]|^Type checking|^$" | tr '\n' ' ')" if [ "$got" != "float-exact true 14 1 0.05 0.2 2.15 0.4 0.05 -0.05 0.05 -0.05 true " ]; then echo " [FAIL] f32_arithmetic: program output (got '$got')" fail=1 diff --git a/tests/integration/fixed_array_capture_and_state/test_fixed_array_capture_and_state.sh b/tests/integration/fixed_array_capture_and_state/test_fixed_array_capture_and_state.sh index 2c1c43b1c..3beff01e7 100644 --- a/tests/integration/fixed_array_capture_and_state/test_fixed_array_capture_and_state.sh +++ b/tests/integration/fixed_array_capture_and_state/test_fixed_array_capture_and_state.sh @@ -72,7 +72,7 @@ h 4 pick bo outer 1 state 970" -got="$("$AE" run "$tmp/main.ae" 2>&1 | tr -d '\r' | grep -v "^warning\|^ *-->\|^ *[0-9]* |\|^ *|\|^Type checking\|^$")" +got="$("$AE" run "$tmp/main.ae" 2>&1 | tr -d '\r' | grep -v -E "^warning|^ *-->|^ *[0-9]* [|]|^ *[|]|^Type checking|^$")" if [ "$got" != "$want" ]; then echo " [FAIL] fixed_array_capture_and_state: wrong output" printf 'got:\n%s\nwant:\n%s\n' "$got" "$want" | sed 's/^/ /' diff --git a/tests/integration/fmt_gate/test_fmt_gate.sh b/tests/integration/fmt_gate/test_fmt_gate.sh index 706e9aa27..fba666ee6 100755 --- a/tests/integration/fmt_gate/test_fmt_gate.sh +++ b/tests/integration/fmt_gate/test_fmt_gate.sh @@ -28,6 +28,7 @@ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)" . "$ROOT/tests/lib/same_bytes.sh" +. "$ROOT/tests/lib/portable.sh" AE="$ROOT/build/ae" AETHERC="$ROOT/build/aetherc" @@ -157,7 +158,7 @@ find examples tests -name '*.ae' -type f 2>/dev/null | LC_ALL=C sort | \ # custom_lib_dir/.mylib; and what --check lists is then the sample's path. mkdir "$TMPDIR/idem" TOTAL=$(awk 'END { print NR }' "$TMPDIR/sample.txt") -if ! tar cf - -T "$TMPDIR/sample.txt" | (cd "$TMPDIR/idem" && tar xf -) || +if ! copy_listed "$TMPDIR/idem" < "$TMPDIR/sample.txt" || [ "$(find "$TMPDIR/idem" -type f | wc -l | tr -d ' ')" != "$TOTAL" ]; then echo " [FAIL] fmt_gate: could not copy the $TOTAL sampled files for the idempotence tier" exit 1 diff --git a/tests/integration/fn_param_call_dispatch/test_fn_param_call_dispatch.sh b/tests/integration/fn_param_call_dispatch/test_fn_param_call_dispatch.sh index 8b046ca03..e0b955a6c 100644 --- a/tests/integration/fn_param_call_dispatch/test_fn_param_call_dispatch.sh +++ b/tests/integration/fn_param_call_dispatch/test_fn_param_call_dispatch.sh @@ -63,7 +63,7 @@ twice 3 twice h 14 maker's f 5 k 7" -got="$("$AE" run "$tmp/main.ae" 2>&1 | tr -d '\r' | grep -v "^warning\|^ *-->\|^ *[0-9]* |\|^ *|\|^Type checking\|^$")" +got="$("$AE" run "$tmp/main.ae" 2>&1 | tr -d '\r' | grep -v -E "^warning|^ *-->|^ *[0-9]* [|]|^ *[|]|^Type checking|^$")" if [ "$got" != "$want" ]; then echo " [FAIL] fn_param_call_dispatch: a call on an fn parameter did not go through its value" printf 'got:\n%s\nwant:\n%s\n' "$got" "$want" | sed 's/^/ /' diff --git a/tests/integration/fs_open_binary_mode/test_fs_open_binary_mode.sh b/tests/integration/fs_open_binary_mode/test_fs_open_binary_mode.sh index bf976449c..e72a2bb62 100644 --- a/tests/integration/fs_open_binary_mode/test_fs_open_binary_mode.sh +++ b/tests/integration/fs_open_binary_mode/test_fs_open_binary_mode.sh @@ -72,7 +72,7 @@ pread 6 true crlf 6 true append size 8 wt true ' -got="$(AETHER_HOME="$ROOT" "$AE" run "$tmp/main.ae" -- "$tmp" 2>&1 | grep -v "^warning\|^ *-->\|^ *[0-9]* |\|^ *|\|^Type checking\|^$")" +got="$(AETHER_HOME="$ROOT" "$AE" run "$tmp/main.ae" -- "$tmp" 2>&1 | grep -v -E "^warning|^ *-->|^ *[0-9]* [|]|^ *[|]|^Type checking|^$")" if [ "$got" != "$want" ]; then echo " [FAIL] fs_open_binary_mode: output differs" printf '%s\n' "$got" | head -8 | sed 's/^/ /' diff --git a/tests/integration/function_clause_string_pattern/test_function_clause_string_pattern.sh b/tests/integration/function_clause_string_pattern/test_function_clause_string_pattern.sh index 6759415a4..85026805c 100644 --- a/tests/integration/function_clause_string_pattern/test_function_clause_string_pattern.sh +++ b/tests/integration/function_clause_string_pattern/test_function_clause_string_pattern.sh @@ -45,7 +45,7 @@ hello amy quoted hi bob! 1 2 3' -got="$("$AE" run "$tmp/main.ae" 2>&1 | tr -d '\r' | grep -v "^warning\|^ *-->\|^ *[0-9]* |\|^ *|\|^Type checking\|^$")" +got="$("$AE" run "$tmp/main.ae" 2>&1 | tr -d '\r' | grep -v -E "^warning|^ *-->|^ *[0-9]* [|]|^ *[|]|^Type checking|^$")" if [ "$got" != "$want" ]; then echo " [FAIL] function_clause_string_pattern: wrong output" printf 'got:\n%s\nwant:\n%s\n' "$got" "$want" | sed 's/^/ /' diff --git a/tests/integration/host_bridge_import_link/test_host_bridge_import_link.sh b/tests/integration/host_bridge_import_link/test_host_bridge_import_link.sh index adb91d092..cd1afd657 100755 --- a/tests/integration/host_bridge_import_link/test_host_bridge_import_link.sh +++ b/tests/integration/host_bridge_import_link/test_host_bridge_import_link.sh @@ -103,7 +103,7 @@ elif ! grep -q "libaether_host_definitelynothere.a" "$tmpdir/c.log"; then echo " [FAIL] host_bridge_import_link C: error did not name the missing .a" sed 's/^/ /' "$tmpdir/c.log" | head -5 fail=1 -elif ! grep -q "make contrib\|install-contrib" "$tmpdir/c.log"; then +elif ! grep -q -E "make contrib|install-contrib" "$tmpdir/c.log"; then echo " [FAIL] host_bridge_import_link C: error did not point at remediation" sed 's/^/ /' "$tmpdir/c.log" | head -5 fail=1 diff --git a/tests/integration/host_child_signal_safe/test_host_child_signal_safe.sh b/tests/integration/host_child_signal_safe/test_host_child_signal_safe.sh index 028d9a632..e60fb39f3 100755 --- a/tests/integration/host_child_signal_safe/test_host_child_signal_safe.sh +++ b/tests/integration/host_child_signal_safe/test_host_child_signal_safe.sh @@ -9,6 +9,7 @@ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)" +. "$ROOT/tests/lib/syslibs.sh" case "$(uname -s 2>/dev/null)" in Linux) ;; @@ -42,7 +43,7 @@ if ! ${CC:-cc} $INC -I"$ROOT/contrib/host/aether" \ # shellcheck disable=SC2086 if ! ${CC:-cc} $INC -I"$ROOT/contrib/host/aether" \ -o "$TMP/harness" $SRC "$ROOT/build/libaether.a" \ - -lpthread -ldl -lm -lrt -lz -lssl -lcrypto 2>"$TMP/cc.err"; then + -lpthread $AE_DL_LIBS -lm $AE_RT_LIBS -lz -lssl -lcrypto 2>"$TMP/cc.err"; then echo " [FAIL] could not link the harness against the host and libaether.a" sed 's/^/ /' "$TMP/cc.err" | head -8 exit 1 diff --git a/tests/integration/http_h2_concurrent_dispatch/test_http_h2_concurrent_dispatch.sh b/tests/integration/http_h2_concurrent_dispatch/test_http_h2_concurrent_dispatch.sh index c4e8c2644..d8429fcec 100755 --- a/tests/integration/http_h2_concurrent_dispatch/test_http_h2_concurrent_dispatch.sh +++ b/tests/integration/http_h2_concurrent_dispatch/test_http_h2_concurrent_dispatch.sh @@ -35,6 +35,7 @@ set -e SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)" +. "$ROOT/tests/lib/portable.sh" . "$ROOT/tests/lib/wait_port.sh" . "$ROOT/tests/lib/server_jobs.sh" AE="$ROOT/build/ae" @@ -147,7 +148,7 @@ run_parallel() { while [ $j -lt "$n" ]; do if ! grep -q "^slow:s=$j\$" "$PAR_DIR/n$j" 2>/dev/null; then echo " [WARN] parallel x$n stream $j body mismatch on attempt $label:" >&2 - head -c 200 "$PAR_DIR/n$j" >&2 + head_c 200 "$PAR_DIR/n$j" >&2 echo >&2 return 1 fi diff --git a/tests/integration/http_proxy_direct_equivalence/test_http_proxy_direct_equivalence.sh b/tests/integration/http_proxy_direct_equivalence/test_http_proxy_direct_equivalence.sh index ac2292653..df5b407a0 100755 --- a/tests/integration/http_proxy_direct_equivalence/test_http_proxy_direct_equivalence.sh +++ b/tests/integration/http_proxy_direct_equivalence/test_http_proxy_direct_equivalence.sh @@ -14,6 +14,7 @@ set -e SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)" +. "$ROOT/tests/lib/portable.sh" AE="$ROOT/build/ae" SRC="$ROOT/tests/integration/http_reverse_proxy/server.ae" @@ -35,7 +36,7 @@ if ! AETHER_HOME="$ROOT" "$AE" build "$SRC" -o "$TMPDIR/server" >"$TMPDIR/build. echo " [FAIL] build:"; head -20 "$TMPDIR/build.log"; exit 1 fi -head -c 2048 /dev/urandom > "$TMPDIR/post.in" 2>/dev/null || \ +head_c 2048 /dev/urandom > "$TMPDIR/post.in" 2>/dev/null || \ { i=0; while [ $i -lt 64 ]; do printf 'payload-0123456789abcdef'; i=$((i+1)); done > "$TMPDIR/post.in"; } wait_ready() { @@ -57,6 +58,14 @@ UP_PID=$! wait_ready "$UP_PID" "$TMPDIR/up.log" upstream UP_PORT=$(read_ready_port "$TMPDIR/up.log") || exit 1 +# fix_length : add delta to the file's Content-Length. +fix_length() { + LC_ALL=C awk -v d="$2" ' + tolower(substr($0, 1, 15)) == "content-length:" { + printf "%s %d\r\n", substr($0, 1, 15), substr($0, 16) + d; next } + { print }' "$1" > "$1.norm" && mv "$1.norm" "$1" +} + # capture