-
-
Notifications
You must be signed in to change notification settings - Fork 115
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
Far far pointer bug fix #71
Changes from 11 commits
58892e1
a6fa529
bd87c29
3dfb252
2e31f4f
df49260
6c5ce07
6a611fb
3f327e2
7c03026
89a0941
5ab5f6c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,5 +20,6 @@ James McKaskill <[email protected]> | |
Jason E. Aten <[email protected]> | ||
Johan Hernandez <[email protected]> | ||
Joonsung Lee <[email protected]> | ||
Lev Radomislensky <[email protected]> | ||
Peter Waldschmidt <[email protected]> | ||
William Laffin <[email protected]> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ James McKaskill <[email protected]> | |
Jason E. Aten <[email protected]> | ||
Johan Hernandez <[email protected]> | ||
Joonsung Lee <[email protected]> | ||
Lev Radomislensky <[email protected]> | ||
Peter Waldschmidt <[email protected]> | ||
Ross Light <[email protected]> <[email protected]> | ||
William Laffin <[email protected]> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -232,3 +232,24 @@ func TestRawPointerTotalListSize(t *testing.T) { | |
} | ||
} | ||
} | ||
|
||
func TestLandingPadNearPointer(t *testing.T) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test doesn't really help me understand what failed with the previous implementation. Instead, can you write this as a table test of: tests := []struct{
far rawPointer
tag rawPointer
landing rawPointer
}{
// ...
} The test as written is halfway between a unit test and an integration test (usually a bad thing): it checks results by using other functions instead of testing just this function. It would be nice to have a small integration test as well. I know far pointers don't have as great test coverage, so it would help to have more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is much better, thank you! |
||
tests := []struct { | ||
far rawPointer | ||
tag rawPointer | ||
landing rawPointer | ||
}{ | ||
{0x08, 0x2000200000000, 0x2000200000000}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These tests would also benefit in being rewritten in terms of rawPointer constructors. For example, this first one would be: {rawFarPointer(0, 8), rawStructPointer(0, ObjectSize{16, 2}), rawStructPointer(0, ObjectSize{16, 2})}, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hey, trying to do as you suggest here but I have a problem understanding something, would love if you could clarify, in the function from the example you given if I pass an offset of 8 to the shouldn't be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've defined |
||
{0xa0, 0x2000200000000, 0x200020000004c}, | ||
{0xb12, 0x2000200000000, 0x2000200000584}, // struct pointer | ||
{0xb12, 0x2000200000001, 0x2000200000585}, // list pointer | ||
{0xb12, 0x2000200000003, 0x2000200000587}, // capability pointer | ||
} | ||
|
||
for _, test := range tests { | ||
testNearPointer := landingPadNearPointer(test.far, test.tag) | ||
if testNearPointer != test.landing { | ||
t.Errorf("rawPointer(%#016x).pointerType() = %d; want rawPointer(%#016x).pointerType() = %d", testNearPointer, testNearPointer.pointerType(), test.landing, test.landing.pointerType()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've already spent a fair amount of work making rawPointers values easy to debug. Please rewrite this as: t.Errorf("landingPadNearPointer(%v, %v) = %v; want %v", test.far, test.tag, landing, test.landing) |
||
} | ||
} | ||
} |
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.
Since this variable is not a byte address (it's not a word address), let's inline this into the next line.