diff --git a/README b/README index 578741c..68baee6 100644 --- a/README +++ b/README @@ -1,12 +1,57 @@ +Modified from https://github.com/royzhao/memtester4Android.git to build +using `ndk-build` without any dependencies other than Android NDK. + +This is based on memtester version 4.3.0, tested on 32-bit ARM (armeabi-v7a). +Requires root to test more than 64MB of memory. + +## Prerequisites + +Install Android NDK. The easiest way to do this is: + +1. [Install Android Studio](https://developer.android.com/studio/install). + +2. Open Android Studio, and under Configure or Tools, open the SDK Manager. + +3. Under Appearance and Behavior > System Settings > Android SDK, click on + the SDK Tools tab. + +4. Note the Android SDK Location (you will need this path later, typically it + will be ~/Android/Sdk), and make sure that it doesn't contain spaces. + +5. Tick the checkbox next to NDK (Side by side) and Apply. + +6. Accept the EULAs and install the NDK (default path is ~/Android/Sdk/ndk/). + ===================================== -usage: - cd android/ - source ./build/envsetup.sh - lunch xx - cd android/external/ - git clone https://github.com/royzhao/memtester4Android.git + +Usage: + # Clone this repository. + git clone https://github.com/akovacs/memtester4Android cd memtester4Android - mm + + # Make sure there are no spaces in the path to this directory: + pwd + + # Configure environment variables + export NDK_PROJECT_PATH=`pwd` + export APP_PLATFORM=android-16 + + # Compile the binary using your version of the Android NDK's ndk-build + # Path to ndk-build within the Android SDK Location you recorded earlier + ~/Android/Sdk/ndk/23.0.7123448/ndk-build . + + # Push the appropriate binary to your device (here I'm using 32-bit ARM) + # You can also use arm64-v8a for 64-bit ARM, or x86 + adb push libs/armeabi-v7a/memtester /data/local/tmp/ + adb shell chmod 777 /data/local/tmp/memtester + + # Open an adb shell into your device + adb shell + # Run as root, otherwise you will be limited to testing only 64MB memory + su + # Acquire and test 600MB of memory, run 3 loops + /data/local/tmp/memtester 600M 3 + ===================================== memtester diff --git a/Android.mk b/jni/Android.mk similarity index 91% rename from Android.mk rename to jni/Android.mk index f1d211b..627aa73 100644 --- a/Android.mk +++ b/jni/Android.mk @@ -5,6 +5,7 @@ LOCAL_SRC_FILES:= \ LOCAL_MODULE:= memtester LOCAL_MODULE_FILENAME:=memtester LOCAL_C_INCLUDES:=$(LOCAL_PATH) +LOCAL_LDFLAGS := -static #LOCAL_C_INCLUDES := #LOCAL_STATIC_LIBRARIES := #LOCAL_SHARED_LIBRARIES := diff --git a/Makefile b/jni/Makefile similarity index 100% rename from Makefile rename to jni/Makefile diff --git a/conf-cc b/jni/conf-cc similarity index 100% rename from conf-cc rename to jni/conf-cc diff --git a/conf-ld b/jni/conf-ld similarity index 100% rename from conf-ld rename to jni/conf-ld diff --git a/extra-libs.sh b/jni/extra-libs.sh similarity index 100% rename from extra-libs.sh rename to jni/extra-libs.sh diff --git a/find-systype.sh b/jni/find-systype.sh similarity index 100% rename from find-systype.sh rename to jni/find-systype.sh diff --git a/make-compile.sh b/jni/make-compile.sh similarity index 100% rename from make-compile.sh rename to jni/make-compile.sh diff --git a/make-load.sh b/jni/make-load.sh similarity index 100% rename from make-load.sh rename to jni/make-load.sh diff --git a/make-makelib.sh b/jni/make-makelib.sh similarity index 100% rename from make-makelib.sh rename to jni/make-makelib.sh diff --git a/memtester.8 b/jni/memtester.8 similarity index 100% rename from memtester.8 rename to jni/memtester.8 diff --git a/memtester.c b/jni/memtester.c similarity index 100% rename from memtester.c rename to jni/memtester.c diff --git a/memtester.h b/jni/memtester.h similarity index 100% rename from memtester.h rename to jni/memtester.h diff --git a/sizes.h b/jni/sizes.h similarity index 100% rename from sizes.h rename to jni/sizes.h diff --git a/tests.c b/jni/tests.c similarity index 99% rename from tests.c rename to jni/tests.c index be1b350..d793846 100644 --- a/tests.c +++ b/jni/tests.c @@ -27,6 +27,9 @@ char progress[] = "-\\|/"; #define PROGRESSOFTEN 2500 #define ONE 0x00000001L +union mword8_type mword8; +union mword16_type mword16; + /* Function definitions. */ int compare_regions(ulv *bufa, ulv *bufb, size_t count) { diff --git a/tests.h b/jni/tests.h similarity index 100% rename from tests.h rename to jni/tests.h diff --git a/trycpp.c b/jni/trycpp.c similarity index 100% rename from trycpp.c rename to jni/trycpp.c diff --git a/types.h b/jni/types.h similarity index 94% rename from types.h rename to jni/types.h index ad7ce73..7ddae07 100644 --- a/types.h +++ b/jni/types.h @@ -25,12 +25,12 @@ struct test { int (*fp)(); }; -union { +union mword8_type { unsigned char bytes[UL_LEN/8]; ul val; -} mword8; +}; -union { +union mword16_type { unsigned short u16s[UL_LEN/16]; ul val; -} mword16; +}; diff --git a/warn-auto.sh b/jni/warn-auto.sh similarity index 100% rename from warn-auto.sh rename to jni/warn-auto.sh