2014-10-07 17:27:11 -04:00
|
|
|
|
// Copyright 2014 The Crashpad Authors. All rights reserved.
|
|
|
|
|
//
|
|
|
|
|
// 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>
|
|
|
|
|
|
2015-02-05 15:04:49 -08:00
|
|
|
|
#include "base/format_macros.h"
|
2016-01-06 12:22:50 -05:00
|
|
|
|
#include "base/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++);
|
2014-10-07 17:27:11 -04:00
|
|
|
|
for (size_t index = 0; index < arraysize(context->vector_register); ++index) {
|
|
|
|
|
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++;
|
|
|
|
|
}
|
|
|
|
|
|
2014-11-03 17:43:39 -05:00
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
|
|
// Using gtest assertions, compares |expected| to |observed|. This is
|
|
|
|
|
// 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);
|
2014-11-03 17:43:39 -05:00
|
|
|
|
for (size_t st_mm_index = 0;
|
|
|
|
|
st_mm_index < arraysize(expected->st_mm);
|
|
|
|
|
++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,
|
|
|
|
|
arraysize(observed->st_mm[st_mm_index].st)),
|
|
|
|
|
BytesToHexString(expected->st_mm[st_mm_index].st,
|
|
|
|
|
arraysize(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,
|
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
|
|
|
|
arraysize(observed->st_mm[st_mm_index].st_reserved)),
|
|
|
|
|
BytesToHexString(expected->st_mm[st_mm_index].st_reserved,
|
|
|
|
|
arraysize(expected->st_mm[st_mm_index].st_reserved)));
|
2014-11-03 17:43:39 -05:00
|
|
|
|
}
|
|
|
|
|
for (size_t xmm_index = 0;
|
|
|
|
|
xmm_index < arraysize(expected->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
|
|
|
|
EXPECT_EQ(BytesToHexString(observed->xmm[xmm_index],
|
|
|
|
|
arraysize(observed->xmm[xmm_index])),
|
|
|
|
|
BytesToHexString(expected->xmm[xmm_index],
|
|
|
|
|
arraysize(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(
|
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(observed->reserved_4, arraysize(observed->reserved_4)),
|
|
|
|
|
BytesToHexString(expected->reserved_4, arraysize(expected->reserved_4)));
|
2017-02-16 13:25:29 -05:00
|
|
|
|
EXPECT_EQ(
|
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(observed->available, arraysize(observed->available)),
|
|
|
|
|
BytesToHexString(expected->available, arraysize(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);
|
2017-02-16 13:25:29 -05:00
|
|
|
|
for (size_t index = 0; index < arraysize(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],
|
|
|
|
|
arraysize(observed->fsave.st[index])),
|
|
|
|
|
BytesToHexString(expected.fsave.st[index],
|
|
|
|
|
arraysize(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);
|
|
|
|
|
|
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);
|
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);
|
|
|
|
|
|
2014-10-07 17:27:11 -04:00
|
|
|
|
for (size_t index = 0; index < arraysize(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
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace test
|
|
|
|
|
} // namespace crashpad
|