summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/cgptlib_test.c1
-rw-r--r--tests/crc32_test.c1
-rw-r--r--tests/tpm_lite/readonly.c1
-rw-r--r--tests/tpm_lite/tpmtest_earlynvram.c1
-rw-r--r--tests/tpm_lite/tpmtest_earlynvram2.c1
-rw-r--r--tests/tpm_lite/tpmtest_testsetup.c1
-rw-r--r--tests/tpm_lite/tpmtest_timing.c1
-rw-r--r--tests/utility_string_tests.c123
-rw-r--r--tests/vb20_rsa_padding_tests.c1
-rw-r--r--tests/vb2_rsa_utility_tests.c1
-rw-r--r--tests/vboot_api_kernel_tests.c1
-rw-r--r--tests/verify_kernel.c5
12 files changed, 1 insertions, 137 deletions
diff --git a/tests/cgptlib_test.c b/tests/cgptlib_test.c
index ee7cb9da..e522592c 100644
--- a/tests/cgptlib_test.c
+++ b/tests/cgptlib_test.c
@@ -13,7 +13,6 @@
#include "crc32_test.h"
#include "gpt.h"
#include "test_common.h"
-#include "utility.h"
/*
* Testing partition layout (sector_bytes=512)
diff --git a/tests/crc32_test.c b/tests/crc32_test.c
index aeb48b34..1d1d8cd3 100644
--- a/tests/crc32_test.c
+++ b/tests/crc32_test.c
@@ -7,7 +7,6 @@
#include "crc32.h"
#include "crc32_test.h"
#include "test_common.h"
-#include "utility.h"
#define MAX_VECTOR_LEN 256
diff --git a/tests/tpm_lite/readonly.c b/tests/tpm_lite/readonly.c
index c3940e12..68de06b4 100644
--- a/tests/tpm_lite/readonly.c
+++ b/tests/tpm_lite/readonly.c
@@ -14,7 +14,6 @@
#include <stdlib.h>
#include "tlcl.h"
-#include "utility.h"
/* These index values are used to create NVRAM spaces. They only need to be
* unique.
diff --git a/tests/tpm_lite/tpmtest_earlynvram.c b/tests/tpm_lite/tpmtest_earlynvram.c
index d5ff77f5..db44862f 100644
--- a/tests/tpm_lite/tpmtest_earlynvram.c
+++ b/tests/tpm_lite/tpmtest_earlynvram.c
@@ -12,7 +12,6 @@
#include "tlcl.h"
#include "tlcl_tests.h"
-#include "utility.h"
#define INDEX0 0xcafe
diff --git a/tests/tpm_lite/tpmtest_earlynvram2.c b/tests/tpm_lite/tpmtest_earlynvram2.c
index 88f6a6b4..9307a588 100644
--- a/tests/tpm_lite/tpmtest_earlynvram2.c
+++ b/tests/tpm_lite/tpmtest_earlynvram2.c
@@ -12,7 +12,6 @@
#include "tlcl.h"
#include "tlcl_tests.h"
-#include "utility.h"
int main(int argc, char** argv) {
uint32_t x;
diff --git a/tests/tpm_lite/tpmtest_testsetup.c b/tests/tpm_lite/tpmtest_testsetup.c
index ce360994..a6331d9d 100644
--- a/tests/tpm_lite/tpmtest_testsetup.c
+++ b/tests/tpm_lite/tpmtest_testsetup.c
@@ -12,7 +12,6 @@
#include "tlcl.h"
#include "tlcl_tests.h"
-#include "utility.h"
int main(int argc, char** argv) {
uint32_t perm;
diff --git a/tests/tpm_lite/tpmtest_timing.c b/tests/tpm_lite/tpmtest_timing.c
index 1ec14a2e..eaba52f4 100644
--- a/tests/tpm_lite/tpmtest_timing.c
+++ b/tests/tpm_lite/tpmtest_timing.c
@@ -16,7 +16,6 @@
#include "tlcl.h"
#include "tlcl_tests.h"
-#include "utility.h"
/* Runs [op] and ensures it returns success and doesn't run longer than
* [time_limit] in milliseconds.
diff --git a/tests/utility_string_tests.c b/tests/utility_string_tests.c
deleted file mode 100644
index d41cbe87..00000000
--- a/tests/utility_string_tests.c
+++ /dev/null
@@ -1,123 +0,0 @@
-/* Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- *
- * Tests for string utility functions.
- */
-
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "test_common.h"
-#include "utility.h"
-
-/* Test string concatenation */
-static void StrncatTest(void) {
- char dest[128];
-
- /* Null inputs */
- TEST_EQ(0, StrnAppend(dest, NULL, sizeof(dest)),
- "StrnAppend('', null)");
- TEST_EQ(0, StrnAppend(NULL, "Hey!", sizeof(dest)),
- "StrnAppend(null, '')");
-
- /* Empty <-- empty */
- *dest = 0;
- TEST_EQ(0, StrnAppend(dest, "", sizeof(dest)), "StrnAppend('', '')");
- TEST_EQ(0, strcmp(dest, ""), "StrnAppend('', '') result");
-
- /* Nonempty <-- empty */
- strcpy(dest, "Bob");
- TEST_EQ(3, StrnAppend(dest, "", sizeof(dest)), "StrnAppend(B, '')");
- TEST_EQ(0, strcmp(dest, "Bob"), "StrnAppend(B, '') result");
-
- /* Empty <-- nonempty */
- *dest = 0;
- TEST_EQ(5, StrnAppend(dest, "Alice", sizeof(dest)),
- "StrnAppend('', A)");
- TEST_EQ(0, strcmp(dest, "Alice"), "StrnAppend('', A) result");
-
- /* Nonempty <-- nonempty */
- strcpy(dest, "Tigre");
- TEST_EQ(10, StrnAppend(dest, "Bunny", sizeof(dest)),
- "StrnAppend(T, B)");
- TEST_EQ(0, strcmp(dest, "TigreBunny"), "StrnAppend(T, B) result");
-
- /* Test clipping */
- strcpy(dest, "YesI");
- TEST_EQ(7, StrnAppend(dest, "Can't", 8), "StrnAppend(Y, over)");
- TEST_EQ(0, strcmp(dest, "YesICan"), "StrnAppend(Y, over) result");
-
- /* Test clipping if dest already overflows its claimed length */
- strcpy(dest, "BudgetDeficit");
- TEST_EQ(6, StrnAppend(dest, "Spending", 7), "StrnAppend(over, over)");
- TEST_EQ(0, strcmp(dest, "Budget"), "StrnAppend(over, over) result");
-}
-
-
-static void TestU64ToS(uint64_t value, uint32_t radix, uint32_t zero_pad_width,
- const char *expect) {
- char dest[UINT64_TO_STRING_MAX];
-
- TEST_EQ(strlen(expect),
- Uint64ToString(dest, sizeof(dest), value, radix,
- zero_pad_width),
- "Uint64ToString");
- printf("Uint64ToString expect %s got %s\n", expect, dest);
- TEST_EQ(0, strcmp(dest, expect), "Uint64ToString result");
-}
-
-
-/* Test uint64 to string conversion */
-static void Uint64ToStringTest(void) {
- char dest[UINT64_TO_STRING_MAX];
-
- /* Test invalid inputs */
- TEST_EQ(0, Uint64ToString(NULL, 8, 123, 10, 8),
- "Uint64ToString null dest");
- TestU64ToS(0, 1, 0, "");
- TestU64ToS(0, 37, 0, "");
-
- /* Binary */
- TestU64ToS(0, 2, 0, "0");
- TestU64ToS(0x9A, 2, 0, "10011010");
- TestU64ToS(0x71, 2, 12, "000001110001");
- TestU64ToS(~0ULL, 2, 0,
- "1111111111111111111111111111111111111111111111111111111111111111");
-
- /* Decimal */
- TestU64ToS(0, 10, 0, "0");
- TestU64ToS(12345, 10, 0, "12345");
- TestU64ToS(67890, 10, 8, "00067890");
- TestU64ToS(~0ULL, 10, 0, "18446744073709551615");
-
- /* Hex */
- TestU64ToS(0, 16, 0, "0");
- TestU64ToS(0x12345678, 16, 0, "12345678");
- TestU64ToS(0x9ABCDEF, 16, 8, "09abcdef");
- TestU64ToS(~0ULL, 16, 0, "ffffffffffffffff");
-
- /* Zero pad corner cases */
- /* Don't pad if over length */
- 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");
-
-}
-
-
-int main(int argc, char* argv[]) {
- int error_code = 0;
-
- StrncatTest();
- Uint64ToStringTest();
-
- if (!gTestSuccess)
- error_code = 255;
-
- return error_code;
-}
diff --git a/tests/vb20_rsa_padding_tests.c b/tests/vb20_rsa_padding_tests.c
index be9d91b5..8a0d58af 100644
--- a/tests/vb20_rsa_padding_tests.c
+++ b/tests/vb20_rsa_padding_tests.c
@@ -12,7 +12,6 @@
#include "host_key.h"
#include "rsa_padding_test.h"
#include "test_common.h"
-#include "utility.h"
#include "vb2_common.h"
/**
diff --git a/tests/vb2_rsa_utility_tests.c b/tests/vb2_rsa_utility_tests.c
index 989b401e..cc856e88 100644
--- a/tests/vb2_rsa_utility_tests.c
+++ b/tests/vb2_rsa_utility_tests.c
@@ -12,7 +12,6 @@
#include "file_keys.h"
#include "rsa_padding_test.h"
#include "test_common.h"
-#include "utility.h"
#include "vboot_api.h"
#include "vboot_test.h"
diff --git a/tests/vboot_api_kernel_tests.c b/tests/vboot_api_kernel_tests.c
index d7c32357..bcb5d046 100644
--- a/tests/vboot_api_kernel_tests.c
+++ b/tests/vboot_api_kernel_tests.c
@@ -11,7 +11,6 @@
#include "2sysincludes.h"
#include "load_kernel_fw.h"
#include "test_common.h"
-#include "utility.h"
#include "vboot_api.h"
#include "vboot_kernel.h"
#include "vboot_test.h"
diff --git a/tests/verify_kernel.c b/tests/verify_kernel.c
index 28813c40..9aaad723 100644
--- a/tests/verify_kernel.c
+++ b/tests/verify_kernel.c
@@ -5,12 +5,9 @@
* Routines for verifying a kernel or disk image
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
#include "2sysincludes.h"
#include "2api.h"
+#include "2common.h"
#include "2misc.h"
#include "2nvstorage.h"
#include "host_common.h"