-
Notifications
You must be signed in to change notification settings - Fork 30
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
Conversation
Checkpoints made successfully when tested manually in background mode.
Make non-blocking socket read call.
It will now listen for checkpoint requests in tests CrashMonkey starts.
code/tests/checkpoint_example.cpp
Outdated
@@ -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"; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
code/tests/checkpoint_example.cpp
Outdated
@@ -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"; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
code/tests/checkpoint_example.cpp
Outdated
} else if (memcmp(TEST_TEXT, buf, strlen(TEST_TEXT)) != 0) { | ||
test_res->SetError(DataTestResult::kFileDataCorrupted); | ||
test_res->error_description = check_file + ": read data incorrect"; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
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 withCheckpoint()
.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.