diff options
author | vbendeb <vbendeb@chromium.org> | 2010-06-24 16:19:53 -0700 |
---|---|---|
committer | vbendeb <vbendeb@chromium.org> | 2010-06-24 16:19:53 -0700 |
commit | 3ecaf776d82d29573be083b2e5c6ddc5b9f49c70 (patch) | |
tree | 3887c0749d73e45562a250c275f56eb4f5356613 /tests/vboot_common_tests.c | |
parent | d6aad3a0888ad57383036dacdfc4c01f0c3b56e3 (diff) | |
download | vboot-3ecaf776d82d29573be083b2e5c6ddc5b9f49c70.tar.gz |
Make vboot_reference build in MSVC command line environment.
This is a mostly NOOP change which modifies the source code
to compile cleanly in the MSVC command line build
environment.
A new makefile is introduced (msc/nmakefile) along with a
README.txt in the same directory explaining how to build
the code in the DOS window. As of this submission the build
is running in a 32 bit environment, the intention is to use
the same makefile for 64 bit builds in the future.
Enabling high compilation warnings level allowed to
identify a couple of bugs in the code which are being fixed.
Not all sources are being compiled in the MSVC environment,
only those in firmware/ and most of those in test/
subdirectories. The benchmark calculations require porting
of the timer facilities and are being postponed.
TEST
Built in DOS and linux environments. Ran unit tests in
linux environment.
Review URL: http://codereview.chromium.org/2809037
Diffstat (limited to 'tests/vboot_common_tests.c')
-rw-r--r-- | tests/vboot_common_tests.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/tests/vboot_common_tests.c b/tests/vboot_common_tests.c index e707daf1..d01b2f93 100644 --- a/tests/vboot_common_tests.c +++ b/tests/vboot_common_tests.c @@ -31,24 +31,24 @@ static void VerifyHelperFunctions(void) { { uint8_t p[1]; - TEST_EQ(OffsetOf(p, p), 0, "OffsetOf() equal"); - TEST_EQ(OffsetOf(p, p+10), 10, "OffsetOf() positive"); - TEST_EQ(OffsetOf(p, p+0x12345678), 0x12345678, "OffsetOf() large"); + TEST_EQ((int)OffsetOf(p, p), 0, "OffsetOf() equal"); + TEST_EQ((int)OffsetOf(p, p+10), 10, "OffsetOf() positive"); + TEST_EQ((int)OffsetOf(p, p+0x12345678), 0x12345678, "OffsetOf() large"); } { VbPublicKey k = {sizeof(k), 2, 3, 4}; - TEST_EQ(OffsetOf(&k, GetPublicKeyData(&k)), sizeof(k), + TEST_EQ((int)OffsetOf(&k, GetPublicKeyData(&k)), sizeof(k), "GetPublicKeyData() adjacent"); - TEST_EQ(OffsetOf(&k, GetPublicKeyDataC(&k)), sizeof(k), + TEST_EQ((int)OffsetOf(&k, GetPublicKeyDataC(&k)), sizeof(k), "GetPublicKeyDataC() adjacent"); } { VbPublicKey k = {123, 2, 3, 4}; - TEST_EQ(OffsetOf(&k, GetPublicKeyData(&k)), 123, + TEST_EQ((int)OffsetOf(&k, GetPublicKeyData(&k)), 123, "GetPublicKeyData() spaced"); - TEST_EQ(OffsetOf(&k, GetPublicKeyDataC(&k)), 123, + TEST_EQ((int)OffsetOf(&k, GetPublicKeyDataC(&k)), 123, "GetPublicKeyDataC() spaced"); } @@ -64,7 +64,7 @@ static void VerifyHelperFunctions(void) { "MemberInside member too big"); TEST_EQ(VerifyMemberInside(p, 20, p, 4, 21, 0), 1, "MemberInside data after parent"); - TEST_EQ(VerifyMemberInside(p, 20, p, 4, -1, 0), 1, + TEST_EQ(VerifyMemberInside(p, 20, p, 4, (uint64_t)-1, 0), 1, "MemberInside data before parent"); TEST_EQ(VerifyMemberInside(p, 20, p, 4, 4, 17), 1, "MemberInside data too big"); @@ -101,6 +101,8 @@ static void VerifyHelperFunctions(void) { } +/* disable MSVC warnings on unused arguments */ +__pragma(warning (disable: 4100)) int main(int argc, char* argv[]) { int error_code = 0; |