diff options
author | Christopher Ferris <cferris@google.com> | 2015-11-05 12:53:10 -0800 |
---|---|---|
committer | Christopher Ferris <cferris@google.com> | 2015-11-05 12:53:10 -0800 |
commit | 8f1da8fe2db97aff22320776b46adcd2333cc5a9 (patch) | |
tree | 8dab2888ad7f9851ca2ea2e868a344bcfa1c31e2 /tests/memtest | |
parent | 8f383b86f28b62a78f27833404840132bd3707f2 (diff) | |
download | extras-8f1da8fe2db97aff22320776b46adcd2333cc5a9.tar.gz |
Allow creating 32 bit memtest on arm64.
Also do a bit of cleanup in the makefile and a few of the files.
Change-Id: I10d9442a5105f47fe361b5b4fb031989150429d3
Diffstat (limited to 'tests/memtest')
-rw-r--r-- | tests/memtest/Android.mk | 26 | ||||
-rw-r--r-- | tests/memtest/bandwidth.cpp | 1 | ||||
-rw-r--r-- | tests/memtest/fptest.cpp | 8 | ||||
-rw-r--r-- | tests/memtest/memtest.cpp | 28 | ||||
-rw-r--r-- | tests/memtest/thumb.cpp | 19 |
5 files changed, 34 insertions, 48 deletions
diff --git a/tests/memtest/Android.mk b/tests/memtest/Android.mk index 771a22ea..195c8563 100644 --- a/tests/memtest/Android.mk +++ b/tests/memtest/Android.mk @@ -1,18 +1,24 @@ # Copyright 2006 The Android Open Source Project -ifeq ($(TARGET_ARCH),arm) +ifneq ($(filter $(TARGET_ARCH),arm arm64),) + LOCAL_PATH:= $(call my-dir) + include $(CLEAR_VARS) -LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk -LOCAL_SRC_FILES:= \ - memtest.cpp.arm \ - fptest.cpp \ - thumb.cpp \ - bandwidth.cpp \ +LOCAL_SRC_FILES := \ + memtest.cpp \ + fptest.cpp \ + thumb.cpp \ + bandwidth.cpp \ + +LOCAL_MODULE := memtest +LOCAL_MODULE_TAGS := debug +LOCAL_CFLAGS += \ + -fomit-frame-pointer \ + -Wall \ + -Werror \ -LOCAL_MODULE:= memtest -LOCAL_MODULE_TAGS := optional -LOCAL_CFLAGS += -fomit-frame-pointer +LOCAL_MULTILIB := 32 include $(BUILD_EXECUTABLE) endif diff --git a/tests/memtest/bandwidth.cpp b/tests/memtest/bandwidth.cpp index 7dab4ba0..5ad74687 100644 --- a/tests/memtest/bandwidth.cpp +++ b/tests/memtest/bandwidth.cpp @@ -343,7 +343,6 @@ int multithread_bandwidth(int argc, char** argv) { thread_arg_t args[num_threads]; - int i = 0; for (int i = 0; i < num_threads; i++) { args[i].core = -1; args[i].bench = createBandwidthBenchmarkObject(values); diff --git a/tests/memtest/fptest.cpp b/tests/memtest/fptest.cpp index 564b700a..1ae04b26 100644 --- a/tests/memtest/fptest.cpp +++ b/tests/memtest/fptest.cpp @@ -63,7 +63,6 @@ static void test_mad() { startTime(); - float total = 0; // Do ~1 billion ops for (int ct=0; ct < (1000 * (1000 / 20)); ct++) { for (int i=0; i < 1000; i++) { @@ -99,7 +98,6 @@ static void test_fma() { startTime(); - float total = 0; // Do ~1 billion ops for (int ct=0; ct < (1000 * (1000 / 80)); ct++) { for (int i=0; i < 1000; i++) { @@ -123,7 +121,7 @@ static void test_fma() { } #endif -int fp_test(int argc, char** argv) { +int fp_test(int, char**) { test_mad(); #ifdef __ARM_NEON__ @@ -132,7 +130,3 @@ int fp_test(int argc, char** argv) { return 0; } - - - - diff --git a/tests/memtest/memtest.cpp b/tests/memtest/memtest.cpp index 7b097d39..534f72cd 100644 --- a/tests/memtest/memtest.cpp +++ b/tests/memtest/memtest.cpp @@ -28,8 +28,7 @@ #include "memtest.h" -nsecs_t system_time() -{ +nsecs_t system_time() { struct timespec t; t.tv_sec = t.tv_nsec = 0; clock_gettime(CLOCK_MONOTONIC, &t); @@ -93,8 +92,7 @@ function_t function_table[] = { { "multithread_bandwidth", multithread_bandwidth }, }; -int main(int argc, char** argv) -{ +int main(int argc, char** argv) { if (argc == 1) { usage(argv[0]); return 0; @@ -112,8 +110,7 @@ int main(int argc, char** argv) return err; } -int malloc_test(int argc, char** argv) -{ +int malloc_test(int argc, char** argv) { bool fill = (argc>=2 && !strcmp(argv[1], "fill")); size_t total = 0; size_t size = 0x40000000; @@ -138,8 +135,7 @@ int malloc_test(int argc, char** argv) return 0; } -int madvise_test(int argc, char** argv) -{ +int madvise_test(int, char**) { for (int i=0 ; i<2 ; i++) { size_t size = i==0 ? 4096 : 48*1024*1024; // 48 MB printf("Allocating %zd MB... ", size/(1024*1024)); fflush(stdout); @@ -182,8 +178,7 @@ int madvise_test(int argc, char** argv) return 0; } -int crash_test(int argc, char** argv) -{ +int crash_test(int, char**) { printf("about to crash...\n"); asm volatile( "mov r0, #0 \n" @@ -196,8 +191,7 @@ int crash_test(int argc, char** argv) return 0; } -int stack_smasher_test(int argc, char** argv) -{ +int stack_smasher_test(int, char**) { int dummy = 0; printf("corrupting our stack...\n"); *(volatile long long*)&dummy = 0; @@ -212,25 +206,23 @@ extern "C" void arm_function_3(int*p); extern "C" void arm_function_2(int*p); extern "C" void arm_function_1(int*p); -void arm_function_3(int*p) { +void arm_function_3(int*) { int a = 0; thumb_function_2(&a); } -void arm_function_2(int*p) { +void arm_function_2(int*) { int a = 0; thumb_function_1(&a); } -void arm_function_1(int*p) { +void arm_function_1(int*) { int a = 0; arm_function_2(&a); } -int crawl_test(int argc, char** argv) -{ +int crawl_test(int, char**) { int a = 0; arm_function_1(&a); return 0; } - diff --git a/tests/memtest/thumb.cpp b/tests/memtest/thumb.cpp index a70f4c3b..9293966f 100644 --- a/tests/memtest/thumb.cpp +++ b/tests/memtest/thumb.cpp @@ -1,27 +1,22 @@ #include <stdio.h> #include <unwind.h> -extern "C" void arm_function_3(int*p); -extern "C" void thumb_function_1(int*p); -extern "C" void thumb_function_2(int*p); +extern "C" void arm_function_3(int* p); +extern "C" void thumb_function_1(int* p); +extern "C" void thumb_function_2(int* p); -extern "C" _Unwind_Reason_Code trace_function(_Unwind_Context *context, void *arg) -{ - int i = 0; +extern "C" _Unwind_Reason_Code trace_function(_Unwind_Context* context, void *) { printf("0x%x\n", _Unwind_GetIP(context)); fflush(stdout); return _URC_NO_REASON; } -void thumb_function_1(int*p) -{ +void thumb_function_1(int*) { int a = 0; arm_function_3(&a); } -void thumb_function_2(int*p) -{ - int a = 0; +void thumb_function_2(int*) { printf("unwinding...\n"); - _Unwind_Backtrace(trace_function, (void*)"backtrace!"); + _Unwind_Backtrace(trace_function, (void*) "backtrace!"); } |