-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add files for presentation at next stage2 meeting.
- Loading branch information
Jan Philipp Hafer
committed
Feb 3, 2023
1 parent
cae796a
commit dc46f32
Showing
3 changed files
with
68 additions
and
9 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,55 @@ | ||
const std = @import("std"); | ||
|
||
// PROTOTYPE intended for presentation | ||
|
||
const panic_runner = @import("lib/panic_runner.zig"); | ||
test "testme1" { | ||
std.debug.assert(true); | ||
panic_runner.writeExpectedPanicMsg("test123"); | ||
@panic("test123"); | ||
} | ||
test "testme2" { | ||
std.debug.assert(true); | ||
} | ||
// test "testme4" { | ||
// panic_runner.writeExpectedPanicMsg("bruh"); | ||
// @panic("wrongmsg"); | ||
// } | ||
|
||
// test "testme4" { | ||
// @panic("no_expected_panic_msg"); | ||
// } | ||
|
||
// tradeoffs: | ||
// + simple and works with current routines | ||
// - only 1 panic inside a test block and must be last item | ||
// - requires process spawning and IPC (separates embedded and hosted environments) | ||
// | ||
// my opinion: | ||
// - feels like a hacky workaround (like Kernel spawn APIs I needed to modify) | ||
// - more elegant solution would be copying complete program state with a | ||
// bespoke debugging api + let user define store + load points for programs: | ||
// ``` | ||
// test "testme" { | ||
// var i: u32 = 0; | ||
// @storeProgramState | ||
// panic_runner.writeExpectedPanicMsg("test123"); | ||
// while (i < 100): (i+=1) { | ||
// if (i == 77) { | ||
// panic_runner.writeExpectedPanicMsg("test77"); | ||
// @panic("test123"); | ||
// } | ||
// } | ||
// @loadProgramState | ||
// i = 100; | ||
// @storeProgramState | ||
// panic_runner.writeExpectedPanicMsg("test123"); | ||
// while (i < 200): (i+=1) { | ||
// if (i == 177) { | ||
// panic_runner.writeExpectedPanicMsg("test177"); | ||
// @panic("test123"); | ||
// } | ||
// } | ||
// @loadProgramState | ||
// ``` | ||
|
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,4 @@ | ||
#!/usr/bin/env sh | ||
#set -e | ||
./rel/bin/zig test --test-runner lib/panic_runner.zig example.zig | ||
echo "exit status: $?" |