forked from inket/MacSymbolicator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved testing scripts and testing README
- Loading branch information
Showing
5 changed files
with
111 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Testing | ||
|
||
For validating the behavior of MacSymbolicator, we need to follow these steps: | ||
|
||
1. Create the binaries and the dSYMs of the test project | ||
- Run `MacSymbolicatorTests/create_binaries_and_dsyms.sh` | ||
- This script will build the test apps, then move the binaries and dSYMs to their respective folders. | ||
- This script will also create a `Payload.zip` that we will use later | ||
2. On a second computer, create the crash files, the sample files, and the spindumps | ||
- Transfer `Payload.zip` to your second computer and extract it | ||
- Run `create_crashes_samples_spindumps.sh` from the extracted directory (requires sudo to sample/spindump processes) | ||
- This script will create a `Result.zip` that we will transfer back to the first computer | ||
3. Back on the main computer, extract `Result.zip` into `MacSymbolicatorTests/Resources` | ||
4. Create the "expect output" of symbolication | ||
- Run `MacSymbolicatorTests/create_expected_output.sh` | ||
- This script will build `MacSymbolicatorCLI` and use it to symbolicate the reports from the second computer | ||
- This script will save the symbolicated output files suffixed with `_symbolicated` | ||
5. Manually check that the expected output is symbolicated correctly | ||
6. Run the tests in Xcode, which will symbolicate the reports and compare them to the expected output | ||
|
||
|
||
### Q&A | ||
|
||
- Why is it done this way? | ||
- So that we don't have include all the binaries, the dSYMs, the samples, and spindumps which are pretty big for git, pollute the history, but also might contain information about my computer that I don't want to share. | ||
- For step 2, why need a second computer? | ||
- If you use the same computer that created the crashing binary (and dSYM), when macOS creates a crash report for an app it will also automatically symbolicate it. My guess is that dSYMs are indexed by Xcode as soon as they're created. | ||
- For step 5, doesn't manually checking the output defeat the point of automated testing? | ||
- Yes, but at least the expected output is created automatically which saves a LOT of time. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/usr/bin/env bash | ||
|
||
mkdir Crashes | ||
mkdir Samples | ||
mkdir Spindumps | ||
|
||
rm ~/Library/Logs/DiagnosticReports/CrashingTest* | ||
./CrashingTest | ||
sleep 3 # give the system some time to create the crash report | ||
cp ~/Library/Logs/DiagnosticReports/CrashingTest* Crashes/ | ||
mv Crashes/CrashingTest* Crashes/single-target-crash.ips | ||
|
||
rm ~/Library/Logs/DiagnosticReports/CrashingInAnotherTargetTest* | ||
./CrashingInAnotherTargetTest | ||
sleep 3 # give the system some time to create the crash report | ||
cp ~/Library/Logs/DiagnosticReports/CrashingInAnotherTargetTest* Crashes/ | ||
mv Crashes/CrashingInAnotherTargetTest* Crashes/multi-target-crash.ips | ||
|
||
./SingleThreadHangingTest& | ||
pid=$! | ||
sleep 1 # give the process some time to start up and hang | ||
sudo sample $pid -f ./Samples/singlethread-sample.txt | ||
sudo spindump $pid -o ./Spindumps/singlethread-spindump.txt | ||
kill -9 $pid | ||
|
||
./MultiThreadHangingTest& | ||
pid=$! | ||
sleep 1 # give the process some time to start up and hang | ||
sudo sample $pid -f ./Samples/multithread-sample.txt | ||
sudo spindump $pid -o ./Spindumps/multithread-spindump.txt | ||
kill -9 $pid | ||
|
||
./MultiTargetHangingTest& | ||
pid=$! | ||
sleep 1 # give the process some time to start up and hang | ||
sudo sample $pid -f ./Samples/multitarget-sample.txt | ||
sudo spindump $pid -o ./Spindumps/multitarget-spindump.txt | ||
kill -9 $pid | ||
|
||
# Create a zip file of the results to send back | ||
zip -1 -r Result.zip Crashes Samples Spindumps |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Prepare the zip to send to a second computer | ||
# (becauses crashes and samples will be automatically symbolicated if the dSYMs exist in the system) | ||
rm -rf Payload | ||
mkdir Payload | ||
cp -r Binaries/* Payload/ | ||
cp create_crashes_samples_spindumps.sh Payload/ | ||
zip -1 -r Payload.zip Payload | ||
rm -rf Payload |