2022-09-06 19:14:07 -04:00
|
|
|
|
// Copyright 2014 The Crashpad Authors
|
2014-10-07 17:27:11 -04:00
|
|
|
|
//
|
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
|
//
|
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
//
|
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
|
// limitations under the License.
|
|
|
|
|
|
2014-10-20 12:11:14 -04:00
|
|
|
|
#include "minidump/test/minidump_context_test_util.h"
|
2014-10-07 17:27:11 -04:00
|
|
|
|
|
2016-01-06 12:22:50 -05:00
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
|
2022-02-28 20:57:19 -08:00
|
|
|
|
#include <iterator>
|
|
|
|
|
|
2015-02-05 15:04:49 -08:00
|
|
|
|
#include "base/format_macros.h"
|
2014-11-03 17:43:39 -05:00
|
|
|
|
#include "base/strings/stringprintf.h"
|
2014-10-07 17:27:11 -04:00
|
|
|
|
#include "gtest/gtest.h"
|
2014-11-03 17:43:39 -05:00
|
|
|
|
#include "snapshot/cpu_context.h"
|
|
|
|
|
#include "snapshot/test/test_cpu_context.h"
|
2017-02-16 13:25:29 -05:00
|
|
|
|
#include "test/hex_string.h"
|
2014-10-07 17:27:11 -04:00
|
|
|
|
|
|
|
|
|
namespace crashpad {
|
|
|
|
|
namespace test {
|
|
|
|
|
|
|
|
|
|
void InitializeMinidumpContextX86(MinidumpContextX86* context, uint32_t seed) {
|
|
|
|
|
if (seed == 0) {
|
|
|
|
|
memset(context, 0, sizeof(*context));
|
|
|
|
|
context->context_flags = kMinidumpContextX86;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
context->context_flags = kMinidumpContextX86All;
|
|
|
|
|
|
|
|
|
|
uint32_t value = seed;
|
|
|
|
|
|
2014-11-03 17:43:39 -05:00
|
|
|
|
context->eax = value++;
|
|
|
|
|
context->ebx = value++;
|
|
|
|
|
context->ecx = value++;
|
|
|
|
|
context->edx = value++;
|
|
|
|
|
context->edi = value++;
|
|
|
|
|
context->esi = value++;
|
|
|
|
|
context->ebp = value++;
|
|
|
|
|
context->esp = value++;
|
|
|
|
|
context->eip = value++;
|
|
|
|
|
context->eflags = value++;
|
|
|
|
|
context->cs = value++ & 0xffff;
|
|
|
|
|
context->ds = value++ & 0xffff;
|
|
|
|
|
context->es = value++ & 0xffff;
|
|
|
|
|
context->fs = value++ & 0xffff;
|
|
|
|
|
context->gs = value++ & 0xffff;
|
|
|
|
|
context->ss = value++ & 0xffff;
|
|
|
|
|
|
|
|
|
|
InitializeCPUContextX86Fxsave(&context->fxsave, &value);
|
2017-02-16 13:25:29 -05:00
|
|
|
|
CPUContextX86::FxsaveToFsave(context->fxsave, &context->fsave);
|
2014-11-03 17:43:39 -05:00
|
|
|
|
|
2014-10-07 17:27:11 -04:00
|
|
|
|
context->dr0 = value++;
|
|
|
|
|
context->dr1 = value++;
|
|
|
|
|
context->dr2 = value++;
|
|
|
|
|
context->dr3 = value++;
|
2014-11-03 17:43:39 -05:00
|
|
|
|
value += 2; // Minidumps don’t carry dr4 or dr5.
|
2014-10-07 17:27:11 -04:00
|
|
|
|
context->dr6 = value++;
|
|
|
|
|
context->dr7 = value++;
|
2014-11-03 17:43:39 -05:00
|
|
|
|
|
|
|
|
|
// Set this field last, because it has no analogue in CPUContextX86.
|
2014-10-07 17:27:11 -04:00
|
|
|
|
context->float_save.spare_0 = value++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void InitializeMinidumpContextAMD64(MinidumpContextAMD64* context,
|
|
|
|
|
uint32_t seed) {
|
|
|
|
|
if (seed == 0) {
|
|
|
|
|
memset(context, 0, sizeof(*context));
|
|
|
|
|
context->context_flags = kMinidumpContextAMD64;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
context->context_flags = kMinidumpContextAMD64All;
|
|
|
|
|
|
|
|
|
|
uint32_t value = seed;
|
|
|
|
|
|
|
|
|
|
context->rax = value++;
|
2014-11-03 17:43:39 -05:00
|
|
|
|
context->rbx = value++;
|
2014-10-07 17:27:11 -04:00
|
|
|
|
context->rcx = value++;
|
|
|
|
|
context->rdx = value++;
|
|
|
|
|
context->rdi = value++;
|
2014-11-03 17:43:39 -05:00
|
|
|
|
context->rsi = value++;
|
|
|
|
|
context->rbp = value++;
|
|
|
|
|
context->rsp = value++;
|
2014-10-07 17:27:11 -04:00
|
|
|
|
context->r8 = value++;
|
|
|
|
|
context->r9 = value++;
|
|
|
|
|
context->r10 = value++;
|
|
|
|
|
context->r11 = value++;
|
|
|
|
|
context->r12 = value++;
|
|
|
|
|
context->r13 = value++;
|
|
|
|
|
context->r14 = value++;
|
|
|
|
|
context->r15 = value++;
|
|
|
|
|
context->rip = value++;
|
2014-11-03 17:43:39 -05:00
|
|
|
|
context->eflags = value++;
|
2015-02-05 08:46:06 -08:00
|
|
|
|
context->cs = static_cast<uint16_t>(value++);
|
|
|
|
|
context->fs = static_cast<uint16_t>(value++);
|
|
|
|
|
context->gs = static_cast<uint16_t>(value++);
|
2014-11-03 17:43:39 -05:00
|
|
|
|
|
|
|
|
|
InitializeCPUContextX86_64Fxsave(&context->fxsave, &value);
|
|
|
|
|
|
|
|
|
|
// mxcsr appears twice, and the two values should be aliased.
|
|
|
|
|
context->mx_csr = context->fxsave.mxcsr;
|
|
|
|
|
|
|
|
|
|
context->dr0 = value++;
|
|
|
|
|
context->dr1 = value++;
|
|
|
|
|
context->dr2 = value++;
|
|
|
|
|
context->dr3 = value++;
|
|
|
|
|
value += 2; // Minidumps don’t carry dr4 or dr5.
|
|
|
|
|
context->dr6 = value++;
|
|
|
|
|
context->dr7 = value++;
|
|
|
|
|
|
|
|
|
|
// Set these fields last, because they have no analogues in CPUContextX86_64.
|
|
|
|
|
context->p1_home = value++;
|
|
|
|
|
context->p2_home = value++;
|
|
|
|
|
context->p3_home = value++;
|
|
|
|
|
context->p4_home = value++;
|
|
|
|
|
context->p5_home = value++;
|
|
|
|
|
context->p6_home = value++;
|
2015-02-05 08:46:06 -08:00
|
|
|
|
context->ds = static_cast<uint16_t>(value++);
|
|
|
|
|
context->es = static_cast<uint16_t>(value++);
|
|
|
|
|
context->ss = static_cast<uint16_t>(value++);
|
2022-02-28 20:57:19 -08:00
|
|
|
|
for (size_t index = 0; index < std::size(context->vector_register); ++index) {
|
2014-10-07 17:27:11 -04:00
|
|
|
|
context->vector_register[index].lo = value++;
|
|
|
|
|
context->vector_register[index].hi = value++;
|
|
|
|
|
}
|
|
|
|
|
context->vector_control = value++;
|
|
|
|
|
context->debug_control = value++;
|
|
|
|
|
context->last_branch_to_rip = value++;
|
|
|
|
|
context->last_branch_from_rip = value++;
|
|
|
|
|
context->last_exception_to_rip = value++;
|
|
|
|
|
context->last_exception_from_rip = value++;
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-30 12:41:09 -08:00
|
|
|
|
void InitializeMinidumpContextARM(MinidumpContextARM* context, uint32_t seed) {
|
|
|
|
|
if (seed == 0) {
|
|
|
|
|
memset(context, 0, sizeof(*context));
|
|
|
|
|
context->context_flags = kMinidumpContextARM;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
context->context_flags = kMinidumpContextARMAll;
|
|
|
|
|
|
|
|
|
|
uint32_t value = seed;
|
|
|
|
|
|
2022-02-28 20:57:19 -08:00
|
|
|
|
for (size_t index = 0; index < std::size(context->regs); ++index) {
|
2018-01-30 12:41:09 -08:00
|
|
|
|
context->regs[index] = value++;
|
|
|
|
|
}
|
|
|
|
|
context->fp = value++;
|
|
|
|
|
context->ip = value++;
|
|
|
|
|
context->ip = value++;
|
|
|
|
|
context->sp = value++;
|
|
|
|
|
context->lr = value++;
|
|
|
|
|
context->pc = value++;
|
|
|
|
|
context->cpsr = value++;
|
|
|
|
|
|
2022-02-28 20:57:19 -08:00
|
|
|
|
for (size_t index = 0; index < std::size(context->vfp); ++index) {
|
2018-01-30 12:41:09 -08:00
|
|
|
|
context->vfp[index] = value++;
|
|
|
|
|
}
|
|
|
|
|
context->fpscr = value++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void InitializeMinidumpContextARM64(MinidumpContextARM64* context,
|
|
|
|
|
uint32_t seed) {
|
|
|
|
|
if (seed == 0) {
|
|
|
|
|
memset(context, 0, sizeof(*context));
|
|
|
|
|
context->context_flags = kMinidumpContextARM64;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2018-08-01 08:42:27 -07:00
|
|
|
|
context->context_flags = kMinidumpContextARM64Full;
|
2018-01-30 12:41:09 -08:00
|
|
|
|
|
|
|
|
|
uint32_t value = seed;
|
|
|
|
|
|
2022-02-28 20:57:19 -08:00
|
|
|
|
for (size_t index = 0; index < std::size(context->regs); ++index) {
|
2018-01-30 12:41:09 -08:00
|
|
|
|
context->regs[index] = value++;
|
|
|
|
|
}
|
2018-08-01 08:42:27 -07:00
|
|
|
|
context->fp = value++;
|
|
|
|
|
context->lr = value++;
|
2018-01-30 12:41:09 -08:00
|
|
|
|
context->sp = value++;
|
|
|
|
|
context->pc = value++;
|
|
|
|
|
context->cpsr = value++;
|
|
|
|
|
|
2022-02-28 20:57:19 -08:00
|
|
|
|
for (size_t index = 0; index < std::size(context->fpsimd); ++index) {
|
2018-01-30 12:41:09 -08:00
|
|
|
|
context->fpsimd[index].lo = value++;
|
|
|
|
|
context->fpsimd[index].hi = value++;
|
|
|
|
|
}
|
|
|
|
|
context->fpsr = value++;
|
|
|
|
|
context->fpcr = value++;
|
|
|
|
|
}
|
|
|
|
|
|
2018-07-10 11:17:22 +02:00
|
|
|
|
void InitializeMinidumpContextMIPS(MinidumpContextMIPS* context,
|
|
|
|
|
uint32_t seed) {
|
|
|
|
|
if (seed == 0) {
|
|
|
|
|
memset(context, 0, sizeof(*context));
|
|
|
|
|
context->context_flags = kMinidumpContextMIPS;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
context->context_flags = kMinidumpContextMIPSAll;
|
|
|
|
|
|
|
|
|
|
uint32_t value = seed;
|
|
|
|
|
|
2022-02-28 20:57:19 -08:00
|
|
|
|
for (size_t index = 0; index < std::size(context->regs); ++index) {
|
2018-07-10 11:17:22 +02:00
|
|
|
|
context->regs[index] = value++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
context->mdlo = value++;
|
|
|
|
|
context->mdhi = value++;
|
|
|
|
|
context->epc = value++;
|
|
|
|
|
context->badvaddr = value++;
|
|
|
|
|
context->status = value++;
|
|
|
|
|
context->cause = value++;
|
|
|
|
|
|
2022-02-28 20:57:19 -08:00
|
|
|
|
for (size_t index = 0; index < std::size(context->fpregs.fregs); ++index) {
|
2018-07-10 11:17:22 +02:00
|
|
|
|
context->fpregs.fregs[index]._fp_fregs = static_cast<float>(value++);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
context->fpcsr = value++;
|
|
|
|
|
context->fir = value++;
|
|
|
|
|
|
|
|
|
|
for (size_t index = 0; index < 3; ++index) {
|
|
|
|
|
context->hi[index] = value++;
|
|
|
|
|
context->lo[index] = value++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
context->dsp_control = value++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void InitializeMinidumpContextMIPS64(MinidumpContextMIPS64* context,
|
|
|
|
|
uint32_t seed) {
|
|
|
|
|
if (seed == 0) {
|
|
|
|
|
memset(context, 0, sizeof(*context));
|
|
|
|
|
context->context_flags = kMinidumpContextMIPS64;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
context->context_flags = kMinidumpContextMIPS64All;
|
|
|
|
|
|
|
|
|
|
uint64_t value = seed;
|
|
|
|
|
|
2022-02-28 20:57:19 -08:00
|
|
|
|
for (size_t index = 0; index < std::size(context->regs); ++index) {
|
2018-07-10 11:17:22 +02:00
|
|
|
|
context->regs[index] = value++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
context->mdlo = value++;
|
|
|
|
|
context->mdhi = value++;
|
|
|
|
|
context->epc = value++;
|
|
|
|
|
context->badvaddr = value++;
|
|
|
|
|
context->status = value++;
|
|
|
|
|
context->cause = value++;
|
|
|
|
|
|
2022-02-28 20:57:19 -08:00
|
|
|
|
for (size_t index = 0; index < std::size(context->fpregs.dregs); ++index) {
|
2018-07-10 11:17:22 +02:00
|
|
|
|
context->fpregs.dregs[index] = static_cast<double>(value++);
|
|
|
|
|
}
|
|
|
|
|
context->fpcsr = value++;
|
|
|
|
|
context->fir = value++;
|
|
|
|
|
|
|
|
|
|
for (size_t index = 0; index < 3; ++index) {
|
|
|
|
|
context->hi[index] = value++;
|
|
|
|
|
context->lo[index] = value++;
|
|
|
|
|
}
|
|
|
|
|
context->dsp_control = value++;
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-08 21:08:54 +00:00
|
|
|
|
void InitializeMinidumpContextRISCV64(MinidumpContextRISCV64* context,
|
|
|
|
|
uint32_t seed) {
|
|
|
|
|
if (seed == 0) {
|
|
|
|
|
memset(context, 0, sizeof(*context));
|
|
|
|
|
context->context_flags = kMinidumpContextRISCV64;
|
|
|
|
|
context->version = MinidumpContextRISCV64::kVersion;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
context->context_flags = kMinidumpContextRISCV64All;
|
|
|
|
|
context->version = MinidumpContextRISCV64::kVersion;
|
|
|
|
|
|
|
|
|
|
uint32_t value = seed;
|
|
|
|
|
|
|
|
|
|
context->pc = value++;
|
|
|
|
|
for (size_t index = 0; index < std::size(context->regs); ++index) {
|
|
|
|
|
context->regs[index] = value++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (size_t index = 0; index < std::size(context->fpregs); ++index) {
|
|
|
|
|
context->fpregs[index] = value++;
|
|
|
|
|
}
|
|
|
|
|
context->fcsr = value++;
|
|
|
|
|
}
|
|
|
|
|
|
2014-11-03 17:43:39 -05:00
|
|
|
|
namespace {
|
|
|
|
|
|
2020-05-06 20:39:19 -04:00
|
|
|
|
// Using Google Test assertions, compares |expected| to |observed|. This is
|
2014-11-03 17:43:39 -05:00
|
|
|
|
// templatized because the CPUContextX86::Fxsave and CPUContextX86_64::Fxsave
|
|
|
|
|
// are nearly identical but have different sizes for the members |xmm|,
|
|
|
|
|
// |reserved_4|, and |available|.
|
|
|
|
|
template <typename FxsaveType>
|
|
|
|
|
void ExpectMinidumpContextFxsave(const FxsaveType* expected,
|
|
|
|
|
const FxsaveType* observed) {
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
|
EXPECT_EQ(observed->fcw, expected->fcw);
|
|
|
|
|
EXPECT_EQ(observed->fsw, expected->fsw);
|
|
|
|
|
EXPECT_EQ(observed->ftw, expected->ftw);
|
|
|
|
|
EXPECT_EQ(observed->reserved_1, expected->reserved_1);
|
|
|
|
|
EXPECT_EQ(observed->fop, expected->fop);
|
|
|
|
|
EXPECT_EQ(observed->fpu_ip, expected->fpu_ip);
|
|
|
|
|
EXPECT_EQ(observed->fpu_cs, expected->fpu_cs);
|
|
|
|
|
EXPECT_EQ(observed->reserved_2, expected->reserved_2);
|
|
|
|
|
EXPECT_EQ(observed->fpu_dp, expected->fpu_dp);
|
|
|
|
|
EXPECT_EQ(observed->fpu_ds, expected->fpu_ds);
|
|
|
|
|
EXPECT_EQ(observed->reserved_3, expected->reserved_3);
|
|
|
|
|
EXPECT_EQ(observed->mxcsr, expected->mxcsr);
|
|
|
|
|
EXPECT_EQ(observed->mxcsr_mask, expected->mxcsr_mask);
|
2022-02-28 20:57:19 -08:00
|
|
|
|
for (size_t st_mm_index = 0; st_mm_index < std::size(expected->st_mm);
|
2014-11-03 17:43:39 -05:00
|
|
|
|
++st_mm_index) {
|
2015-02-05 15:04:49 -08:00
|
|
|
|
SCOPED_TRACE(base::StringPrintf("st_mm_index %" PRIuS, st_mm_index));
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
|
EXPECT_EQ(BytesToHexString(observed->st_mm[st_mm_index].st,
|
2022-02-28 20:57:19 -08:00
|
|
|
|
std::size(observed->st_mm[st_mm_index].st)),
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
|
BytesToHexString(expected->st_mm[st_mm_index].st,
|
2022-02-28 20:57:19 -08:00
|
|
|
|
std::size(expected->st_mm[st_mm_index].st)));
|
2017-02-16 13:25:29 -05:00
|
|
|
|
EXPECT_EQ(
|
|
|
|
|
BytesToHexString(observed->st_mm[st_mm_index].st_reserved,
|
2022-02-28 20:57:19 -08:00
|
|
|
|
std::size(observed->st_mm[st_mm_index].st_reserved)),
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
|
BytesToHexString(expected->st_mm[st_mm_index].st_reserved,
|
2022-02-28 20:57:19 -08:00
|
|
|
|
std::size(expected->st_mm[st_mm_index].st_reserved)));
|
2014-11-03 17:43:39 -05:00
|
|
|
|
}
|
2022-02-28 20:57:19 -08:00
|
|
|
|
for (size_t xmm_index = 0; xmm_index < std::size(expected->xmm);
|
2014-11-03 17:43:39 -05:00
|
|
|
|
++xmm_index) {
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
|
EXPECT_EQ(BytesToHexString(observed->xmm[xmm_index],
|
2022-02-28 20:57:19 -08:00
|
|
|
|
std::size(observed->xmm[xmm_index])),
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
|
BytesToHexString(expected->xmm[xmm_index],
|
2022-02-28 20:57:19 -08:00
|
|
|
|
std::size(expected->xmm[xmm_index])))
|
2017-02-16 13:25:29 -05:00
|
|
|
|
<< "xmm_index " << xmm_index;
|
2014-11-03 17:43:39 -05:00
|
|
|
|
}
|
2017-02-16 13:25:29 -05:00
|
|
|
|
EXPECT_EQ(
|
2022-02-28 20:57:19 -08:00
|
|
|
|
BytesToHexString(observed->reserved_4, std::size(observed->reserved_4)),
|
|
|
|
|
BytesToHexString(expected->reserved_4, std::size(expected->reserved_4)));
|
2017-02-16 13:25:29 -05:00
|
|
|
|
EXPECT_EQ(
|
2022-02-28 20:57:19 -08:00
|
|
|
|
BytesToHexString(observed->available, std::size(observed->available)),
|
|
|
|
|
BytesToHexString(expected->available, std::size(expected->available)));
|
2014-11-03 17:43:39 -05:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
|
|
void ExpectMinidumpContextX86(
|
|
|
|
|
uint32_t expect_seed, const MinidumpContextX86* observed, bool snapshot) {
|
2014-10-07 17:27:11 -04:00
|
|
|
|
MinidumpContextX86 expected;
|
|
|
|
|
InitializeMinidumpContextX86(&expected, expect_seed);
|
|
|
|
|
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
|
EXPECT_EQ(observed->context_flags, expected.context_flags);
|
|
|
|
|
EXPECT_EQ(observed->dr0, expected.dr0);
|
|
|
|
|
EXPECT_EQ(observed->dr1, expected.dr1);
|
|
|
|
|
EXPECT_EQ(observed->dr2, expected.dr2);
|
|
|
|
|
EXPECT_EQ(observed->dr3, expected.dr3);
|
|
|
|
|
EXPECT_EQ(observed->dr6, expected.dr6);
|
|
|
|
|
EXPECT_EQ(observed->dr7, expected.dr7);
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(observed->fsave.fcw, expected.fsave.fcw);
|
|
|
|
|
EXPECT_EQ(observed->fsave.fsw, expected.fsave.fsw);
|
|
|
|
|
EXPECT_EQ(observed->fsave.ftw, expected.fsave.ftw);
|
|
|
|
|
EXPECT_EQ(observed->fsave.fpu_ip, expected.fsave.fpu_ip);
|
|
|
|
|
EXPECT_EQ(observed->fsave.fpu_cs, expected.fsave.fpu_cs);
|
|
|
|
|
EXPECT_EQ(observed->fsave.fpu_dp, expected.fsave.fpu_dp);
|
|
|
|
|
EXPECT_EQ(observed->fsave.fpu_ds, expected.fsave.fpu_ds);
|
2022-02-28 20:57:19 -08:00
|
|
|
|
for (size_t index = 0; index < std::size(expected.fsave.st); ++index) {
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
|
EXPECT_EQ(BytesToHexString(observed->fsave.st[index],
|
2022-02-28 20:57:19 -08:00
|
|
|
|
std::size(observed->fsave.st[index])),
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
|
BytesToHexString(expected.fsave.st[index],
|
2022-02-28 20:57:19 -08:00
|
|
|
|
std::size(expected.fsave.st[index])))
|
2017-02-16 13:25:29 -05:00
|
|
|
|
<< "index " << index;
|
2014-10-07 17:27:11 -04:00
|
|
|
|
}
|
2014-11-03 17:43:39 -05:00
|
|
|
|
if (snapshot) {
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
|
EXPECT_EQ(observed->float_save.spare_0, 0u);
|
2014-11-03 17:43:39 -05:00
|
|
|
|
} else {
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
|
EXPECT_EQ(observed->float_save.spare_0, expected.float_save.spare_0);
|
2014-11-03 17:43:39 -05:00
|
|
|
|
}
|
|
|
|
|
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
|
EXPECT_EQ(observed->gs, expected.gs);
|
|
|
|
|
EXPECT_EQ(observed->fs, expected.fs);
|
|
|
|
|
EXPECT_EQ(observed->es, expected.es);
|
|
|
|
|
EXPECT_EQ(observed->ds, expected.ds);
|
|
|
|
|
EXPECT_EQ(observed->edi, expected.edi);
|
|
|
|
|
EXPECT_EQ(observed->esi, expected.esi);
|
|
|
|
|
EXPECT_EQ(observed->ebx, expected.ebx);
|
|
|
|
|
EXPECT_EQ(observed->edx, expected.edx);
|
|
|
|
|
EXPECT_EQ(observed->ecx, expected.ecx);
|
|
|
|
|
EXPECT_EQ(observed->eax, expected.eax);
|
|
|
|
|
EXPECT_EQ(observed->ebp, expected.ebp);
|
|
|
|
|
EXPECT_EQ(observed->eip, expected.eip);
|
|
|
|
|
EXPECT_EQ(observed->cs, expected.cs);
|
|
|
|
|
EXPECT_EQ(observed->eflags, expected.eflags);
|
|
|
|
|
EXPECT_EQ(observed->esp, expected.esp);
|
|
|
|
|
EXPECT_EQ(observed->ss, expected.ss);
|
2014-11-03 17:43:39 -05:00
|
|
|
|
|
|
|
|
|
ExpectMinidumpContextFxsave(&expected.fxsave, &observed->fxsave);
|
2014-10-07 17:27:11 -04:00
|
|
|
|
}
|
|
|
|
|
|
2014-11-03 17:43:39 -05:00
|
|
|
|
void ExpectMinidumpContextAMD64(
|
|
|
|
|
uint32_t expect_seed, const MinidumpContextAMD64* observed, bool snapshot) {
|
2014-10-07 17:27:11 -04:00
|
|
|
|
MinidumpContextAMD64 expected;
|
|
|
|
|
InitializeMinidumpContextAMD64(&expected, expect_seed);
|
|
|
|
|
|
2022-05-14 22:40:24 -07:00
|
|
|
|
// Allow context_flags to include xstate bit - this is added if we will write
|
|
|
|
|
// an extended context, but is not generated in the fixed context for testing.
|
|
|
|
|
if ((observed->context_flags & kMinidumpContextAMD64Xstate) ==
|
|
|
|
|
kMinidumpContextAMD64Xstate) {
|
|
|
|
|
EXPECT_EQ(observed->context_flags,
|
|
|
|
|
(expected.context_flags | kMinidumpContextAMD64Xstate));
|
|
|
|
|
} else {
|
|
|
|
|
EXPECT_EQ(observed->context_flags, expected.context_flags);
|
|
|
|
|
}
|
2014-11-03 17:43:39 -05:00
|
|
|
|
|
|
|
|
|
if (snapshot) {
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
|
EXPECT_EQ(observed->p1_home, 0u);
|
|
|
|
|
EXPECT_EQ(observed->p2_home, 0u);
|
|
|
|
|
EXPECT_EQ(observed->p3_home, 0u);
|
|
|
|
|
EXPECT_EQ(observed->p4_home, 0u);
|
|
|
|
|
EXPECT_EQ(observed->p5_home, 0u);
|
|
|
|
|
EXPECT_EQ(observed->p6_home, 0u);
|
2014-11-03 17:43:39 -05:00
|
|
|
|
} else {
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
|
EXPECT_EQ(observed->p1_home, expected.p1_home);
|
|
|
|
|
EXPECT_EQ(observed->p2_home, expected.p2_home);
|
|
|
|
|
EXPECT_EQ(observed->p3_home, expected.p3_home);
|
|
|
|
|
EXPECT_EQ(observed->p4_home, expected.p4_home);
|
|
|
|
|
EXPECT_EQ(observed->p5_home, expected.p5_home);
|
|
|
|
|
EXPECT_EQ(observed->p6_home, expected.p6_home);
|
2014-11-03 17:43:39 -05:00
|
|
|
|
}
|
|
|
|
|
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
|
EXPECT_EQ(observed->mx_csr, expected.mx_csr);
|
2014-11-03 17:43:39 -05:00
|
|
|
|
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
|
EXPECT_EQ(observed->cs, expected.cs);
|
2014-11-03 17:43:39 -05:00
|
|
|
|
if (snapshot) {
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
|
EXPECT_EQ(observed->ds, 0u);
|
|
|
|
|
EXPECT_EQ(observed->es, 0u);
|
2014-11-03 17:43:39 -05:00
|
|
|
|
} else {
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
|
EXPECT_EQ(observed->ds, expected.ds);
|
|
|
|
|
EXPECT_EQ(observed->es, expected.es);
|
2014-11-03 17:43:39 -05:00
|
|
|
|
}
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
|
EXPECT_EQ(observed->fs, expected.fs);
|
|
|
|
|
EXPECT_EQ(observed->gs, expected.gs);
|
2014-11-03 17:43:39 -05:00
|
|
|
|
if (snapshot) {
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
|
EXPECT_EQ(observed->ss, 0u);
|
2014-11-03 17:43:39 -05:00
|
|
|
|
} else {
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
|
EXPECT_EQ(observed->ss, expected.ss);
|
2014-11-03 17:43:39 -05:00
|
|
|
|
}
|
|
|
|
|
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
|
EXPECT_EQ(observed->eflags, expected.eflags);
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(observed->dr0, expected.dr0);
|
|
|
|
|
EXPECT_EQ(observed->dr1, expected.dr1);
|
|
|
|
|
EXPECT_EQ(observed->dr2, expected.dr2);
|
|
|
|
|
EXPECT_EQ(observed->dr3, expected.dr3);
|
|
|
|
|
EXPECT_EQ(observed->dr6, expected.dr6);
|
|
|
|
|
EXPECT_EQ(observed->dr7, expected.dr7);
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(observed->rax, expected.rax);
|
|
|
|
|
EXPECT_EQ(observed->rcx, expected.rcx);
|
|
|
|
|
EXPECT_EQ(observed->rdx, expected.rdx);
|
|
|
|
|
EXPECT_EQ(observed->rbx, expected.rbx);
|
|
|
|
|
EXPECT_EQ(observed->rsp, expected.rsp);
|
|
|
|
|
EXPECT_EQ(observed->rbp, expected.rbp);
|
|
|
|
|
EXPECT_EQ(observed->rsi, expected.rsi);
|
|
|
|
|
EXPECT_EQ(observed->rdi, expected.rdi);
|
|
|
|
|
EXPECT_EQ(observed->r8, expected.r8);
|
|
|
|
|
EXPECT_EQ(observed->r9, expected.r9);
|
|
|
|
|
EXPECT_EQ(observed->r10, expected.r10);
|
|
|
|
|
EXPECT_EQ(observed->r11, expected.r11);
|
|
|
|
|
EXPECT_EQ(observed->r12, expected.r12);
|
|
|
|
|
EXPECT_EQ(observed->r13, expected.r13);
|
|
|
|
|
EXPECT_EQ(observed->r14, expected.r14);
|
|
|
|
|
EXPECT_EQ(observed->r15, expected.r15);
|
|
|
|
|
EXPECT_EQ(observed->rip, expected.rip);
|
2014-11-03 17:43:39 -05:00
|
|
|
|
|
|
|
|
|
ExpectMinidumpContextFxsave(&expected.fxsave, &observed->fxsave);
|
|
|
|
|
|
2022-02-28 20:57:19 -08:00
|
|
|
|
for (size_t index = 0; index < std::size(expected.vector_register); ++index) {
|
2014-11-03 17:43:39 -05:00
|
|
|
|
if (snapshot) {
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
|
EXPECT_EQ(observed->vector_register[index].lo, 0u) << "index " << index;
|
|
|
|
|
EXPECT_EQ(observed->vector_register[index].hi, 0u) << "index " << index;
|
2014-11-03 17:43:39 -05:00
|
|
|
|
} else {
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
|
EXPECT_EQ(observed->vector_register[index].lo,
|
|
|
|
|
expected.vector_register[index].lo)
|
|
|
|
|
<< "index " << index;
|
|
|
|
|
EXPECT_EQ(observed->vector_register[index].hi,
|
|
|
|
|
expected.vector_register[index].hi)
|
|
|
|
|
<< "index " << index;
|
2014-11-03 17:43:39 -05:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (snapshot) {
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
|
EXPECT_EQ(observed->vector_control, 0u);
|
|
|
|
|
EXPECT_EQ(observed->debug_control, 0u);
|
|
|
|
|
EXPECT_EQ(observed->last_branch_to_rip, 0u);
|
|
|
|
|
EXPECT_EQ(observed->last_branch_from_rip, 0u);
|
|
|
|
|
EXPECT_EQ(observed->last_exception_to_rip, 0u);
|
|
|
|
|
EXPECT_EQ(observed->last_exception_from_rip, 0u);
|
2014-11-03 17:43:39 -05:00
|
|
|
|
} else {
|
test: Use (actual, [un]expected) in gtest {ASSERT,EXPECT}_{EQ,NE}
gtest used to require (expected, actual) ordering for arguments to
EXPECT_EQ and ASSERT_EQ, and in failed test assertions would identify
each side as “expected” or “actual.” Tests in Crashpad adhered to this
traditional ordering. After a gtest change in February 2016, it is now
agnostic with respect to the order of these arguments.
This change mechanically updates all uses of these macros to (actual,
expected) by reversing them. This provides consistency with our use of
the logging CHECK_EQ and DCHECK_EQ macros, and makes for better
readability by ordinary native speakers. The rough (but working!)
conversion tool is
https://chromium-review.googlesource.com/c/466727/1/rewrite_expectassert_eq.py,
and “git cl format” cleaned up its output.
EXPECT_NE and ASSERT_NE never had a preferred ordering. gtest never made
a judgment that one side or the other needed to provide an “unexpected”
value. Consequently, some code used (unexpected, actual) while other
code used (actual, unexpected). For consistency with the new EXPECT_EQ
and ASSERT_EQ usage, as well as consistency with CHECK_NE and DCHECK_NE,
this change also updates these use sites to (actual, unexpected) where
one side can be called “unexpected” as, for example, std::string::npos
can be. Unfortunately, this portion was a manual conversion.
References:
https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#binary-comparison
https://github.com/google/googletest/commit/77d6b173380332b1c1bc540532641f410ec82d65
https://github.com/google/googletest/pull/713
Change-Id: I978fef7c94183b8b1ef63f12f5ab4d6693626be3
Reviewed-on: https://chromium-review.googlesource.com/466727
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-04-04 00:35:21 -04:00
|
|
|
|
EXPECT_EQ(observed->vector_control, expected.vector_control);
|
|
|
|
|
EXPECT_EQ(observed->debug_control, expected.debug_control);
|
|
|
|
|
EXPECT_EQ(observed->last_branch_to_rip, expected.last_branch_to_rip);
|
|
|
|
|
EXPECT_EQ(observed->last_branch_from_rip, expected.last_branch_from_rip);
|
|
|
|
|
EXPECT_EQ(observed->last_exception_to_rip, expected.last_exception_to_rip);
|
|
|
|
|
EXPECT_EQ(observed->last_exception_from_rip,
|
|
|
|
|
expected.last_exception_from_rip);
|
2014-10-07 17:27:11 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-30 12:41:09 -08:00
|
|
|
|
void ExpectMinidumpContextARM(uint32_t expect_seed,
|
|
|
|
|
const MinidumpContextARM* observed,
|
|
|
|
|
bool snapshot) {
|
|
|
|
|
MinidumpContextARM expected;
|
|
|
|
|
InitializeMinidumpContextARM(&expected, expect_seed);
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(observed->context_flags, expected.context_flags);
|
|
|
|
|
|
2022-02-28 20:57:19 -08:00
|
|
|
|
for (size_t index = 0; index < std::size(expected.regs); ++index) {
|
2018-01-30 12:41:09 -08:00
|
|
|
|
EXPECT_EQ(observed->regs[index], expected.regs[index]);
|
|
|
|
|
}
|
|
|
|
|
EXPECT_EQ(observed->fp, expected.fp);
|
|
|
|
|
EXPECT_EQ(observed->ip, expected.ip);
|
|
|
|
|
EXPECT_EQ(observed->sp, expected.sp);
|
|
|
|
|
EXPECT_EQ(observed->lr, expected.lr);
|
|
|
|
|
EXPECT_EQ(observed->pc, expected.pc);
|
|
|
|
|
EXPECT_EQ(observed->cpsr, expected.cpsr);
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(observed->fpscr, expected.fpscr);
|
2022-02-28 20:57:19 -08:00
|
|
|
|
for (size_t index = 0; index < std::size(expected.vfp); ++index) {
|
2018-01-30 12:41:09 -08:00
|
|
|
|
EXPECT_EQ(observed->vfp[index], expected.vfp[index]);
|
|
|
|
|
}
|
2022-02-28 20:57:19 -08:00
|
|
|
|
for (size_t index = 0; index < std::size(expected.extra); ++index) {
|
2018-01-30 12:41:09 -08:00
|
|
|
|
EXPECT_EQ(observed->extra[index], snapshot ? 0 : expected.extra[index]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ExpectMinidumpContextARM64(uint32_t expect_seed,
|
|
|
|
|
const MinidumpContextARM64* observed,
|
|
|
|
|
bool snapshot) {
|
|
|
|
|
MinidumpContextARM64 expected;
|
|
|
|
|
InitializeMinidumpContextARM64(&expected, expect_seed);
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(observed->context_flags, expected.context_flags);
|
|
|
|
|
|
2022-02-28 20:57:19 -08:00
|
|
|
|
for (size_t index = 0; index < std::size(expected.regs); ++index) {
|
2018-01-30 12:41:09 -08:00
|
|
|
|
EXPECT_EQ(observed->regs[index], expected.regs[index]);
|
|
|
|
|
}
|
|
|
|
|
EXPECT_EQ(observed->cpsr, expected.cpsr);
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(observed->fpsr, expected.fpsr);
|
|
|
|
|
EXPECT_EQ(observed->fpcr, expected.fpcr);
|
2022-02-28 20:57:19 -08:00
|
|
|
|
for (size_t index = 0; index < std::size(expected.fpsimd); ++index) {
|
2018-01-30 12:41:09 -08:00
|
|
|
|
EXPECT_EQ(observed->fpsimd[index].lo, expected.fpsimd[index].lo);
|
|
|
|
|
EXPECT_EQ(observed->fpsimd[index].hi, expected.fpsimd[index].hi);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-07-10 11:17:22 +02:00
|
|
|
|
void ExpectMinidumpContextMIPS(uint32_t expect_seed,
|
|
|
|
|
const MinidumpContextMIPS* observed,
|
|
|
|
|
bool snapshot) {
|
|
|
|
|
MinidumpContextMIPS expected;
|
|
|
|
|
InitializeMinidumpContextMIPS(&expected, expect_seed);
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(observed->context_flags, expected.context_flags);
|
|
|
|
|
|
2022-02-28 20:57:19 -08:00
|
|
|
|
for (size_t index = 0; index < std::size(expected.regs); ++index) {
|
2018-07-10 11:17:22 +02:00
|
|
|
|
EXPECT_EQ(observed->regs[index], expected.regs[index]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(observed->mdlo, expected.mdlo);
|
|
|
|
|
EXPECT_EQ(observed->mdhi, expected.mdhi);
|
|
|
|
|
EXPECT_EQ(observed->epc, expected.epc);
|
|
|
|
|
EXPECT_EQ(observed->badvaddr, expected.badvaddr);
|
|
|
|
|
EXPECT_EQ(observed->status, expected.status);
|
|
|
|
|
EXPECT_EQ(observed->cause, expected.cause);
|
|
|
|
|
|
2022-02-28 20:57:19 -08:00
|
|
|
|
for (size_t index = 0; index < std::size(expected.fpregs.fregs); ++index) {
|
2018-07-10 11:17:22 +02:00
|
|
|
|
EXPECT_EQ(observed->fpregs.fregs[index]._fp_fregs,
|
|
|
|
|
expected.fpregs.fregs[index]._fp_fregs);
|
|
|
|
|
}
|
|
|
|
|
EXPECT_EQ(observed->fpcsr, expected.fpcsr);
|
|
|
|
|
EXPECT_EQ(observed->fir, expected.fir);
|
|
|
|
|
|
|
|
|
|
for (size_t index = 0; index < 3; ++index) {
|
|
|
|
|
EXPECT_EQ(observed->hi[index], expected.hi[index]);
|
|
|
|
|
EXPECT_EQ(observed->lo[index], expected.lo[index]);
|
|
|
|
|
}
|
|
|
|
|
EXPECT_EQ(observed->dsp_control, expected.dsp_control);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ExpectMinidumpContextMIPS64(uint32_t expect_seed,
|
|
|
|
|
const MinidumpContextMIPS64* observed,
|
|
|
|
|
bool snapshot) {
|
|
|
|
|
MinidumpContextMIPS64 expected;
|
|
|
|
|
InitializeMinidumpContextMIPS64(&expected, expect_seed);
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(observed->context_flags, expected.context_flags);
|
|
|
|
|
|
2022-02-28 20:57:19 -08:00
|
|
|
|
for (size_t index = 0; index < std::size(expected.regs); ++index) {
|
2018-07-10 11:17:22 +02:00
|
|
|
|
EXPECT_EQ(observed->regs[index], expected.regs[index]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(observed->mdlo, expected.mdlo);
|
|
|
|
|
EXPECT_EQ(observed->mdhi, expected.mdhi);
|
|
|
|
|
EXPECT_EQ(observed->epc, expected.epc);
|
|
|
|
|
EXPECT_EQ(observed->badvaddr, expected.badvaddr);
|
|
|
|
|
EXPECT_EQ(observed->status, expected.status);
|
|
|
|
|
EXPECT_EQ(observed->cause, expected.cause);
|
|
|
|
|
|
2022-02-28 20:57:19 -08:00
|
|
|
|
for (size_t index = 0; index < std::size(expected.fpregs.dregs); ++index) {
|
2018-07-10 11:17:22 +02:00
|
|
|
|
EXPECT_EQ(observed->fpregs.dregs[index], expected.fpregs.dregs[index]);
|
|
|
|
|
}
|
|
|
|
|
EXPECT_EQ(observed->fpcsr, expected.fpcsr);
|
|
|
|
|
EXPECT_EQ(observed->fir, expected.fir);
|
|
|
|
|
|
|
|
|
|
for (size_t index = 0; index < 3; ++index) {
|
|
|
|
|
EXPECT_EQ(observed->hi[index], expected.hi[index]);
|
|
|
|
|
EXPECT_EQ(observed->lo[index], expected.lo[index]);
|
|
|
|
|
}
|
|
|
|
|
EXPECT_EQ(observed->dsp_control, expected.dsp_control);
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-08 21:08:54 +00:00
|
|
|
|
void ExpectMinidumpContextRISCV64(uint32_t expect_seed,
|
|
|
|
|
const MinidumpContextRISCV64* observed,
|
|
|
|
|
bool snapshot) {
|
|
|
|
|
MinidumpContextRISCV64 expected;
|
|
|
|
|
InitializeMinidumpContextRISCV64(&expected, expect_seed);
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(observed->context_flags, expected.context_flags);
|
|
|
|
|
EXPECT_EQ(observed->version, expected.version);
|
|
|
|
|
|
|
|
|
|
for (size_t index = 0; index < std::size(expected.regs); ++index) {
|
|
|
|
|
EXPECT_EQ(observed->regs[index], expected.regs[index]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (size_t index = 0; index < std::size(expected.fpregs); ++index) {
|
|
|
|
|
EXPECT_EQ(observed->fpregs[index], expected.fpregs[index]);
|
|
|
|
|
}
|
|
|
|
|
EXPECT_EQ(observed->fcsr, expected.fcsr);
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-07 17:27:11 -04:00
|
|
|
|
} // namespace test
|
|
|
|
|
} // namespace crashpad
|