From 65a8583565eca8aad4b02e566524d394f619005b Mon Sep 17 00:00:00 2001 From: Tom French Date: Thu, 14 Mar 2024 19:22:28 +0000 Subject: [PATCH] chore: separate execution failures from compilation failures --- .../brillig_nested_slices/Prover.toml | 2 - .../custom_entry_not_found/Prover.toml | 1 - .../dep_impl_primitive/Prover.toml | 1 - .../compile_failure/depend_on_bin/Prover.toml | 1 - .../div_by_zero_modulo/Prover.toml | 0 .../dup_trait_implementation_4/Prover.toml | 0 .../dup_trait_implementation_5/Prover.toml | 0 .../dup_trait_items_1/Prover.toml | 0 .../dup_trait_items_2/Prover.toml | 0 .../dup_trait_items_3/Prover.toml | 0 .../dup_trait_items_4/Prover.toml | 0 .../dup_trait_items_5/Prover.toml | 0 .../dup_trait_items_6/Prover.toml | 0 .../hashmap_load_factor/Prover.toml | 26 ------------ .../negate_unsigned/Prover.toml | 0 .../orphaned_trait_impl/Prover.toml | 2 - .../slice_remove_failure/Prover.toml | 2 - .../crates/a/Prover.toml | 2 - .../crates/b/Prover.toml | 2 - .../assert_msg_runtime/Nargo.toml | 0 .../assert_msg_runtime/Prover.toml | 0 .../assert_msg_runtime/src/main.nr | 0 .../brillig_assert_fail/Nargo.toml | 0 .../brillig_assert_fail/Prover.toml | 0 .../brillig_assert_fail/src/main.nr | 0 .../brillig_assert_msg_runtime/Nargo.toml | 0 .../brillig_assert_msg_runtime/Prover.toml | 0 .../brillig_assert_msg_runtime/src/main.nr | 0 .../div_by_zero_constants/Nargo.toml | 0 .../div_by_zero_constants}/Prover.toml | 0 .../div_by_zero_constants/src/main.nr | 0 .../div_by_zero_modulo/Nargo.toml | 0 .../div_by_zero_modulo}/Prover.toml | 0 .../div_by_zero_modulo/src/main.nr | 0 .../div_by_zero_numerator_witness/Nargo.toml | 0 .../div_by_zero_numerator_witness/Prover.toml | 0 .../div_by_zero_numerator_witness/src/main.nr | 0 .../div_by_zero_witness/Nargo.toml | 0 .../div_by_zero_witness/Prover.toml | 0 .../div_by_zero_witness/src/main.nr | 0 .../dyn_index_fail_nested_array/Nargo.toml | 0 .../dyn_index_fail_nested_array/Prover.toml | 0 .../dyn_index_fail_nested_array/src/main.nr | 0 .../dynamic_index_failure/Nargo.toml | 0 .../dynamic_index_failure/Prover.toml | 0 .../dynamic_index_failure/src/main.nr | 0 .../option_expect/Nargo.toml | 0 .../option_expect/src/main.nr | 0 .../slice_access_failure/Nargo.toml | 0 .../slice_access_failure}/Prover.toml | 0 .../slice_access_failure/src/main.nr | 0 .../slice_insert_failure/Nargo.toml | 0 .../slice_insert_failure}/Prover.toml | 0 .../slice_insert_failure/src/main.nr | 0 .../slice_remove_failure/Nargo.toml | 0 .../slice_remove_failure}/Prover.toml | 0 .../slice_remove_failure/src/main.nr | 0 .../workspace_fail/Nargo.toml | 0 .../workspace_fail/crates/a/Nargo.toml | 0 .../workspace_fail/crates/a/Prover.toml | 0 .../workspace_fail/crates/a/src/main.nr | 0 .../workspace_fail/crates/b/Nargo.toml | 0 .../workspace_fail/crates/b/Prover.toml | 0 .../workspace_fail/crates/b/src/main.nr | 0 tooling/nargo_cli/build.rs | 41 ++++++++++++++++++- 65 files changed, 40 insertions(+), 40 deletions(-) delete mode 100644 test_programs/compile_failure/brillig_nested_slices/Prover.toml delete mode 100644 test_programs/compile_failure/custom_entry_not_found/Prover.toml delete mode 100644 test_programs/compile_failure/dep_impl_primitive/Prover.toml delete mode 100644 test_programs/compile_failure/depend_on_bin/Prover.toml delete mode 100644 test_programs/compile_failure/div_by_zero_modulo/Prover.toml delete mode 100644 test_programs/compile_failure/dup_trait_implementation_4/Prover.toml delete mode 100644 test_programs/compile_failure/dup_trait_implementation_5/Prover.toml delete mode 100644 test_programs/compile_failure/dup_trait_items_1/Prover.toml delete mode 100644 test_programs/compile_failure/dup_trait_items_2/Prover.toml delete mode 100644 test_programs/compile_failure/dup_trait_items_3/Prover.toml delete mode 100644 test_programs/compile_failure/dup_trait_items_4/Prover.toml delete mode 100644 test_programs/compile_failure/dup_trait_items_5/Prover.toml delete mode 100644 test_programs/compile_failure/dup_trait_items_6/Prover.toml delete mode 100644 test_programs/compile_failure/hashmap_load_factor/Prover.toml delete mode 100644 test_programs/compile_failure/negate_unsigned/Prover.toml delete mode 100644 test_programs/compile_failure/orphaned_trait_impl/Prover.toml delete mode 100644 test_programs/compile_failure/slice_remove_failure/Prover.toml delete mode 100644 test_programs/compile_failure/workspace_missing_toml/crates/a/Prover.toml delete mode 100644 test_programs/compile_failure/workspace_missing_toml/crates/b/Prover.toml rename test_programs/{compile_failure => execution_failure}/assert_msg_runtime/Nargo.toml (100%) rename test_programs/{compile_failure => execution_failure}/assert_msg_runtime/Prover.toml (100%) rename test_programs/{compile_failure => execution_failure}/assert_msg_runtime/src/main.nr (100%) rename test_programs/{compile_failure => execution_failure}/brillig_assert_fail/Nargo.toml (100%) rename test_programs/{compile_failure => execution_failure}/brillig_assert_fail/Prover.toml (100%) rename test_programs/{compile_failure => execution_failure}/brillig_assert_fail/src/main.nr (100%) rename test_programs/{compile_failure => execution_failure}/brillig_assert_msg_runtime/Nargo.toml (100%) rename test_programs/{compile_failure => execution_failure}/brillig_assert_msg_runtime/Prover.toml (100%) rename test_programs/{compile_failure => execution_failure}/brillig_assert_msg_runtime/src/main.nr (100%) rename test_programs/{compile_failure => execution_failure}/div_by_zero_constants/Nargo.toml (100%) rename test_programs/{compile_failure/cyclic_dep => execution_failure/div_by_zero_constants}/Prover.toml (100%) rename test_programs/{compile_failure => execution_failure}/div_by_zero_constants/src/main.nr (100%) rename test_programs/{compile_failure => execution_failure}/div_by_zero_modulo/Nargo.toml (100%) rename test_programs/{compile_failure/div_by_zero_constants => execution_failure/div_by_zero_modulo}/Prover.toml (100%) rename test_programs/{compile_failure => execution_failure}/div_by_zero_modulo/src/main.nr (100%) rename test_programs/{compile_failure => execution_failure}/div_by_zero_numerator_witness/Nargo.toml (100%) rename test_programs/{compile_failure => execution_failure}/div_by_zero_numerator_witness/Prover.toml (100%) rename test_programs/{compile_failure => execution_failure}/div_by_zero_numerator_witness/src/main.nr (100%) rename test_programs/{compile_failure => execution_failure}/div_by_zero_witness/Nargo.toml (100%) rename test_programs/{compile_failure => execution_failure}/div_by_zero_witness/Prover.toml (100%) rename test_programs/{compile_failure => execution_failure}/div_by_zero_witness/src/main.nr (100%) rename test_programs/{compile_failure => execution_failure}/dyn_index_fail_nested_array/Nargo.toml (100%) rename test_programs/{compile_failure => execution_failure}/dyn_index_fail_nested_array/Prover.toml (100%) rename test_programs/{compile_failure => execution_failure}/dyn_index_fail_nested_array/src/main.nr (100%) rename test_programs/{compile_failure => execution_failure}/dynamic_index_failure/Nargo.toml (100%) rename test_programs/{compile_failure => execution_failure}/dynamic_index_failure/Prover.toml (100%) rename test_programs/{compile_failure => execution_failure}/dynamic_index_failure/src/main.nr (100%) rename test_programs/{compile_failure => execution_failure}/option_expect/Nargo.toml (100%) rename test_programs/{compile_failure => execution_failure}/option_expect/src/main.nr (100%) rename test_programs/{compile_failure => execution_failure}/slice_access_failure/Nargo.toml (100%) rename test_programs/{compile_failure/radix_non_constant_length => execution_failure/slice_access_failure}/Prover.toml (100%) rename test_programs/{compile_failure => execution_failure}/slice_access_failure/src/main.nr (100%) rename test_programs/{compile_failure => execution_failure}/slice_insert_failure/Nargo.toml (100%) rename test_programs/{compile_failure/slice_access_failure => execution_failure/slice_insert_failure}/Prover.toml (100%) rename test_programs/{compile_failure => execution_failure}/slice_insert_failure/src/main.nr (100%) rename test_programs/{compile_failure => execution_failure}/slice_remove_failure/Nargo.toml (100%) rename test_programs/{compile_failure/slice_insert_failure => execution_failure/slice_remove_failure}/Prover.toml (100%) rename test_programs/{compile_failure => execution_failure}/slice_remove_failure/src/main.nr (100%) rename test_programs/{compile_failure => execution_failure}/workspace_fail/Nargo.toml (100%) rename test_programs/{compile_failure => execution_failure}/workspace_fail/crates/a/Nargo.toml (100%) rename test_programs/{compile_failure => execution_failure}/workspace_fail/crates/a/Prover.toml (100%) rename test_programs/{compile_failure => execution_failure}/workspace_fail/crates/a/src/main.nr (100%) rename test_programs/{compile_failure => execution_failure}/workspace_fail/crates/b/Nargo.toml (100%) rename test_programs/{compile_failure => execution_failure}/workspace_fail/crates/b/Prover.toml (100%) rename test_programs/{compile_failure => execution_failure}/workspace_fail/crates/b/src/main.nr (100%) diff --git a/test_programs/compile_failure/brillig_nested_slices/Prover.toml b/test_programs/compile_failure/brillig_nested_slices/Prover.toml deleted file mode 100644 index c52564de922..00000000000 --- a/test_programs/compile_failure/brillig_nested_slices/Prover.toml +++ /dev/null @@ -1,2 +0,0 @@ -a = "5" -b = "10" diff --git a/test_programs/compile_failure/custom_entry_not_found/Prover.toml b/test_programs/compile_failure/custom_entry_not_found/Prover.toml deleted file mode 100644 index 4dd6b405159..00000000000 --- a/test_programs/compile_failure/custom_entry_not_found/Prover.toml +++ /dev/null @@ -1 +0,0 @@ -x = "1" diff --git a/test_programs/compile_failure/dep_impl_primitive/Prover.toml b/test_programs/compile_failure/dep_impl_primitive/Prover.toml deleted file mode 100644 index 7d4290a117a..00000000000 --- a/test_programs/compile_failure/dep_impl_primitive/Prover.toml +++ /dev/null @@ -1 +0,0 @@ -x = 1 diff --git a/test_programs/compile_failure/depend_on_bin/Prover.toml b/test_programs/compile_failure/depend_on_bin/Prover.toml deleted file mode 100644 index 7d4290a117a..00000000000 --- a/test_programs/compile_failure/depend_on_bin/Prover.toml +++ /dev/null @@ -1 +0,0 @@ -x = 1 diff --git a/test_programs/compile_failure/div_by_zero_modulo/Prover.toml b/test_programs/compile_failure/div_by_zero_modulo/Prover.toml deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/test_programs/compile_failure/dup_trait_implementation_4/Prover.toml b/test_programs/compile_failure/dup_trait_implementation_4/Prover.toml deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/test_programs/compile_failure/dup_trait_implementation_5/Prover.toml b/test_programs/compile_failure/dup_trait_implementation_5/Prover.toml deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/test_programs/compile_failure/dup_trait_items_1/Prover.toml b/test_programs/compile_failure/dup_trait_items_1/Prover.toml deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/test_programs/compile_failure/dup_trait_items_2/Prover.toml b/test_programs/compile_failure/dup_trait_items_2/Prover.toml deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/test_programs/compile_failure/dup_trait_items_3/Prover.toml b/test_programs/compile_failure/dup_trait_items_3/Prover.toml deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/test_programs/compile_failure/dup_trait_items_4/Prover.toml b/test_programs/compile_failure/dup_trait_items_4/Prover.toml deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/test_programs/compile_failure/dup_trait_items_5/Prover.toml b/test_programs/compile_failure/dup_trait_items_5/Prover.toml deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/test_programs/compile_failure/dup_trait_items_6/Prover.toml b/test_programs/compile_failure/dup_trait_items_6/Prover.toml deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/test_programs/compile_failure/hashmap_load_factor/Prover.toml b/test_programs/compile_failure/hashmap_load_factor/Prover.toml deleted file mode 100644 index e54319c61e9..00000000000 --- a/test_programs/compile_failure/hashmap_load_factor/Prover.toml +++ /dev/null @@ -1,26 +0,0 @@ -# Expected 6 key-value entries for hashmap capacity of 8. -# These must be distinct (both key-to-key, and value-to-value) for correct testing. - -[[input]] -key = 2 -value = 17 - -[[input]] -key = 3 -value = 19 - -[[input]] -key = 5 -value = 23 - -[[input]] -key = 7 -value = 29 - -[[input]] -key = 11 -value = 31 - -[[input]] -key = 41 -value = 43 \ No newline at end of file diff --git a/test_programs/compile_failure/negate_unsigned/Prover.toml b/test_programs/compile_failure/negate_unsigned/Prover.toml deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/test_programs/compile_failure/orphaned_trait_impl/Prover.toml b/test_programs/compile_failure/orphaned_trait_impl/Prover.toml deleted file mode 100644 index 2c1854573a4..00000000000 --- a/test_programs/compile_failure/orphaned_trait_impl/Prover.toml +++ /dev/null @@ -1,2 +0,0 @@ -x = 1 -y = 2 diff --git a/test_programs/compile_failure/slice_remove_failure/Prover.toml b/test_programs/compile_failure/slice_remove_failure/Prover.toml deleted file mode 100644 index f28f2f8cc48..00000000000 --- a/test_programs/compile_failure/slice_remove_failure/Prover.toml +++ /dev/null @@ -1,2 +0,0 @@ -x = "5" -y = "10" diff --git a/test_programs/compile_failure/workspace_missing_toml/crates/a/Prover.toml b/test_programs/compile_failure/workspace_missing_toml/crates/a/Prover.toml deleted file mode 100644 index 465ef562de4..00000000000 --- a/test_programs/compile_failure/workspace_missing_toml/crates/a/Prover.toml +++ /dev/null @@ -1,2 +0,0 @@ -x = "1" -y = "1" diff --git a/test_programs/compile_failure/workspace_missing_toml/crates/b/Prover.toml b/test_programs/compile_failure/workspace_missing_toml/crates/b/Prover.toml deleted file mode 100644 index a0397e89477..00000000000 --- a/test_programs/compile_failure/workspace_missing_toml/crates/b/Prover.toml +++ /dev/null @@ -1,2 +0,0 @@ -x = "1" -y = "0" diff --git a/test_programs/compile_failure/assert_msg_runtime/Nargo.toml b/test_programs/execution_failure/assert_msg_runtime/Nargo.toml similarity index 100% rename from test_programs/compile_failure/assert_msg_runtime/Nargo.toml rename to test_programs/execution_failure/assert_msg_runtime/Nargo.toml diff --git a/test_programs/compile_failure/assert_msg_runtime/Prover.toml b/test_programs/execution_failure/assert_msg_runtime/Prover.toml similarity index 100% rename from test_programs/compile_failure/assert_msg_runtime/Prover.toml rename to test_programs/execution_failure/assert_msg_runtime/Prover.toml diff --git a/test_programs/compile_failure/assert_msg_runtime/src/main.nr b/test_programs/execution_failure/assert_msg_runtime/src/main.nr similarity index 100% rename from test_programs/compile_failure/assert_msg_runtime/src/main.nr rename to test_programs/execution_failure/assert_msg_runtime/src/main.nr diff --git a/test_programs/compile_failure/brillig_assert_fail/Nargo.toml b/test_programs/execution_failure/brillig_assert_fail/Nargo.toml similarity index 100% rename from test_programs/compile_failure/brillig_assert_fail/Nargo.toml rename to test_programs/execution_failure/brillig_assert_fail/Nargo.toml diff --git a/test_programs/compile_failure/brillig_assert_fail/Prover.toml b/test_programs/execution_failure/brillig_assert_fail/Prover.toml similarity index 100% rename from test_programs/compile_failure/brillig_assert_fail/Prover.toml rename to test_programs/execution_failure/brillig_assert_fail/Prover.toml diff --git a/test_programs/compile_failure/brillig_assert_fail/src/main.nr b/test_programs/execution_failure/brillig_assert_fail/src/main.nr similarity index 100% rename from test_programs/compile_failure/brillig_assert_fail/src/main.nr rename to test_programs/execution_failure/brillig_assert_fail/src/main.nr diff --git a/test_programs/compile_failure/brillig_assert_msg_runtime/Nargo.toml b/test_programs/execution_failure/brillig_assert_msg_runtime/Nargo.toml similarity index 100% rename from test_programs/compile_failure/brillig_assert_msg_runtime/Nargo.toml rename to test_programs/execution_failure/brillig_assert_msg_runtime/Nargo.toml diff --git a/test_programs/compile_failure/brillig_assert_msg_runtime/Prover.toml b/test_programs/execution_failure/brillig_assert_msg_runtime/Prover.toml similarity index 100% rename from test_programs/compile_failure/brillig_assert_msg_runtime/Prover.toml rename to test_programs/execution_failure/brillig_assert_msg_runtime/Prover.toml diff --git a/test_programs/compile_failure/brillig_assert_msg_runtime/src/main.nr b/test_programs/execution_failure/brillig_assert_msg_runtime/src/main.nr similarity index 100% rename from test_programs/compile_failure/brillig_assert_msg_runtime/src/main.nr rename to test_programs/execution_failure/brillig_assert_msg_runtime/src/main.nr diff --git a/test_programs/compile_failure/div_by_zero_constants/Nargo.toml b/test_programs/execution_failure/div_by_zero_constants/Nargo.toml similarity index 100% rename from test_programs/compile_failure/div_by_zero_constants/Nargo.toml rename to test_programs/execution_failure/div_by_zero_constants/Nargo.toml diff --git a/test_programs/compile_failure/cyclic_dep/Prover.toml b/test_programs/execution_failure/div_by_zero_constants/Prover.toml similarity index 100% rename from test_programs/compile_failure/cyclic_dep/Prover.toml rename to test_programs/execution_failure/div_by_zero_constants/Prover.toml diff --git a/test_programs/compile_failure/div_by_zero_constants/src/main.nr b/test_programs/execution_failure/div_by_zero_constants/src/main.nr similarity index 100% rename from test_programs/compile_failure/div_by_zero_constants/src/main.nr rename to test_programs/execution_failure/div_by_zero_constants/src/main.nr diff --git a/test_programs/compile_failure/div_by_zero_modulo/Nargo.toml b/test_programs/execution_failure/div_by_zero_modulo/Nargo.toml similarity index 100% rename from test_programs/compile_failure/div_by_zero_modulo/Nargo.toml rename to test_programs/execution_failure/div_by_zero_modulo/Nargo.toml diff --git a/test_programs/compile_failure/div_by_zero_constants/Prover.toml b/test_programs/execution_failure/div_by_zero_modulo/Prover.toml similarity index 100% rename from test_programs/compile_failure/div_by_zero_constants/Prover.toml rename to test_programs/execution_failure/div_by_zero_modulo/Prover.toml diff --git a/test_programs/compile_failure/div_by_zero_modulo/src/main.nr b/test_programs/execution_failure/div_by_zero_modulo/src/main.nr similarity index 100% rename from test_programs/compile_failure/div_by_zero_modulo/src/main.nr rename to test_programs/execution_failure/div_by_zero_modulo/src/main.nr diff --git a/test_programs/compile_failure/div_by_zero_numerator_witness/Nargo.toml b/test_programs/execution_failure/div_by_zero_numerator_witness/Nargo.toml similarity index 100% rename from test_programs/compile_failure/div_by_zero_numerator_witness/Nargo.toml rename to test_programs/execution_failure/div_by_zero_numerator_witness/Nargo.toml diff --git a/test_programs/compile_failure/div_by_zero_numerator_witness/Prover.toml b/test_programs/execution_failure/div_by_zero_numerator_witness/Prover.toml similarity index 100% rename from test_programs/compile_failure/div_by_zero_numerator_witness/Prover.toml rename to test_programs/execution_failure/div_by_zero_numerator_witness/Prover.toml diff --git a/test_programs/compile_failure/div_by_zero_numerator_witness/src/main.nr b/test_programs/execution_failure/div_by_zero_numerator_witness/src/main.nr similarity index 100% rename from test_programs/compile_failure/div_by_zero_numerator_witness/src/main.nr rename to test_programs/execution_failure/div_by_zero_numerator_witness/src/main.nr diff --git a/test_programs/compile_failure/div_by_zero_witness/Nargo.toml b/test_programs/execution_failure/div_by_zero_witness/Nargo.toml similarity index 100% rename from test_programs/compile_failure/div_by_zero_witness/Nargo.toml rename to test_programs/execution_failure/div_by_zero_witness/Nargo.toml diff --git a/test_programs/compile_failure/div_by_zero_witness/Prover.toml b/test_programs/execution_failure/div_by_zero_witness/Prover.toml similarity index 100% rename from test_programs/compile_failure/div_by_zero_witness/Prover.toml rename to test_programs/execution_failure/div_by_zero_witness/Prover.toml diff --git a/test_programs/compile_failure/div_by_zero_witness/src/main.nr b/test_programs/execution_failure/div_by_zero_witness/src/main.nr similarity index 100% rename from test_programs/compile_failure/div_by_zero_witness/src/main.nr rename to test_programs/execution_failure/div_by_zero_witness/src/main.nr diff --git a/test_programs/compile_failure/dyn_index_fail_nested_array/Nargo.toml b/test_programs/execution_failure/dyn_index_fail_nested_array/Nargo.toml similarity index 100% rename from test_programs/compile_failure/dyn_index_fail_nested_array/Nargo.toml rename to test_programs/execution_failure/dyn_index_fail_nested_array/Nargo.toml diff --git a/test_programs/compile_failure/dyn_index_fail_nested_array/Prover.toml b/test_programs/execution_failure/dyn_index_fail_nested_array/Prover.toml similarity index 100% rename from test_programs/compile_failure/dyn_index_fail_nested_array/Prover.toml rename to test_programs/execution_failure/dyn_index_fail_nested_array/Prover.toml diff --git a/test_programs/compile_failure/dyn_index_fail_nested_array/src/main.nr b/test_programs/execution_failure/dyn_index_fail_nested_array/src/main.nr similarity index 100% rename from test_programs/compile_failure/dyn_index_fail_nested_array/src/main.nr rename to test_programs/execution_failure/dyn_index_fail_nested_array/src/main.nr diff --git a/test_programs/compile_failure/dynamic_index_failure/Nargo.toml b/test_programs/execution_failure/dynamic_index_failure/Nargo.toml similarity index 100% rename from test_programs/compile_failure/dynamic_index_failure/Nargo.toml rename to test_programs/execution_failure/dynamic_index_failure/Nargo.toml diff --git a/test_programs/compile_failure/dynamic_index_failure/Prover.toml b/test_programs/execution_failure/dynamic_index_failure/Prover.toml similarity index 100% rename from test_programs/compile_failure/dynamic_index_failure/Prover.toml rename to test_programs/execution_failure/dynamic_index_failure/Prover.toml diff --git a/test_programs/compile_failure/dynamic_index_failure/src/main.nr b/test_programs/execution_failure/dynamic_index_failure/src/main.nr similarity index 100% rename from test_programs/compile_failure/dynamic_index_failure/src/main.nr rename to test_programs/execution_failure/dynamic_index_failure/src/main.nr diff --git a/test_programs/compile_failure/option_expect/Nargo.toml b/test_programs/execution_failure/option_expect/Nargo.toml similarity index 100% rename from test_programs/compile_failure/option_expect/Nargo.toml rename to test_programs/execution_failure/option_expect/Nargo.toml diff --git a/test_programs/compile_failure/option_expect/src/main.nr b/test_programs/execution_failure/option_expect/src/main.nr similarity index 100% rename from test_programs/compile_failure/option_expect/src/main.nr rename to test_programs/execution_failure/option_expect/src/main.nr diff --git a/test_programs/compile_failure/slice_access_failure/Nargo.toml b/test_programs/execution_failure/slice_access_failure/Nargo.toml similarity index 100% rename from test_programs/compile_failure/slice_access_failure/Nargo.toml rename to test_programs/execution_failure/slice_access_failure/Nargo.toml diff --git a/test_programs/compile_failure/radix_non_constant_length/Prover.toml b/test_programs/execution_failure/slice_access_failure/Prover.toml similarity index 100% rename from test_programs/compile_failure/radix_non_constant_length/Prover.toml rename to test_programs/execution_failure/slice_access_failure/Prover.toml diff --git a/test_programs/compile_failure/slice_access_failure/src/main.nr b/test_programs/execution_failure/slice_access_failure/src/main.nr similarity index 100% rename from test_programs/compile_failure/slice_access_failure/src/main.nr rename to test_programs/execution_failure/slice_access_failure/src/main.nr diff --git a/test_programs/compile_failure/slice_insert_failure/Nargo.toml b/test_programs/execution_failure/slice_insert_failure/Nargo.toml similarity index 100% rename from test_programs/compile_failure/slice_insert_failure/Nargo.toml rename to test_programs/execution_failure/slice_insert_failure/Nargo.toml diff --git a/test_programs/compile_failure/slice_access_failure/Prover.toml b/test_programs/execution_failure/slice_insert_failure/Prover.toml similarity index 100% rename from test_programs/compile_failure/slice_access_failure/Prover.toml rename to test_programs/execution_failure/slice_insert_failure/Prover.toml diff --git a/test_programs/compile_failure/slice_insert_failure/src/main.nr b/test_programs/execution_failure/slice_insert_failure/src/main.nr similarity index 100% rename from test_programs/compile_failure/slice_insert_failure/src/main.nr rename to test_programs/execution_failure/slice_insert_failure/src/main.nr diff --git a/test_programs/compile_failure/slice_remove_failure/Nargo.toml b/test_programs/execution_failure/slice_remove_failure/Nargo.toml similarity index 100% rename from test_programs/compile_failure/slice_remove_failure/Nargo.toml rename to test_programs/execution_failure/slice_remove_failure/Nargo.toml diff --git a/test_programs/compile_failure/slice_insert_failure/Prover.toml b/test_programs/execution_failure/slice_remove_failure/Prover.toml similarity index 100% rename from test_programs/compile_failure/slice_insert_failure/Prover.toml rename to test_programs/execution_failure/slice_remove_failure/Prover.toml diff --git a/test_programs/compile_failure/slice_remove_failure/src/main.nr b/test_programs/execution_failure/slice_remove_failure/src/main.nr similarity index 100% rename from test_programs/compile_failure/slice_remove_failure/src/main.nr rename to test_programs/execution_failure/slice_remove_failure/src/main.nr diff --git a/test_programs/compile_failure/workspace_fail/Nargo.toml b/test_programs/execution_failure/workspace_fail/Nargo.toml similarity index 100% rename from test_programs/compile_failure/workspace_fail/Nargo.toml rename to test_programs/execution_failure/workspace_fail/Nargo.toml diff --git a/test_programs/compile_failure/workspace_fail/crates/a/Nargo.toml b/test_programs/execution_failure/workspace_fail/crates/a/Nargo.toml similarity index 100% rename from test_programs/compile_failure/workspace_fail/crates/a/Nargo.toml rename to test_programs/execution_failure/workspace_fail/crates/a/Nargo.toml diff --git a/test_programs/compile_failure/workspace_fail/crates/a/Prover.toml b/test_programs/execution_failure/workspace_fail/crates/a/Prover.toml similarity index 100% rename from test_programs/compile_failure/workspace_fail/crates/a/Prover.toml rename to test_programs/execution_failure/workspace_fail/crates/a/Prover.toml diff --git a/test_programs/compile_failure/workspace_fail/crates/a/src/main.nr b/test_programs/execution_failure/workspace_fail/crates/a/src/main.nr similarity index 100% rename from test_programs/compile_failure/workspace_fail/crates/a/src/main.nr rename to test_programs/execution_failure/workspace_fail/crates/a/src/main.nr diff --git a/test_programs/compile_failure/workspace_fail/crates/b/Nargo.toml b/test_programs/execution_failure/workspace_fail/crates/b/Nargo.toml similarity index 100% rename from test_programs/compile_failure/workspace_fail/crates/b/Nargo.toml rename to test_programs/execution_failure/workspace_fail/crates/b/Nargo.toml diff --git a/test_programs/compile_failure/workspace_fail/crates/b/Prover.toml b/test_programs/execution_failure/workspace_fail/crates/b/Prover.toml similarity index 100% rename from test_programs/compile_failure/workspace_fail/crates/b/Prover.toml rename to test_programs/execution_failure/workspace_fail/crates/b/Prover.toml diff --git a/test_programs/compile_failure/workspace_fail/crates/b/src/main.nr b/test_programs/execution_failure/workspace_fail/crates/b/src/main.nr similarity index 100% rename from test_programs/compile_failure/workspace_fail/crates/b/src/main.nr rename to test_programs/execution_failure/workspace_fail/crates/b/src/main.nr diff --git a/tooling/nargo_cli/build.rs b/tooling/nargo_cli/build.rs index 1ca12b75dfb..f68ccbfd50e 100644 --- a/tooling/nargo_cli/build.rs +++ b/tooling/nargo_cli/build.rs @@ -41,6 +41,7 @@ fn main() { println!("cargo:rerun-if-changed={}", test_dir.as_os_str().to_str().unwrap()); generate_execution_success_tests(&mut test_file, &test_dir); + generate_execution_failure_tests(&mut test_file, &test_dir); generate_noir_test_success_tests(&mut test_file, &test_dir); generate_noir_test_failure_tests(&mut test_file, &test_dir); generate_compile_success_empty_tests(&mut test_file, &test_dir); @@ -86,6 +87,44 @@ fn execution_success_{test_name}() {{ } } +fn generate_execution_failure_tests(test_file: &mut File, test_data_dir: &Path) { + let test_sub_dir = "execution_failure"; + let test_data_dir = test_data_dir.join(test_sub_dir); + + let test_case_dirs = + fs::read_dir(test_data_dir).unwrap().flatten().filter(|c| c.path().is_dir()); + + for test_dir in test_case_dirs { + let test_name = + test_dir.file_name().into_string().expect("Directory can't be converted to string"); + if test_name.contains('-') { + panic!( + "Invalid test directory: {test_name}. Cannot include `-`, please convert to `_`" + ); + }; + let test_dir = &test_dir.path(); + + write!( + test_file, + r#" +#[test] +fn execution_failure_{test_name}() {{ + let test_program_dir = PathBuf::from("{test_dir}"); + + let mut cmd = Command::cargo_bin("nargo").unwrap(); + cmd.env("NARGO_BACKEND_PATH", path_to_mock_backend()); + cmd.arg("--program-dir").arg(test_program_dir); + cmd.arg("execute").arg("--force"); + + cmd.assert().failure().stderr(predicate::str::contains("The application panicked (crashed).").not()); +}} + "#, + test_dir = test_dir.display(), + ) + .expect("Could not write templated test file."); + } +} + fn generate_noir_test_success_tests(test_file: &mut File, test_data_dir: &Path) { let test_sub_dir = "noir_test_success"; let test_data_dir = test_data_dir.join(test_sub_dir); @@ -281,7 +320,7 @@ fn compile_failure_{test_name}() {{ let mut cmd = Command::cargo_bin("nargo").unwrap(); cmd.env("NARGO_BACKEND_PATH", path_to_mock_backend()); cmd.arg("--program-dir").arg(test_program_dir); - cmd.arg("execute").arg("--force"); + cmd.arg("compile").arg("--force"); cmd.assert().failure().stderr(predicate::str::contains("The application panicked (crashed).").not()); }}