Skip to content

Commit

Permalink
chore: rerun build script on changes to test_programs directory. (#…
Browse files Browse the repository at this point in the history
…3978)

# Description

## Problem\*

Resolves <!-- Link to GitHub Issue -->

## Summary\*

This PR tells cargo to regenerate the testcases derived from
`test_programs` if there are changes in the directory. This should
prevent an issue which @jfecher was running into where mysterious test
cases were appearing due to the codegenned test cases being out of sync
with `test_programs`.

I've also moved an orphaned test into `test_programs`.

## Additional Context


## Documentation\*

Check one:
- [x] No documentation needed.
- [ ] Documentation included in this PR.
- [ ] **[Exceptional Case]** Documentation to be submitted in a separate
PR.

# PR Checklist\*

- [x] I have tested the changes locally.
- [x] I have formatted the changes with [Prettier](https://prettier.io/)
and/or `cargo fmt` on default settings.
  • Loading branch information
TomAFrench committed Jan 8, 2024
1 parent 2dcf019 commit 3801956
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
fn main(x: Field, y: pub Field) {
let xs = Vec::new();
let option = Option::none();
fn main() {
let _xs = Vec::new();
let _option = Option::none();

print("42\n");
println("42");
Expand All @@ -10,11 +10,10 @@ mod a {
// We don't want to give an error due to re-importing elements that are already in the prelude.
use dep::std::collections::vec::Vec;
use dep::std::option::Option;
use dep::{print, println};

fn main() {
let xs = Vec::new();
let option = Option::none();
let _xs = Vec::new();
let _option = Option::none();

print("42\n");
println("42");
Expand All @@ -23,8 +22,8 @@ mod a {

mod b {
fn main() {
let xs = Vec::new();
let option = Option::none();
let _xs = Vec::new();
let _option = Option::none();

print("42\n");
println("42");
Expand Down
7 changes: 4 additions & 3 deletions tooling/nargo_cli/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ fn check_rustc_version() {
const GIT_COMMIT: &&str = &"GIT_COMMIT";

fn main() {
// Rebuild if the tests have changed
println!("cargo:rerun-if-changed=tests");

check_rustc_version();

// Only use build_data if the environment variable isn't set
Expand All @@ -39,6 +36,10 @@ fn main() {
};
let test_dir = root_dir.join("test_programs");

// Rebuild if the tests have changed
println!("cargo:rerun-if-changed=tests");
println!("cargo:rerun-if-changed={}", test_dir.as_os_str().to_str().unwrap());

generate_execution_success_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);
Expand Down

0 comments on commit 3801956

Please sign in to comment.