test: label expected source read failures

This commit is contained in:
udo 2026-07-14 06:23:50 +00:00
parent afb17fc334
commit d7f4749f9f
3 changed files with 12 additions and 5 deletions

View File

@ -155,7 +155,10 @@ the source. An unreadable path is reported as a source-read failure with a
persisted diagnostic; it never becomes an apparently valid empty side module or
a generic compiler error. Source signatures mark unreadable inputs, so correcting
access invalidates that failure and permits a normal retry without changing
signatures for ordinary readable files.
signatures for ordinary readable files. The private CLI harness may label its
intentional unreadable-source regression request as an expected source-read
failure, keeping production log scans focused on real runtime failures while
preserving the failing compile result and diagnostic artifacts.
---

View File

@ -64,7 +64,7 @@ fi
printf '%s\n' 'CLI(Request& context) { print("readable-source-marker"); }' >"$source_dir/unreadable.uce"
chmod 000 "$source_dir/unreadable.uce"
if unreadable_output=$(scripts/uce-cli "/$test_name/unreadable.uce" 2>&1); then
if unreadable_output=$(scripts/uce-cli --get "/$test_name/unreadable.uce" __uce_expected_source_read_failure=1 2>&1); then
echo "unreadable source unexpectedly compiled: $unreadable_output" >&2
exit 1
fi

View File

@ -817,9 +817,13 @@ String compiler_format_compile_failure(SharedUnit* su, String raw_messages)
return(result);
}
String compiler_format_source_read_failure(SharedUnit* su, String raw_messages)
String compiler_format_source_read_failure(Request* context, SharedUnit* su, String raw_messages)
{
String result = "UCE source read failure\n";
bool expected_cli_failure =
context &&
context->resources.is_cli &&
first(context->get["__uce_expected_source_read_failure"], context->post["__uce_expected_source_read_failure"]) == "1";
String result = expected_cli_failure ? "UCE expected source read failure\n" : "UCE source read failure\n";
result += "Source: " + su->file_name + "\n";
result += "Compile output: " + su->compile_output_file_name + "\n";
result += "\nMessage:\n" + trim(raw_messages) + "\n";
@ -851,7 +855,7 @@ void compile_shared_unit(Request* context, SharedUnit* su)
file_put_contents(su->meta_file_name, compiler_unit_metadata_text(context, su));
file_unlink(su->wasm_name);
compiler_record_compile_result(su, time_precise() - comp_start, false, "compile_error", su->compiler_messages);
printf("%s \n", compiler_format_source_read_failure(su, su->compiler_messages).c_str());
printf("%s \n", compiler_format_source_read_failure(context, su, su->compiler_messages).c_str());
return;
}