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

Handle tests with NIST data as integration tests #230

Merged
merged 9 commits into from
Jun 25, 2024
Merged

Conversation

YeungOnion
Copy link
Contributor

@YeungOnion YeungOnion commented May 24, 2024

Unsure how best to handle these tests, but I think separating them is a good start to not have the data in the repo per #195.

Test suite will rely on environment variable, "STATRS_NIST_DATA_DIR" set as const NIST_DATA_DIR_ENV, to specify path where the files, some listed below, are located.

  • lew.txt
  • mavro.txt
  • numacc1.txt
  • ...

Note: I am not married to the usage of an environment variable or its name.

@YeungOnion YeungOnion force-pushed the nist-data-tests branch 3 times, most recently from 5d6f4be to 9d88e8a Compare May 31, 2024 03:26
Copy link

codecov bot commented May 31, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.10%. Comparing base (49a5209) to head (9d88e8a).
Report is 203 commits behind head on master.

Current head 9d88e8a differs from pull request most recent head 494779f

Please upload reports for the commit 494779f to get more accurate results.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #230      +/-   ##
==========================================
- Coverage   91.76%   90.10%   -1.66%     
==========================================
  Files          44       49       +5     
  Lines        7360    10230    +2870     
==========================================
+ Hits         6754     9218    +2464     
- Misses        606     1012     +406     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@YeungOnion YeungOnion linked an issue Jun 5, 2024 that may be closed by this pull request
@FreezyLemon
Copy link
Contributor

I like the approach. Maybe add a helper script (bash?) to download the NIST files? Downloading the files manually could be a bit tedious.

also modify assert_almost_equal macro to support
option single trailing comma
TODO modify parsing to work with test data from NIST source
@YeungOnion YeungOnion force-pushed the nist-data-tests branch 2 times, most recently from 004d606 to 2bc3a93 Compare June 23, 2024 00:16
shell script needs curl, grep, and sed
also drop usage of cfg(test) in tests/ directory
@YeungOnion
Copy link
Contributor Author

We didn't distribute the integration tests with the last release, but if we did, would we want to share the script along with these tests?

@FreezyLemon
Copy link
Contributor

I would logically see the script as a part of that test suite, so yeah.

@YeungOnion
Copy link
Contributor Author

Will add to CI in another PR, any feedback on this one?

@FreezyLemon
Copy link
Contributor

I tried it on my machine and the script looks good. I think the environment variable works well, no reason to overthink this for a test IMO.

Few ideas to make the experience a bit smoother:

  • Add tests/*.dat to the .gitignore so the downloaded files don't show up in git
  • Add a bit of output to the script (e.g. Downloading <file>..., Processing <file>...) so we know what's going on. This gets more important when .gitignore includes the data files
  • Short comment (top of the nist_tests.rs) that explains how you're intended to actually run the tests would be nice. cargo test -- --include-ignored nist is not obvious IMHO
  • Use the current working dir when STATRS_NIST_DATA_DIR is unset. That'd make it easier to cd tests; ./gather_nist_data.sh; cargo test without requiring the env variable

@YeungOnion
Copy link
Contributor Author

Thanks for the feedback, think it will be clearer and nicer. Opted for default target directory to be tests since manifest and ignore target it and set some sense of working directory.

@YeungOnion YeungOnion merged commit a57db2f into master Jun 25, 2024
5 checks passed
@YeungOnion YeungOnion deleted the nist-data-tests branch June 25, 2024 00:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

All testing on NIST StRD without distributing these datasets
2 participants