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

Implement user checkpoints in CrashMonkey #51

Merged
merged 18 commits into from
Oct 2, 2017
Merged

Implement user checkpoints in CrashMonkey #51

merged 18 commits into from
Oct 2, 2017

Conversation

ashmrtn
Copy link
Member

@ashmrtn ashmrtn commented Sep 27, 2017

Implementations for #42, #41, #40, #39, and #38.

Checkpoints can now be called from a helper binary in build/user_tools/Checkpoint or via the programmatic API with Checkpoint().

The most recent checkpoint reached when generating a crash state is dumped to the output log along with the order of the bios used to generate the crash state (each bio is represented by its index in the original bio stream).

Below is an entry generated by running sudo ./c_harness -f /dev/vda -d /dev/cow_ram0 -t ext2 tests/checkpoint_example.so. This test creates a file and a new directory, and then moves the new file between the root directory of the file system and the new directory. Checkpoints are placed at various intervals during this test.

 Test #26 FAILED: file missing: test file has completely disappeared
   last checkpoint: 2
   crash state: 0, 1, 2, 2, 3, 4, 4, 5, 6, 7, 7, 8, 9, 17, 16, 18

@@ -162,13 +162,15 @@ class CheckpointExample : public BaseTestCase {
if (stat_old_res < 0 && errno_old == ENOENT &&
stat_new_res < 0 && errno_new == ENOENT) {
test_res->SetError(DataTestResult::kFileMissing);
test_res->error_description = "test file has completely disappeared";
Copy link
Member

Choose a reason for hiding this comment

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

Can we mention which file has disappeared? So is the file we are testing for always the same?

Copy link
Member Author

Choose a reason for hiding this comment

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

This error is if the file does not exist at either the old or the new file path (the file is completely gone). I have updated the error string to note the file paths it is checking for the file.

@@ -221,8 +230,10 @@ class CheckpointExample : public BaseTestCase {

if (bytes_read != strlen(TEST_TEXT)) {
test_res->SetError(DataTestResult::kFileDataCorrupted);
test_res->error_description = check_file + ": read data size wrong";
Copy link
Member

Choose a reason for hiding this comment

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

Lets print what the size should be, and what size is reported?

Copy link
Member Author

Choose a reason for hiding this comment

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

done

} else if (memcmp(TEST_TEXT, buf, strlen(TEST_TEXT)) != 0) {
test_res->SetError(DataTestResult::kFileDataCorrupted);
test_res->error_description = check_file + ": read data incorrect";
Copy link
Member

Choose a reason for hiding this comment

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

Similarly, lets print the index/prefix at which the buffers don't match

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@ashmrtn ashmrtn merged commit f19b6bd into master Oct 2, 2017
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.

None yet

2 participants