Skip to content
This repository has been archived by the owner on Apr 13, 2019. It is now read-only.

Commit

Permalink
tests: only update last_byte when at the edge
Browse files Browse the repository at this point in the history
The only possible change of last_byte is when it reaches the edge.
Setting it every time might let last_byte contain an invalid data when
memory corruption is detected, then the check of the next byte will be
incorrect.  For example, a single page corruption at address 0x14ad000
will also lead to a "fake" corruption at 0x14ae000:

  Memory content inconsistency at 14ad000 first_byte = 44 last_byte = 44 current = ef hit_edge = 0
  Memory content inconsistency at 14ae000 first_byte = 44 last_byte = ef current = 44 hit_edge = 0

After the patch, it'll only report the corrputed page:

  Memory content inconsistency at 14ad000 first_byte = 44 last_byte = 44 current = ef hit_edge = 0

Signed-off-by: Peter Xu <[email protected]>
Message-Id: <[email protected]>
Reviewed-by: Juan Quintela <[email protected]>
Signed-off-by: Dr. David Alan Gilbert <[email protected]>
  • Loading branch information
xzpeter authored and dagrh committed Jul 24, 2018
1 parent 97ca211 commit 829db8b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tests/migration-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ static void check_guests_ram(QTestState *who)
* to us yet.
*/
hit_edge = true;
last_byte = b;
} else {
fprintf(stderr, "Memory content inconsistency at %x"
" first_byte = %x last_byte = %x current = %x"
Expand All @@ -308,7 +309,6 @@ static void check_guests_ram(QTestState *who)
bad = true;
}
}
last_byte = b;
}
g_assert_false(bad);
}
Expand Down

0 comments on commit 829db8b

Please sign in to comment.