summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGabe Black <gabeblack@chromium.org>2013-03-16 04:03:40 -0700
committerChromeBot <chrome-bot@google.com>2013-03-19 16:55:44 -0700
commitac8805e7e9bd40c03baf44e37b26f28d9b763ab5 (patch)
tree9297d954f0fc50bb9de01fb9672ddaea076e2f01 /tests
parent77f55ca1cd282ac6c540ea3a8bacbc35c2600d60 (diff)
downloadvboot-ac8805e7e9bd40c03baf44e37b26f28d9b763ab5.tar.gz
Get rid of some crufty macros.
These were macros that were never used, or that were only set to one thing and could be substituted up front. I left in code guarded by the HAVE_ENDIAN_H and HAVE_LITTLE_ENDIAN macros even though those are never defined because they guard a reportedly significantly faster implementation of some functionality, at least according to a comment in the source. It would be a good idea to enable that code path and see if it really does make a big difference before removing it entirely. BUG=None TEST=Built for Link, Daisy, and the host with FEATURES=test. Built depthcharge for Link and booted in normal mode. BRANCH=None Change-Id: I934a4dd0da169ac018ba07350d56924ab88b1acc Signed-off-by: Gabe Black <gabeblack@google.com> Reviewed-on: https://gerrit.chromium.org/gerrit/45687 Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Gabe Black <gabeblack@chromium.org> Tested-by: Gabe Black <gabeblack@chromium.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/big_firmware_tests.c2
-rw-r--r--tests/big_kernel_tests.c2
-rw-r--r--tests/cgptlib_test.c3
-rw-r--r--tests/cgptlib_test.h3
-rw-r--r--tests/rollback_index2_tests.c3
-rw-r--r--tests/rollback_index3_tests.c3
-rw-r--r--tests/sha_tests.c3
-rw-r--r--tests/stateful_util_tests.c3
-rw-r--r--tests/timer_utils.h2
-rw-r--r--tests/tpm_bootmode_tests.c3
-rw-r--r--tests/utility_string_tests.c11
-rw-r--r--tests/utility_tests.c19
-rw-r--r--tests/vboot_api_devmode_tests.c3
-rw-r--r--tests/vboot_api_firmware_tests.c3
-rw-r--r--tests/vboot_api_init_tests.c3
-rw-r--r--tests/vboot_audio_tests.c3
-rw-r--r--tests/vboot_common_tests.c3
-rw-r--r--tests/vboot_firmware_tests.c3
-rw-r--r--tests/vboot_nvstorage_test.c3
19 files changed, 14 insertions, 64 deletions
diff --git a/tests/big_firmware_tests.c b/tests/big_firmware_tests.c
index f460115f..ca1dea8e 100644
--- a/tests/big_firmware_tests.c
+++ b/tests/big_firmware_tests.c
@@ -16,7 +16,7 @@
#include "utility.h"
/* Choose a firmware size greater than the range of 32-bits unsigned. */
-#define BIG_FIRMWARE_SIZE UINT64_C(0x100000000)
+#define BIG_FIRMWARE_SIZE (0x100000000ULL)
#define ROOT_KEY_BASE_NAME "testkeys/key_rsa8192"
#define FIRMWARE_KEY_BASE_NAME "testkeys/key_rsa1024"
diff --git a/tests/big_kernel_tests.c b/tests/big_kernel_tests.c
index 5524bad6..cc4ceca0 100644
--- a/tests/big_kernel_tests.c
+++ b/tests/big_kernel_tests.c
@@ -16,7 +16,7 @@
#include "utility.h"
/* Choose a kernel size greater than the range of 32-bits unsigned. */
-#define BIG_KERNEL_SIZE UINT64_C(0x100000000)
+#define BIG_KERNEL_SIZE (0x100000000ULL)
#define FIRMWARE_KEY_BASE_NAME "testkeys/key_rsa2048"
#define KERNEL_KEY_BASE_NAME "testkeys/key_rsa1024"
diff --git a/tests/cgptlib_test.c b/tests/cgptlib_test.c
index b48543f3..bbff7808 100644
--- a/tests/cgptlib_test.c
+++ b/tests/cgptlib_test.c
@@ -1371,9 +1371,6 @@ static int ErrorTextTest(void)
return TEST_OK;
}
-/* disable MSVC warnings on unused arguments */
-__pragma(warning (disable: 4100))
-
int main(int argc, char *argv[])
{
int i;
diff --git a/tests/cgptlib_test.h b/tests/cgptlib_test.h
index 5f8b0429..8668c9c5 100644
--- a/tests/cgptlib_test.h
+++ b/tests/cgptlib_test.h
@@ -18,9 +18,6 @@ typedef int (*test_func)();
#define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0]))
-/* disable MSVC warning on const logical expression (as in } while(0);) */
-__pragma(warning (disable: 4127))
-
#define EXPECT(expr) \
do { \
if (!(expr)) { \
diff --git a/tests/rollback_index2_tests.c b/tests/rollback_index2_tests.c
index b670812d..d5f29743 100644
--- a/tests/rollback_index2_tests.c
+++ b/tests/rollback_index2_tests.c
@@ -973,9 +973,6 @@ static void RollbackS3ResumeTest(void)
"RollbackS3Resume() other error");
}
-/* disable MSVC warnings on unused arguments */
-__pragma(warning (disable: 4100))
-
int main(int argc, char* argv[])
{
CrcTestFirmware();
diff --git a/tests/rollback_index3_tests.c b/tests/rollback_index3_tests.c
index ece8bc08..30af89df 100644
--- a/tests/rollback_index3_tests.c
+++ b/tests/rollback_index3_tests.c
@@ -14,9 +14,6 @@
#include "rollback_index.h"
#include "test_common.h"
-/* disable MSVC warnings on unused arguments */
-__pragma(warning (disable: 4100))
-
int main(int argc, char* argv[])
{
int is_virt_dev;
diff --git a/tests/sha_tests.c b/tests/sha_tests.c
index 6cc7e0f6..b462ccc0 100644
--- a/tests/sha_tests.c
+++ b/tests/sha_tests.c
@@ -78,9 +78,6 @@ int SHA512_tests(void) {
return success;
}
-/* disable MSVC warnings on unused arguments */
-__pragma(warning (disable: 4100))
-
int main(int argc, char* argv[]) {
int success = 1;
/* Initialize long_msg with 'a' x 1,000,000 */
diff --git a/tests/stateful_util_tests.c b/tests/stateful_util_tests.c
index 077a2ae9..e41feacb 100644
--- a/tests/stateful_util_tests.c
+++ b/tests/stateful_util_tests.c
@@ -283,9 +283,6 @@ static void StatefulMemcpyTest(void) {
}
-/* disable MSVC warnings on unused arguments */
-__pragma(warning (disable: 4100))
-
int main(int argc, char* argv[]) {
int error_code = 0;
diff --git a/tests/timer_utils.h b/tests/timer_utils.h
index f0d6b299..69380722 100644
--- a/tests/timer_utils.h
+++ b/tests/timer_utils.h
@@ -6,9 +6,7 @@
#ifndef VBOOT_REFERENCE_TIMER_UTILS_H_
#define VBOOT_REFERENCE_TIMER_UTILS_H_
-#ifndef _MSC_VER
#include <inttypes.h>
-#endif
#include <time.h>
diff --git a/tests/tpm_bootmode_tests.c b/tests/tpm_bootmode_tests.c
index 3fd7a956..48552c58 100644
--- a/tests/tpm_bootmode_tests.c
+++ b/tests/tpm_bootmode_tests.c
@@ -68,9 +68,6 @@ static void BootStateTest(void) {
}
-/* disable MSVC warnings on unused arguments */
-__pragma(warning (disable: 4100))
-
int main(int argc, char* argv[]) {
int error_code = 0;
diff --git a/tests/utility_string_tests.c b/tests/utility_string_tests.c
index 42254a4a..fe11d70b 100644
--- a/tests/utility_string_tests.c
+++ b/tests/utility_string_tests.c
@@ -80,24 +80,24 @@ static void Uint64ToStringTest(void) {
TestU64ToS(0x9A, 2, 0, "10011010");
TestU64ToS(0x71, 2, 12, "000001110001");
TestU64ToS(
- ~UINT64_C(0), 2, 0,
+ ~0ULL, 2, 0,
"1111111111111111111111111111111111111111111111111111111111111111");
/* Decimal */
TestU64ToS(0, 10, 0, "0");
TestU64ToS(12345, 10, 0, "12345");
TestU64ToS(67890, 10, 8, "00067890");
- TestU64ToS(~UINT64_C(0), 10, 0, "18446744073709551615");
+ TestU64ToS(~0ULL, 10, 0, "18446744073709551615");
/* Hex */
TestU64ToS(0, 16, 0, "0");
TestU64ToS(0x12345678, 16, 0, "12345678");
TestU64ToS(0x9ABCDEF, 16, 8, "09abcdef");
- TestU64ToS(~UINT64_C(0), 16, 0, "ffffffffffffffff");
+ TestU64ToS(~0ULL, 16, 0, "ffffffffffffffff");
/* Zero pad corner cases */
/* Don't pad if over length */
- TestU64ToS(UINT64_C(0x1234567890), 16, 8, "1234567890");
+ TestU64ToS(0x1234567890ULL, 16, 8, "1234567890");
/* Fail if padding won't fit in buffer */
TEST_EQ(0, Uint64ToString(dest, 8, 123, 10, 8), "Uint64ToString bad pad");
TEST_EQ(0, strcmp(dest, ""), "Uint64ToString bad pad result");
@@ -105,9 +105,6 @@ static void Uint64ToStringTest(void) {
}
-/* disable MSVC warnings on unused arguments */
-__pragma(warning (disable: 4100))
-
int main(int argc, char* argv[]) {
int error_code = 0;
diff --git a/tests/utility_tests.c b/tests/utility_tests.c
index 5ecb0b06..7e21c77a 100644
--- a/tests/utility_tests.c
+++ b/tests/utility_tests.c
@@ -19,8 +19,8 @@
/* Test utility.h and sysincludes.h macros */
static void MacrosTest(void) {
int64_t a = -10, b = -20;
- uint64_t u = UINT64_C(0xABCD00000000);
- uint64_t v = UINT64_C(0xABCD000000);
+ uint64_t u = (0xABCD00000000ULL);
+ uint64_t v = (0xABCD000000ULL);
TEST_EQ(CombineUint16Pair(1, 2), 0x00010002, "CombineUint16Pair");
TEST_EQ(CombineUint16Pair(0xFFFE, 0xFFFF), 0xFFFEFFFF,
@@ -37,13 +37,13 @@ static void MacrosTest(void) {
TEST_EQ(Min(b, a), b, "Min uint64 2");
TEST_EQ(Min(b, b), b, "Min uint64 same");
- TEST_EQ(UINT64_RSHIFT(u, 8), v, "UINT64_RSHIFT 8");
- TEST_EQ(UINT64_RSHIFT(u, 0), u, "UINT64_RSHIFT 0");
- TEST_EQ(UINT64_RSHIFT(u, 36), UINT64_C(0xABC), "UINT64_RSHIFT 36");
+ TEST_EQ(u >> 8, v, "uint64_t >> 8");
+ TEST_EQ(u >> 0, u, "uint64_t >> 0");
+ TEST_EQ(u >> 36, (uint64_t)0xABC, "uint64_t >> 36");
- TEST_EQ(UINT64_MULT32(v, 0), 0, "UINT64_MULT32 0");
- TEST_EQ(UINT64_MULT32(v, 1), v, "UINT64_MULT32 1");
- TEST_EQ(UINT64_MULT32(v, 256), u, "UINT64_MULT32 256");
+ TEST_EQ(v * (uint32_t)0, 0, "uint64_t * uint32_t 0");
+ TEST_EQ(v * (uint32_t)1, v, "uint64_t * uint32_t 1");
+ TEST_EQ(v * (uint32_t)256, u, "uint64_t * uint32_t 256");
}
@@ -62,9 +62,6 @@ static void SafeMemcmpTest(void) {
}
-/* disable MSVC warnings on unused arguments */
-__pragma(warning (disable: 4100))
-
int main(int argc, char* argv[]) {
int error_code = 0;
diff --git a/tests/vboot_api_devmode_tests.c b/tests/vboot_api_devmode_tests.c
index 1ca58b99..af20030f 100644
--- a/tests/vboot_api_devmode_tests.c
+++ b/tests/vboot_api_devmode_tests.c
@@ -319,9 +319,6 @@ static void VbBootDeveloperSoundTest(void) {
}
-/* disable MSVC warnings on unused arguments */
-__pragma(warning (disable: 4100))
-
int main(int argc, char* argv[]) {
int error_code = 0;
diff --git a/tests/vboot_api_firmware_tests.c b/tests/vboot_api_firmware_tests.c
index e6a84ee0..a31b532e 100644
--- a/tests/vboot_api_firmware_tests.c
+++ b/tests/vboot_api_firmware_tests.c
@@ -236,9 +236,6 @@ static void VbSelectFirmwareTest(void) {
}
-/* disable MSVC warnings on unused arguments */
-__pragma(warning (disable: 4100))
-
int main(int argc, char* argv[]) {
int error_code = 0;
diff --git a/tests/vboot_api_init_tests.c b/tests/vboot_api_init_tests.c
index bde10a7c..7834b907 100644
--- a/tests/vboot_api_init_tests.c
+++ b/tests/vboot_api_init_tests.c
@@ -512,9 +512,6 @@ static void VbInitTestTPM(void)
TEST_EQ(rfs_clear_tpm_request, 1, "rfs tpm clear request");
}
-/* disable MSVC warnings on unused arguments */
-__pragma(warning (disable: 4100))
-
int main(int argc, char *argv[])
{
VbInitTest();
diff --git a/tests/vboot_audio_tests.c b/tests/vboot_audio_tests.c
index 4d633516..a1ecf71b 100644
--- a/tests/vboot_audio_tests.c
+++ b/tests/vboot_audio_tests.c
@@ -214,9 +214,6 @@ static void VbAudioTest(void) {
}
-/* disable MSVC warnings on unused arguments */
-__pragma(warning (disable: 4100))
-
int main(int argc, char* argv[]) {
int error_code = 0;
diff --git a/tests/vboot_common_tests.c b/tests/vboot_common_tests.c
index 73cbeb55..df4fdc21 100644
--- a/tests/vboot_common_tests.c
+++ b/tests/vboot_common_tests.c
@@ -228,9 +228,6 @@ static void VbSharedDataTest(void)
"VbSharedDataSetKernelKey null");
}
-/* disable MSVC warnings on unused arguments */
-__pragma(warning (disable: 4100))
-
int main(int argc, char* argv[])
{
StructPackingTest();
diff --git a/tests/vboot_firmware_tests.c b/tests/vboot_firmware_tests.c
index 0443b061..24a6c285 100644
--- a/tests/vboot_firmware_tests.c
+++ b/tests/vboot_firmware_tests.c
@@ -423,9 +423,6 @@ static void LoadFirmwareTest(void) {
}
-/* disable MSVC warnings on unused arguments */
-__pragma(warning (disable: 4100))
-
int main(int argc, char* argv[]) {
int error_code = 0;
diff --git a/tests/vboot_nvstorage_test.c b/tests/vboot_nvstorage_test.c
index 15c229f3..91e8a89a 100644
--- a/tests/vboot_nvstorage_test.c
+++ b/tests/vboot_nvstorage_test.c
@@ -170,9 +170,6 @@ static void VbNvStorageTest(void) {
}
-/* disable MSVC warnings on unused arguments */
-__pragma(warning (disable: 4100))
-
int main(int argc, char* argv[]) {
int error_code = 0;