Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: small change in tests folder will cause a full rebuild of binary #472

Closed
skyzh opened this issue Feb 15, 2022 · 9 comments · Fixed by #564
Closed

tests: small change in tests folder will cause a full rebuild of binary #472

skyzh opened this issue Feb 15, 2022 · 9 comments · Fixed by #564
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@skyzh
Copy link
Member

skyzh commented Feb 15, 2022

Cause by #376

Is there any way that build.rs only detects only file name instead of full file content?

@skyzh skyzh added the enhancement New feature or request label Feb 15, 2022
@arkbriar
Copy link
Contributor

According to cargo: change detection of build script, re-run of build scripts only relies on the modification of filesystem "last-modified" timestamp.

To avoid re-run each time when only file content changes, we can manually maintain a list of the test cases (filenames) in a single file instead and declare it as the trigger.

@skyzh
Copy link
Member Author

skyzh commented Feb 17, 2022

Good idea!

@skyzh
Copy link
Member Author

skyzh commented Feb 17, 2022

... so we can create a "test_cases.rs", which includes a function, and include!("tests/test_cases.rs") in build.rs?

Meanwhile, in the rerun-if-changed config, we can only specify test_cases.rs as dependency.

@skyzh skyzh added the good first issue Good for newcomers label Feb 17, 2022
@arkbriar
Copy link
Contributor

... so we can create a "test_cases.rs", which includes a function, and include!("tests/test_cases.rs") in build.rs?

Meanwhile, in the rerun-if-changed config, we can only specify test_cases.rs as dependency.

What is the function in "test_cases.rs" for? If it's for scanning the dir, the build script can not be triggered when there're modifications in tests/sql.

IMO only a list of file names is needed. Developers should maintain the list whenever a test file is added or removed.

Besides, we can add a check on the list to make sure all files are included (and no non-existing files).

@skyzh
Copy link
Member Author

skyzh commented Feb 17, 2022

You're right. Ignore my comments above 🤪

@skyzh
Copy link
Member Author

skyzh commented Feb 17, 2022

Then I think a better approach is to:

  • maintain a list of files in a vector in test_cases.rs, and generate the corresponding test case functions.
  • check if all files matching the filename pattern are included.

cc @wangrunji0408

@xxchan
Copy link
Member

xxchan commented Feb 17, 2022

I'm a little bit confused: if we need to maintain a list of files now, what's the difference from the situaion before the auto discovery?

@skyzh
Copy link
Member Author

skyzh commented Feb 17, 2022

That's true... Maybe we should find another way to do auto-discovery of tests...

@Fedomn
Copy link
Member

Fedomn commented Feb 18, 2022

How about moving the integration test into a separate crate? Because now test file generation depends on cargo build script but currently cargo does not support test build scripts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants