summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2016-10-18 14:41:22 -0700
committerRandall Spangler <rspangler@chromium.org>2016-11-06 02:33:50 +0000
commit559a110f33b7ebe8d950f1c2de6b3b89791f862b (patch)
tree7853ac7a1f8a47cc981613e632f55cdc7dc33974 /tests
parent47eeaa6e4a03d2689c9b1b46fc9b0b0b04ace3a6 (diff)
downloadvboot-559a110f33b7ebe8d950f1c2de6b3b89791f862b.tar.gz
vboot: use malloc and free directly
Originally, vboot1 code used VbExMalloc() and VbExFree() since it needed to talk to EFI firmware that didn't have standard malloc() and free(). Now, coreboot and depthcharge implement them as wrappers around those standard calls. vboot2 code already calls them directly, so let vboot1 code do that too. BUG=chromium:611535 BRANCH=none TEST=make runtests; emerge-kevin coreboot depthcharge Change-Id: I49ad0e32e38d278dc3589bfaf494bcf0e4b0a4bd Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/400905
Diffstat (limited to 'tests')
-rw-r--r--tests/cgptlib_test.c1
-rw-r--r--tests/rollback_index2_tests.c2
-rw-r--r--tests/rollback_index3_tests.c2
-rw-r--r--tests/test_common.h3
-rw-r--r--tests/vb20_rsa_padding_tests.c3
-rw-r--r--tests/vb2_rsa_utility_tests.c2
-rw-r--r--tests/vboot_api_devmode_tests.c13
-rw-r--r--tests/vboot_api_kernel2_tests.c3
-rw-r--r--tests/vboot_api_kernel3_tests.c3
-rw-r--r--tests/vboot_api_kernel4_tests.c3
-rw-r--r--tests/vboot_api_kernel5_tests.c3
-rw-r--r--tests/vboot_api_kernel6_tests.c3
-rw-r--r--tests/vboot_api_kernel_tests.c3
-rw-r--r--tests/vboot_audio_tests.c13
-rw-r--r--tests/vboot_common_tests.c3
-rw-r--r--tests/vboot_display_tests.c7
-rw-r--r--tests/vboot_kernel_tests.c3
-rw-r--r--tests/vboot_nvstorage_test.c12
-rw-r--r--tests/vboot_region_tests.c12
19 files changed, 14 insertions, 80 deletions
diff --git a/tests/cgptlib_test.c b/tests/cgptlib_test.c
index f1a91cdc..c0147e16 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"
-#define _STUB_IMPLEMENTATION_
#include "utility.h"
/*
diff --git a/tests/rollback_index2_tests.c b/tests/rollback_index2_tests.c
index a1fdf0c7..290f69eb 100644
--- a/tests/rollback_index2_tests.c
+++ b/tests/rollback_index2_tests.c
@@ -10,8 +10,6 @@
#include <stdlib.h>
#include <string.h>
-#define _STUB_IMPLEMENTATION_ /* So we can use memset() ourselves */
-
#include "2crc8.h"
#include "rollback_index.h"
#include "test_common.h"
diff --git a/tests/rollback_index3_tests.c b/tests/rollback_index3_tests.c
index 46863fbd..19c13931 100644
--- a/tests/rollback_index3_tests.c
+++ b/tests/rollback_index3_tests.c
@@ -10,8 +10,6 @@
#include <stdlib.h>
#include <string.h>
-#define _STUB_IMPLEMENTATION_ /* So we can use memset() ourselves */
-
#include "rollback_index.h"
#include "test_common.h"
diff --git a/tests/test_common.h b/tests/test_common.h
index 0e2c8d6c..25f39d9c 100644
--- a/tests/test_common.h
+++ b/tests/test_common.h
@@ -127,9 +127,6 @@ int test_succ(int result,
#define COL_RED "\x1b[0;31m"
#define COL_STOP "\x1b[m"
-/* Check that all memory allocations were freed */
-int vboot_api_stub_check_memory(void);
-
/* Abort if asprintf fails. */
#define xasprintf(...) \
do { \
diff --git a/tests/vb20_rsa_padding_tests.c b/tests/vb20_rsa_padding_tests.c
index c506572d..dbfdc38f 100644
--- a/tests/vb20_rsa_padding_tests.c
+++ b/tests/vb20_rsa_padding_tests.c
@@ -3,12 +3,9 @@
* found in the LICENSE file.
*/
-
#include <stdint.h>
#include <stdio.h>
-#define _STUB_IMPLEMENTATION_
-
#include "file_keys.h"
#include "rsa_padding_test.h"
#include "test_common.h"
diff --git a/tests/vb2_rsa_utility_tests.c b/tests/vb2_rsa_utility_tests.c
index 9fe1b7e1..796f09d0 100644
--- a/tests/vb2_rsa_utility_tests.c
+++ b/tests/vb2_rsa_utility_tests.c
@@ -7,8 +7,6 @@
#include <stdint.h>
#include <stdio.h>
-#define _STUB_IMPLEMENTATION_
-
#include "2sysincludes.h"
#include "2common.h"
diff --git a/tests/vboot_api_devmode_tests.c b/tests/vboot_api_devmode_tests.c
index be8cdf94..abd8e858 100644
--- a/tests/vboot_api_devmode_tests.c
+++ b/tests/vboot_api_devmode_tests.c
@@ -324,15 +324,8 @@ static void VbBootDeveloperSoundTest(void) {
}
-int main(int argc, char* argv[]) {
- int error_code = 0;
-
+int main(int argc, char* argv[])
+{
VbBootDeveloperSoundTest();
-
- if (!gTestSuccess)
- error_code = 255;
- if (vboot_api_stub_check_memory())
- error_code = 255;
-
- return error_code;
+ return gTestSuccess ? 0 : 255;
}
diff --git a/tests/vboot_api_kernel2_tests.c b/tests/vboot_api_kernel2_tests.c
index c0f31b46..8a566367 100644
--- a/tests/vboot_api_kernel2_tests.c
+++ b/tests/vboot_api_kernel2_tests.c
@@ -718,8 +718,5 @@ int main(void)
VbBootDevTest();
VbBootRecTest();
- if (vboot_api_stub_check_memory())
- return 255;
-
return gTestSuccess ? 0 : 255;
}
diff --git a/tests/vboot_api_kernel3_tests.c b/tests/vboot_api_kernel3_tests.c
index 0a47fa8b..3eddb739 100644
--- a/tests/vboot_api_kernel3_tests.c
+++ b/tests/vboot_api_kernel3_tests.c
@@ -426,8 +426,5 @@ int main(void)
{
VbSoftwareSyncTest();
- if (vboot_api_stub_check_memory())
- return 255;
-
return gTestSuccess ? 0 : 255;
}
diff --git a/tests/vboot_api_kernel4_tests.c b/tests/vboot_api_kernel4_tests.c
index 26f92726..2672c4e7 100644
--- a/tests/vboot_api_kernel4_tests.c
+++ b/tests/vboot_api_kernel4_tests.c
@@ -255,8 +255,5 @@ int main(void)
{
VbSlkTest();
- if (vboot_api_stub_check_memory())
- return 255;
-
return gTestSuccess ? 0 : 255;
}
diff --git a/tests/vboot_api_kernel5_tests.c b/tests/vboot_api_kernel5_tests.c
index d752f6b7..8633f7e7 100644
--- a/tests/vboot_api_kernel5_tests.c
+++ b/tests/vboot_api_kernel5_tests.c
@@ -306,8 +306,5 @@ int main(void)
{
VerifyMemoryBootImageTest();
- if (vboot_api_stub_check_memory())
- return 255;
-
return gTestSuccess ? 0 : 255;
}
diff --git a/tests/vboot_api_kernel6_tests.c b/tests/vboot_api_kernel6_tests.c
index 42bd279c..a24cde80 100644
--- a/tests/vboot_api_kernel6_tests.c
+++ b/tests/vboot_api_kernel6_tests.c
@@ -55,8 +55,5 @@ int main(void)
VbUnlockDeviceTest();
VbLockDeviceTest();
- if (vboot_api_stub_check_memory())
- return 255;
-
return gTestSuccess ? 0 : 255;
}
diff --git a/tests/vboot_api_kernel_tests.c b/tests/vboot_api_kernel_tests.c
index 78cc6cf6..0baf4dff 100644
--- a/tests/vboot_api_kernel_tests.c
+++ b/tests/vboot_api_kernel_tests.c
@@ -323,8 +323,5 @@ int main(void)
{
VbTryLoadKernelTest();
- if (vboot_api_stub_check_memory())
- return 255;
-
return gTestSuccess ? 0 : 255;
}
diff --git a/tests/vboot_audio_tests.c b/tests/vboot_audio_tests.c
index 4cc6ab28..c392c0d9 100644
--- a/tests/vboot_audio_tests.c
+++ b/tests/vboot_audio_tests.c
@@ -216,16 +216,9 @@ static void VbAudioTest(void) {
}
-int main(int argc, char* argv[]) {
- int error_code = 0;
-
+int main(int argc, char* argv[])
+{
VbAudioTest();
- if (!gTestSuccess)
- error_code = 255;
-
- if (vboot_api_stub_check_memory())
- error_code = 255;
-
- return error_code;
+ return gTestSuccess ? 0 : 255;
}
diff --git a/tests/vboot_common_tests.c b/tests/vboot_common_tests.c
index 8e005260..8ca49a68 100644
--- a/tests/vboot_common_tests.c
+++ b/tests/vboot_common_tests.c
@@ -232,8 +232,5 @@ int main(int argc, char* argv[])
PublicKeyTest();
VbSharedDataTest();
- if (vboot_api_stub_check_memory())
- return 255;
-
return gTestSuccess ? 0 : 255;
}
diff --git a/tests/vboot_display_tests.c b/tests/vboot_display_tests.c
index 99d14f21..ff036d23 100644
--- a/tests/vboot_display_tests.c
+++ b/tests/vboot_display_tests.c
@@ -63,9 +63,9 @@ static void ResetMocks(void)
/*
* Note, VbApiKernelFree() expects this to be allocated by
- * VbExMalloc(), so we cannot just assign it staticly.
+ * malloc(), so we cannot just assign it staticly.
*/
- cparams.gbb = VbExMalloc(sizeof(*gbb));
+ cparams.gbb = malloc(sizeof(*gbb));
gbb->header_size = sizeof(*gbb);
gbb->rootkey_offset = gbb_used;
gbb->rootkey_size = 64;
@@ -264,8 +264,5 @@ int main(void)
DisplayKeyTest();
FontTest();
- if (vboot_api_stub_check_memory())
- return 255;
-
return gTestSuccess ? 0 : 255;
}
diff --git a/tests/vboot_kernel_tests.c b/tests/vboot_kernel_tests.c
index dfb66195..057e2dd3 100644
--- a/tests/vboot_kernel_tests.c
+++ b/tests/vboot_kernel_tests.c
@@ -834,8 +834,5 @@ int main(void)
InvalidParamsTest();
LoadKernelTest();
- if (vboot_api_stub_check_memory())
- return 255;
-
return gTestSuccess ? 0 : 255;
}
diff --git a/tests/vboot_nvstorage_test.c b/tests/vboot_nvstorage_test.c
index ecfe1714..687048e1 100644
--- a/tests/vboot_nvstorage_test.c
+++ b/tests/vboot_nvstorage_test.c
@@ -198,15 +198,9 @@ static void VbNvStorageTest(void) {
}
-int main(int argc, char* argv[]) {
- int error_code = 0;
-
+int main(int argc, char* argv[])
+{
VbNvStorageTest();
- if (vboot_api_stub_check_memory())
- error_code = 255;
- if (!gTestSuccess)
- error_code = 255;
-
- return error_code;
+ return gTestSuccess ? 0 : 255;
}
diff --git a/tests/vboot_region_tests.c b/tests/vboot_region_tests.c
index d087f0ad..464461c7 100644
--- a/tests/vboot_region_tests.c
+++ b/tests/vboot_region_tests.c
@@ -194,15 +194,9 @@ static void VbRegionReadTest(void) {
VBERROR_NO_DISK_FOUND, "Kernel");
}
-int main(int argc, char* argv[]) {
- int error_code = 0;
-
+int main(int argc, char* argv[])
+{
VbRegionReadTest();
- if (vboot_api_stub_check_memory())
- error_code = 255;
- if (!gTestSuccess)
- error_code = 255;
-
- return error_code;
+ return gTestSuccess ? 0 : 255;
}