diff options
author | Jordan Niethe <jniethe5@gmail.com> | 2019-04-02 10:43:16 +1100 |
---|---|---|
committer | Stewart Smith <stewart@linux.ibm.com> | 2019-05-20 14:20:29 +1000 |
commit | d56b151d7f87d18f7b6333d8ec4d5c5cf04b538c (patch) | |
tree | 368904443c9be1a1e59ae1afada628e63db883e9 /core | |
parent | 000f9331a6ebcca38df689995ef0d9b70249c707 (diff) | |
download | skiboot-d56b151d7f87d18f7b6333d8ec4d5c5cf04b538c.zip skiboot-d56b151d7f87d18f7b6333d8ec4d5c5cf04b538c.tar.gz skiboot-d56b151d7f87d18f7b6333d8ec4d5c5cf04b538c.tar.bz2 |
core/test/run-trace: Stop using indeterminate fields
The parallel_test uses the cpu field of the trace_hdr struct. However it
is expected that some of the trace entries that are gotten will be
trace_overflow structs. This type of entry leaves the cpu field
indeterminate when it is interpreted as a trace_hdr struct. This means
it possible tests will fail when they try to use the cpu field of an
overflow struct, as the cpu field could hold anything.
Move the checks that use the cpu field until after it has been
determined the trace entry is an overflow type.
Signed-off-by: Jordan Niethe <jniethe5@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
Diffstat (limited to 'core')
-rw-r--r-- | core/test/run-trace.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/core/test/run-trace.c b/core/test/run-trace.c index ef7ebfe..ec907c8 100644 --- a/core/test/run-trace.c +++ b/core/test/run-trace.c @@ -210,9 +210,6 @@ static void test_parallel(void) i = (i + last) % CPUS; last = i; - assert(be16_to_cpu(t.hdr.cpu) < CPUS); - assert(!done[be16_to_cpu(t.hdr.cpu)]); - if (t.hdr.type == TRACE_OVERFLOW) { /* Conveniently, each record is 16 bytes here. */ assert(be64_to_cpu(t.overflow.bytes_missed) % 16 == 0); @@ -221,6 +218,8 @@ static void test_parallel(void) continue; } + assert(be16_to_cpu(t.hdr.cpu) < CPUS); + assert(!done[be16_to_cpu(t.hdr.cpu)]); assert(be64_to_cpu(t.hdr.timestamp) % CPUS == be16_to_cpu(t.hdr.cpu)); if (t.hdr.type == TRACE_REPEAT) { assert(t.hdr.len_div_8 * 8 == sizeof(t.repeat)); |