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

Allow for creating reports from other reports #174

Merged
merged 3 commits into from
May 28, 2024
Merged

Allow for creating reports from other reports #174

merged 3 commits into from
May 28, 2024

Conversation

janaknat
Copy link
Contributor

The APerf reports contain the data archives. Use these if a report is passed in to the aperf report sub-command. The aperf report command will fail if a report is given as an arg and the report name is omitted. Also, move to using PathBuf instead of String for path.

Testing:
Tested by generating reports with:

  • Report dir and data
  • Report tar and data
  • Report tar and report dir
  • Data and data

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

The APerf reports contain the data archives. Use these if a report is
passed in to the aperf report sub-command.

The aperf report command will fail if a report is given as an arg and
the report name is omitted.

Also, move to using PathBuf instead of String for path.
@janaknat janaknat requested a review from a team as a code owner May 15, 2024 17:04
Copy link
Contributor

@wash-amzn wash-amzn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the behavior with tar.gz'ed reports versus extracted ones? Is it consistent with tar.gz'ed vs extracted 'aperf record' outputs?

Comment on lines +89 to +92
if dir.join("index.css").exists()
&& dir.join("index.html").exists()
&& dir.join("index.js").exists()
&& dir.join("data").exists()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do these checks really matter enough to be worth this breaking if we were to, for example, rename the index.js file in reports?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're adding integration tests and the directory structure is checked for in there.

Add an integration test for aperf record and aperf report. Integration
tests are located under tests/.

The integration test for aperf report also checks the structure of the
report in both the directory and the tarball.
Comment on lines 65 to 68
assert!(paths.contains(&PathBuf::from("test_report/index.html")));
assert!(paths.contains(&PathBuf::from("test_report/index.css")));
assert!(paths.contains(&PathBuf::from("test_report/index.js")));
assert!(paths.contains(&PathBuf::from("test_report/data/archive")));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the case of failures (including these assertion failures), files are going to be leaked. Can you look into passing some trait object to handle file/io, or otherwise mock this such that files aren't being created?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're using the tempdir crate along with a custom test harness to make sure we clean up after ourselves.

For integration testing, we need a test harness which can setup the temp
directory. All the files generated as part of the tests should be
located in this dir. The test harness will be able to catch assert
failures and re-raise them after cleaning up the temp directory.

This requires all integration tests run as closures in run_test().
@janaknat
Copy link
Contributor Author

Fixed clippy and fmt warnings.

@janaknat janaknat merged commit ac94cf1 into main May 28, 2024
8 checks passed
@janaknat janaknat deleted the report branch June 20, 2024 21:07
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.

2 participants