Skip to content
Snippets Groups Projects
Commit 829db8b4 authored by Peter Xu's avatar Peter Xu Committed by Dr. David Alan Gilbert
Browse files

tests: only update last_byte when at the edge


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: default avatarPeter Xu <peterx@redhat.com>
Message-Id: <20180723123305.24792-4-peterx@redhat.com>
Reviewed-by: default avatarJuan Quintela <quintela@redhat.com>
Signed-off-by: default avatarDr. David Alan Gilbert <dgilbert@redhat.com>
parent 97ca211c
No related branches found
No related tags found
No related merge requests found
......@@ -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"
......@@ -308,7 +309,6 @@ static void check_guests_ram(QTestState *who)
bad = true;
}
}
last_byte = b;
}
g_assert_false(bad);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment