diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2021-09-02 23:09:22 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2021-09-02 23:09:22 +0000 |
commit | e574ce5ce9af0cf79eb4cdce3e9479d0031e2625 (patch) | |
tree | ed73c93d32c03c4f876920b4512e637b2333eb54 | |
parent | f2e78c2c951797d7ae01dc474acfc14fa69226f8 (diff) | |
parent | 87ec20449450fbf8e99265eff619f3149f7247a4 (diff) | |
download | rs-android-s-beta-5.tar.gz |
Merge "Remove Python test suite for debugging a RenderScript app using lldb."android-s-beta-5android-s-beta-5
185 files changed, 0 insertions, 18869 deletions
diff --git a/tests/lldb/.gitignore b/tests/lldb/.gitignore deleted file mode 100644 index b79973f1..00000000 --- a/tests/lldb/.gitignore +++ /dev/null @@ -1,65 +0,0 @@ -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class -*.swp - -*~ - -# C extensions -*.so - -# Distribution / packaging -.Python -env/ -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -*.egg-info/ -.installed.cfg -*.egg - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*,cover - -# Translations -*.mo -*.pot - -# Django stuff: -*.log - -# Sphinx documentation -docs/_build/ - -# PyBuilder -target/ - - -results.xml -LLDBTestsuiteLog.txt diff --git a/tests/lldb/Android.mk b/tests/lldb/Android.mk deleted file mode 100644 index 95904a8b..00000000 --- a/tests/lldb/Android.mk +++ /dev/null @@ -1,4 +0,0 @@ -LOCAL_PATH:=$(call my-dir) - -include $(call all-makefiles-under,$(LOCAL_PATH)) - diff --git a/tests/lldb/README.txt b/tests/lldb/README.txt deleted file mode 100644 index 70e93bc6..00000000 --- a/tests/lldb/README.txt +++ /dev/null @@ -1,307 +0,0 @@ -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- LLDB for Renderscript Test Suite -- -- 16/03/2016 -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- - -Overview: - - The LLDB for Renderscript test suite is written in python and relies on - LLDB's python bindings. The test suite will push several test app's onto - a target device, and makes coordinated use of LLDB and ADB to run automated - debug sessions. - -Set up the test suite: - - Check out the AOSP and build it for your target. Navigate to - /frameworks/rs/test/lldb and type mm. This should successfully build the - binaries that the testsuite uses. They will be placed in - <path to out folder>/target/product/<product code name>/data/app, system/lib - and system/bin. - -Prerequisite: - - An lldb-server executable must be present on your device/emulator. - LLDB must be compiled on your host machine along with its python interface. - lldb-server and lldb should be built from the same source revisions. - -Running the test suite: - - The test suite can be run via the following command: - - > python run_tests.py [-h] - [--config path] - [--device DEVICE] - [--test path] - [--install-only] - [--no-install] - [--no-uninstall] - [--print-to-stdout] - [--verbose] - [--wimpy] - [--run-emu] - [--adb-path ADB_PATH] - [--aosp-product-path AOSP_PRODUCT_PATH] - [--blocklist BLOCKLIST [BLOCKLIST ...]] - [--device-port DEVICE_PORT] - [--emu-cmd EMU_CMD] - [--host-port HOST_PORT] - [--lldb-path LLDB_PATH] - [--lldb-server-path-device LLDB_SERVER_PATH_DEVICE] - [--lldb-server-path-host LLDB_SERVER_PATH_HOST] - [--log-file-path LOG_FILE_PATH] - [--results-file-path RESULTS_FILE_PATH] - [--timeout TIMEOUT] - - optional arguments: - -h, --help show this help message and exit - --config path, -c path - Path to a custom config file. - --device DEVICE, -d DEVICE - Specify the device id of the device to test on. - --test path, -t path Specify a specific test to run. - --install-only It only runs the pre-run stage of the test suite. It - installs the required APKs but does not execute the - tests. - --no-install, -n Stop the test suite installing apks to device. - --no-uninstall Stop the test suite uninstalling apks after - completion. - --print-to-stdout Print all logging information to standard out. - --verbose, -v Store extra info in the log. - --wimpy, -w Test only a core subset of features. - --run-emu Spawn an emulator and run the test suite on that. - Specify the emulator command line in the config file - or with -emu-cmd. - --adb-path ADB_PATH Path to android debug bridge on the host. - --aosp-product-path AOSP_PRODUCT_PATH - The path to the "out" folder of the AOSP repository. - --blocklist BLOCKLIST [BLOCKLIST ...] - Provide a test blocklist for skipping specific tests. - To specify the blocklist from the command line the - following can be used: --blocklist test1.py test2.py - ... - --device-port DEVICE_PORT - Specify the port number that lldb-server (on the - device) listens on. When lldb-server is spawned on the - device it will listen on this port. Each successive - test will increment onwards from this port. - --emu-cmd EMU_CMD The command line for the emulator (if using -run-emu). - --host-port HOST_PORT - Specify host port which lldb-server will be forwarded - to. Specify the starting host port number that lldb- - server (on the target) will be forwarded to on the - host. Each successive test will increment onwards from - this initial port. - --lldb-path LLDB_PATH - The path to lldb executable on the host. - --lldb-server-path-device LLDB_SERVER_PATH_DEVICE - Path to the lldb-server executable on the device. - --lldb-server-path-host LLDB_SERVER_PATH_HOST - Path to the lldb-server executable on host (if using - -run-emu). - --log-file-path LOG_FILE_PATH - The path to the file where the log will be written. - --results-file-path RESULTS_FILE_PATH - The path to the file where junit results.xml will be - written. - --timeout TIMEOUT Timeout period for a single command, expressed in - seconds - - An optional config file can be passed to the test suite which will provide - details of your specific environment. The user file should define a custom - class inheriting from Config in config.py. The class Config presents the - default set of options, available to be overridden. - - All options in the config file can also be specified on the command line. - - If your config and command line do not specify a path to the host lldb, - the PYTHONPATH environment variable must be set. The appropriate value to - set this to can be obtained by running the following command: - - > lldb -P - - This will print out a path to the lldb python bindings on your local machine. - -Build Requirements: - - - The following revisions are from the llvm git mirror: - - llvm : 5786b73 - clang: b6d0b32 - lldb : 98712eb - - lldb has the following dependencies: - - Python2.7.6 - swig2.0 - lldb-server - -Building LLDB python bindings: - - Linux: - - Build instructions for Linux lldb can be found on the official lldb web - page: - - http://lldb.llvm.org/build.html - - The following CMake variables should be enabled when generating: - - LLDB_ENABLE_PYTHON_SCRIPTS_SWIG_API_GENERATION = True - - As a post build step, swig will generate the python bindings for lldb. - - Windows: - - Prerequisites: - - Visual Studio 2015 - Custom x64 Python2.7.10 package: - http://p-nand-q.com/python/2015.08.07-Python2710-x64-vs2015.7z - Swig Version 3.0.5 (Added to the $PATH) - Cmake 3.4.0 (So we can generate Visual Studio 2015 solutions) - - Build Python for Windows: - - http://p-nand-q.com/python/building-python-27-with-vs2010.html - - The important thing here is that the above python distribution - contains debug versions of the libraries and is built with the same - Visual Studio version we are using so the runtimes do not conflict. - - Build LLDB on Windows: - - Select the Cmake generator "Microsoft Visual Studio 2015 Win64". - The following CMake variables should be enabled when generating: - - LLDB_DISABLE_PYTHON=False - LLDB_RELOCATABLE_PYTHON=False - PYTHON_HOME=<path to the above python release> - - Using cmake-gui is a good idea and lets you make sure that swig has - been correctly detected. - - In the CMake configure step, you should see something similar to the - following: - -- Found Python version 2.7.9 - -- LLDB Found PythonExecutable: E:/Python27/python.exe and - E:/Python27/python_d.exe - -- LLDB Found PythonLibs: E:/Python27/libs/python27.lib and - E:/Python27/libs/python27_d.lib - -- LLDB Found PythonDLL: E:/Python27/python27.dll and - E:/Python27/python27_d.dll - -- LLDB Found PythonIncludeDirs: E:/Python27/Include - LLDB version: 3.8.0 - Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) - Found PythonInterp: - $<$<CONFIG:Debug>:E:/Python27/python_d.exe>$<$<NOT:$<CONFIG:Debug>>:E:/Python27/python.exe> - (found version "1.4") - - Build LLDB as a RelWithDebInfo build, because debug builds of lldb - produce an lldb_d.pyd file, but the __init__.py still refers to - lldb.pyd. - - The LLDB python bindings should have built in - "llvm_build\RelWithDebInfo\lib\site-packages\lldb". Point the test - suite towards "llvm_build\RelWithDebInfo\bin\lldb.exe". - When running the test suite itself, make sure to use the python - executable from the custom package. - -A typical test transcript: - - Located ADB - Located device ZX1G427S2S - Pushing all tests... - Pushed all tests - Pre run complete - Found 86 tests - Running test_allocation_dump_2_cpp.py: PASS - Running test_breakpoint_fileline_multiple_rs_files_cpp.py: PASS - Running test_read_local_cpp.py: PASS - Running test_breakpoint_kernel_multiple_rs_files_cpp.py: PASS - Running test_multiple_rs_files_cpp.py: PASS - Running test_breakpoint_kernel_all_multiple_rs_files_cpp.py: PASS - Running test_dwarf_lang_cpp.py: PASS - Running test_write_global_element_cpp.py: PASS - Running test_allocation_list_cpp.py: PASS - Running test_breakpoint_coordinate_cpp.py: PASS - Running test_rs_consts_cpp.py: PASS - Running test_allocation_file_cpp.py: PASS - Running test_allocation_dump_1_cpp.py: PASS - Running test_source_step_cpp.py: PASS - Running test_breakpoint_kernel_2_cpp.py: PASS - Running test_backtrace_cpp.py: PASS - Running test_language_subcmds_no_debug_cpp.py: PASS - Running test_breakpoint_kernel_1_cpp.py: PASS - Running test_language_subcmds_cpp.py: PASS - Running test_write_global_cpp.py: PASS - Running test_invoke_fun_cpp.py: PASS - Running test_breakpoint_fileline_cpp.py: PASS - Running test_write_local_cpp.py: PASS - Running test_breakpoint_kernel_all_cpp.py: PASS - Running test_write_local_element_cpp.py: PASS - Running test_call_api_funs_cpp.py: PASS - Running test_coordinates_cpp.py: PASS - Running test_read_global_cpp.py: PASS - Running test_language_subcmds.py: PASS - Running test_coordinates.py: PASS - Running test_language_subcmds_no_debug.py: PASS - Running test_read_local.py: PASS - Running test_call_api_funs.py: PASS - Running test_breakpoint_kernel_1.py: PASS - Running test_breakpoint_fileline.py: PASS - Running test_breakpoint_fileline_multiple_rs_files.py: PASS - Running test_rs_consts.py: PASS - Running test_invoke_fun.py: PASS - Running test_write_local_element.py: PASS - Running test_source_step.py: PASS - Running test_allocation_file.py: PASS - Running test_allocation_list.py: PASS - Running test_breakpoint_kernel_multiple_rs_files.py: PASS - Running test_allocation_dump_1.py: PASS - Running test_breakpoint_kernel_all.py: PASS - Running test_allocation_dump_2.py: PASS - Running test_allocation_dump_struct.py: PASS - Running test_read_global.py: PASS - Running test_language.py: PASS - Running test_dwarf_lang.py: PASS - Running test_breakpoint_coordinate.py: PASS - Running test_write_global.py: PASS - Running test_multiple_rs_files.py: PASS - Running test_write_global_element.py: PASS - Running test_breakpoint_kernel_all_multiple_rs_files.py: PASS - Running test_breakpoint_kernel_2.py: PASS - Running test_write_local.py: PASS - Running test_backtrace.py: PASS - Running test_call_api_funs_jni.py: PASS - Running test_invoke_fun_jni.py: PASS - Running test_allocation_dump_1_jni.py: PASS - Running test_breakpoint_fileline_multiple_rs_files_jni.py: PASS - Running test_allocation_file_jni.py: PASS - Running test_breakpoint_fileline_jni.py: PASS - Running test_source_step_jni.py: PASS - Running test_coordinates_jni.py: PASS - Running test_rs_consts_jni.py: PASS - Running test_breakpoint_kernel_all_multiple_rs_files_jni.py: PASS - Running test_multiple_rs_files_jni.py: PASS - Running test_allocation_dump_2_jni.py: PASS - Running test_allocation_list_jni.py: PASS - Running test_write_local_element_jni.py: PASS - Running test_breakpoint_kernel_all_jni.py: PASS - Running test_breakpoint_coordinate_jni.py: PASS - Running test_language_subcmds_no_debug_jni.py: PASS - Running test_read_local_jni.py: PASS - Running test_dwarf_lang_jni.py: PASS - Running test_breakpoint_kernel_2_jni.py: PASS - Running test_breakpoint_kernel_multiple_rs_files_jni.py: PASS - Running test_write_global_element_jni.py: PASS - Running test_breakpoint_kernel_1_jni.py: PASS - Running test_read_global_jni.py: PASS - Running test_language_subcmds_jni.py: PASS - Running test_write_global_jni.py: PASS - Running test_backtrace_jni.py: PASS - Running test_write_local_jni.py: PASS - Uninstalled/Deleted all tests - 86 of 86 passed - 100% rate diff --git a/tests/lldb/config.py b/tests/lldb/config.py deleted file mode 100644 index bc478d03..00000000 --- a/tests/lldb/config.py +++ /dev/null @@ -1,116 +0,0 @@ -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -'''LLDB-Renderscript test suite configuration file. - -This file contains the default test suite config which will be used in the -case a developer did not supply a custom one.''' - -import os -from tests.harness.decorators import deprecated - - -class Config(object): - '''Test suite configuration object. - - The Config class is used by the test suite to abstract the specifics of a - user's local setup. This config can be overridden by specifying a custom - config on the command line.''' - # pylint: disable=no-self-use - - @property - def adb_path(self): - '''Path to android debug bridge on the host.''' - return 'adb' - - @property - def host_port(self): - '''Specify host port which lldb-server will be forwarded to. - - Specify the starting host port number that lldb-server (on the target) - will be forwarded to on the host. Each successive test will increment - onwards from this initial port.''' - return 1234 - - @property - def device_port(self): - '''Specify the port number that lldb-server (on the device) listens on. - - When lldb-server is spawned on the device it will listen on this port. - Each successive test will increment onwards from this port.''' - return 1234 - - @property - def lldb_server_path_device(self): - '''Path to the lldb-server executable on the device.''' - return '/data/lldb-server' - - @property - def lldb_server_path_host(self): - '''Path to the lldb-server executable on host (if using -run-emu).''' - return 'lldb-server' - - @property - def aosp_product_path(self): - '''The path to the "out" folder of the AOSP repository.''' - return os.getenv('ANDROID_PRODUCT_OUT') - - @property - def log_file_path(self): - '''The path to the file where the log will be written.''' - return os.path.join(os.getcwd(), 'LLDBTestsuiteLog.txt') - - @property - def results_file_path(self): - '''The path to the file where junit results.xml will be written.''' - return os.path.join(os.getcwd(), 'results.xml') - - @property - def lldb_path(self): - '''The path to lldb executable on the host.''' - return 'lldb' - - @property - def blocklist(self): - '''Provide a test blocklist for skipping specific tests. - - To specify the blocklist from the command line the following can be - used: --blocklist test1.py test2.py ...''' - return [] - - @property - def verbose(self): - '''Flag to indicate whether to store extra output in the logs.''' - return False - - @property - def device(self): - '''Specify the device id of the device to run on. - - When multiple devices or emulators are present, a specific device to - use while testing can be indicated here.''' - return os.environ.get('ANDROID_SERIAL') - - @property - def timeout(self): - '''Timeout period for a single command, expressed in seconds''' - return 60 * 15 - - @property - @deprecated() - def emu_cmd(self): - '''The command line for the emulator (if using -run-emu).''' - return os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', - 'prebuilts', 'android-emulator', 'linux-x86_64', - 'emulator') diff --git a/tests/lldb/cpp/Allocations/Allocations.cpp b/tests/lldb/cpp/Allocations/Allocations.cpp deleted file mode 100644 index 4ad546d6..00000000 --- a/tests/lldb/cpp/Allocations/Allocations.cpp +++ /dev/null @@ -1,416 +0,0 @@ -/* -* Copyright (C) 2016 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include <RenderScript.h> - -#include "ScriptC_allocs.h" - -sp<RS> mRS; -sp<Allocation> mBoolAllocation; // boolean - -sp<Allocation> mCharAllocation; // char -sp<Allocation> mChar2Allocation; // char2 -sp<Allocation> mChar3Allocation; // char3 -sp<Allocation> mChar4Allocation; // char4 - -sp<Allocation> mUCharAllocation; // uchar -sp<Allocation> mUChar2Allocation; // uchar2 -sp<Allocation> mUChar3Allocation; // uchar3 -sp<Allocation> mUChar4Allocation; // uchar4 - -sp<Allocation> mShortAllocation; // short -sp<Allocation> mShort2Allocation; // short2 -sp<Allocation> mShort3Allocation; // short3 -sp<Allocation> mShort4Allocation; // short4 - -sp<Allocation> mUShortAllocation; // ushort -sp<Allocation> mUShort2Allocation; // ushort2 -sp<Allocation> mUShort3Allocation; // ushort3 -sp<Allocation> mUShort4Allocation; // ushort4 - -sp<Allocation> mIntAllocation; // int -sp<Allocation> mInt2Allocation; // int2 -sp<Allocation> mInt3Allocation; // int3 -sp<Allocation> mInt4Allocation; // int4 - -sp<Allocation> mUIntAllocation; // uint -sp<Allocation> mUInt2Allocation; // uint2 -sp<Allocation> mUInt3Allocation; // uint3 -sp<Allocation> mUInt4Allocation; // uint4 - -sp<Allocation> mLongAllocation; // long -sp<Allocation> mLong2Allocation; // long2 -sp<Allocation> mLong3Allocation; // long3 -sp<Allocation> mLong4Allocation; // long4 - -sp<Allocation> mULongAllocation; // ulong -sp<Allocation> mULong2Allocation; // ulong2 -sp<Allocation> mULong3Allocation; // ulong3 -sp<Allocation> mULong4Allocation; // ulong4 - -sp<Allocation> mHalfAllocation; // half -sp<Allocation> mHalf2Allocation; // half2 -sp<Allocation> mHalf3Allocation; // half3 -sp<Allocation> mHalf4Allocation; // half4 - -sp<Allocation> mFloatAllocation; // float -sp<Allocation> mFloat2Allocation; // float2 -sp<Allocation> mFloat3Allocation; // float3 -sp<Allocation> mFloat4Allocation; // float4 - -sp<Allocation> mDoubleAllocation; // double -sp<Allocation> mDouble2Allocation; // double2 -sp<Allocation> mDouble3Allocation; // double3 -sp<Allocation> mDouble4Allocation; // double4 - -const int mAllocSize = 24; // Needs to be < CHAR_MAX and divisible by 4. -const int mBitmapSize = 64; - -void createSignedAllocations() { - Type::Builder typeI8Builder(mRS, Element::I8(mRS)); - typeI8Builder.setX(1); // One element here to test 16 byte memory alignment - typeI8Builder.setY(3); - typeI8Builder.setZ(8); - - mCharAllocation = Allocation::createTyped(mRS, typeI8Builder.create()); - mChar2Allocation = Allocation::createSized(mRS, Element::I8_2(mRS), mAllocSize / 2); - mChar3Allocation = Allocation::createSized(mRS, Element::I8_3(mRS), mAllocSize / 4); - mChar4Allocation = Allocation::createSized(mRS, Element::I8_4(mRS), mAllocSize / 4); - - Type::Builder typeI16_2Builder(mRS, Element::I16_2(mRS)); - typeI16_2Builder.setX(6); - typeI16_2Builder.setY(1); - typeI16_2Builder.setZ(2); - - mShortAllocation = Allocation::createSized(mRS, Element::I16(mRS), mAllocSize); - mShort2Allocation = Allocation::createTyped(mRS, typeI16_2Builder.create()); - mShort3Allocation = Allocation::createSized(mRS, Element::I16_3(mRS), mAllocSize / 4); - mShort4Allocation = Allocation::createSized(mRS, Element::I16_4(mRS), mAllocSize / 4); - - Type::Builder typeI32_3Builder(mRS, Element::I32_3(mRS)); - typeI32_3Builder.setX(3); - typeI32_3Builder.setY(2); - - mIntAllocation = Allocation::createSized(mRS, Element::I32(mRS), mAllocSize); - mInt2Allocation = Allocation::createSized(mRS, Element::I32_2(mRS), mAllocSize / 2); - mInt3Allocation = Allocation::createTyped(mRS, typeI32_3Builder.create()); - mInt4Allocation = Allocation::createSized(mRS, Element::I32_4(mRS), mAllocSize / 4); - - Type::Builder typeI64_4Builder(mRS, Element::I64_4(mRS)); - typeI64_4Builder.setX(1); - typeI64_4Builder.setY(6); - - mLongAllocation = Allocation::createSized(mRS, Element::I64(mRS), mAllocSize); - mLong2Allocation = Allocation::createSized(mRS, Element::I64_2(mRS), mAllocSize / 2); - mLong3Allocation = Allocation::createSized(mRS, Element::I64_3(mRS), mAllocSize / 4); - mLong4Allocation = Allocation::createTyped(mRS, typeI64_4Builder.create()); - - mBoolAllocation = Allocation::createSized(mRS, Element::BOOLEAN(mRS), mAllocSize); -} - -void initSignedAllocations() { - char *buffer_char = new char[mAllocSize]; - short *buffer_short = new short[mAllocSize]; - int *buffer_int = new int[mAllocSize]; - int64_t *buffer_long = new int64_t[mAllocSize]; - char *buffer_bool = new char[mAllocSize]; - - for(int i = 0; i < mAllocSize; ++i) { - buffer_char[i] = (char) i; - buffer_short[i] = (short) i; - buffer_int[i] = (int) i; - buffer_long[i] = (int64_t) i; - buffer_bool[i] = (char) (0x01 & i); - } - - mCharAllocation->copy3DRangeFrom(0, 0, 0, 1, 3, 8, buffer_char); - mChar2Allocation->copy1DRangeFrom(0, mAllocSize/2, buffer_char); - mChar3Allocation->copy1DRangeFrom(0, mAllocSize/4, buffer_char); - mChar4Allocation->copy1DRangeFrom(0, mAllocSize/4, buffer_char); - - delete [] buffer_char; - - mShortAllocation->copy1DRangeFrom(0, mAllocSize, buffer_short); - mShort2Allocation->copy3DRangeFrom(0, 0, 0, 6, 1, 2, buffer_short); - mShort3Allocation->copy1DRangeFrom(0, mAllocSize/4, buffer_short); - mShort4Allocation->copy1DRangeFrom(0, mAllocSize/4, buffer_short); - - delete [] buffer_short; - - mIntAllocation->copy1DRangeFrom(0, mAllocSize, buffer_int); - mInt2Allocation->copy1DRangeFrom(0, mAllocSize/2, buffer_int); - mInt3Allocation->copy2DRangeFrom(0, 0, 3, 2, buffer_int); - mInt4Allocation->copy1DRangeFrom(0, mAllocSize/4, buffer_int); - - delete [] buffer_int; - - mLongAllocation->copy1DRangeFrom(0, mAllocSize, buffer_long); - mLong2Allocation->copy1DRangeFrom(0, mAllocSize/2, buffer_long); - mLong3Allocation->copy1DRangeFrom(0, mAllocSize/4, buffer_long); - mLong4Allocation->copy2DRangeFrom(0, 0, 1, 6, buffer_long); - - delete [] buffer_long; - - mBoolAllocation->copy1DRangeFrom(0, mAllocSize, buffer_bool); - - delete [] buffer_bool; -} - -void createUnsignedAllocations() { - Type::Builder typeU8_2Builder(mRS, Element::U8_2(mRS)); - typeU8_2Builder.setX(2); - typeU8_2Builder.setY(6); - - mUCharAllocation = Allocation::createSized(mRS, Element::U8(mRS), mAllocSize); - mUChar2Allocation = Allocation::createTyped(mRS, typeU8_2Builder.create()); - mUChar3Allocation = Allocation::createSized(mRS, Element::U8_3(mRS), mAllocSize / 4); - mUChar4Allocation = Allocation::createSized(mRS, Element::U8_4(mRS), mAllocSize / 4); - - Type::Builder typeU16_3Builder(mRS, Element::U16_3(mRS)); - typeU16_3Builder.setX(1); - typeU16_3Builder.setY(6); - - mUShortAllocation = Allocation::createSized(mRS, Element::U16(mRS), mAllocSize); - mUShort2Allocation = Allocation::createSized(mRS, Element::U16_2(mRS), mAllocSize / 2); - mUShort3Allocation = Allocation::createTyped(mRS, typeU16_3Builder.create()); - mUShort4Allocation = Allocation::createSized(mRS, Element::U16_4(mRS), mAllocSize / 4); - - Type::Builder typeU32_4Builder(mRS, Element::U32_4(mRS)); - typeU32_4Builder.setX(1); - typeU32_4Builder.setY(1); - typeU32_4Builder.setZ(6); - - mUIntAllocation = Allocation::createSized(mRS, Element::U32(mRS), mAllocSize); - mUInt2Allocation = Allocation::createSized(mRS, Element::U32_2(mRS), mAllocSize / 2); - mUInt3Allocation = Allocation::createSized(mRS, Element::U32_3(mRS), mAllocSize / 4); - mUInt4Allocation = Allocation::createTyped(mRS, typeU32_4Builder.create()); - - Type::Builder typeU64Builder(mRS, Element::U64(mRS)); - typeU64Builder.setX(4); - typeU64Builder.setY(3); - typeU64Builder.setZ(2); - - mULongAllocation = Allocation::createTyped(mRS, typeU64Builder.create()); - mULong2Allocation = Allocation::createSized(mRS, Element::U64_2(mRS), mAllocSize / 2); - mULong3Allocation = Allocation::createSized(mRS, Element::U64_3(mRS), mAllocSize / 4); - mULong4Allocation = Allocation::createSized(mRS, Element::U64_4(mRS), mAllocSize / 4); -} - -void initUnsignedAllocations() { - char *buffer_char = new char[mAllocSize]; - short *buffer_short = new short[mAllocSize]; - int *buffer_int = new int[mAllocSize]; - uint64_t *buffer_long = new uint64_t[mAllocSize]; - - for(int i = 0; i < mAllocSize; ++i) { - buffer_char[i] = (char) i; - buffer_short[i] = (short) i; - buffer_int[i] = (int) i; - buffer_long[i] = (uint64_t) i; - } - - mUCharAllocation->copy1DRangeFrom(0, mAllocSize, buffer_char); - mUChar2Allocation->copy2DRangeFrom(0, 0, 2, 6, buffer_char); - mUChar3Allocation->copy1DRangeFrom(0, mAllocSize/4, buffer_char); - mUChar4Allocation->copy1DRangeFrom(0, mAllocSize/4, buffer_char); - - delete [] buffer_char; - - mUShortAllocation->copy1DRangeFrom(0, mAllocSize, buffer_short); - mUShort2Allocation->copy1DRangeFrom(0, mAllocSize/2, buffer_short); - mUShort3Allocation->copy2DRangeFrom(0, 0, 1, 6, buffer_short); - mUShort4Allocation->copy1DRangeFrom(0, mAllocSize/4, buffer_short); - - delete [] buffer_short; - - mUIntAllocation->copy1DRangeFrom(0, mAllocSize, buffer_int); - mUInt2Allocation->copy1DRangeFrom(0, mAllocSize/2, buffer_int); - mUInt3Allocation->copy1DRangeFrom(0, mAllocSize/4, buffer_int); - mUInt4Allocation->copy3DRangeFrom(0, 0, 0, 1, 1, 6, buffer_int); - - delete [] buffer_int; - - mULongAllocation->copy3DRangeFrom(0, 0, 0, 4, 3, 2, buffer_long); - mULong2Allocation->copy1DRangeFrom(0, mAllocSize/2, buffer_long); - mULong3Allocation->copy1DRangeFrom(0, mAllocSize/4, buffer_long); - mULong4Allocation->copy1DRangeFrom(0, mAllocSize/4, buffer_long); - - delete [] buffer_long; -} - -void createFloatAllocations() { - Type::Builder typeF16_3Builder(mRS, Element::F16_3(mRS)); - typeF16_3Builder.setX(1); - typeF16_3Builder.setY(6); - - mHalfAllocation = Allocation::createSized(mRS, Element::F16(mRS), mAllocSize); - mHalf2Allocation = Allocation::createSized(mRS, Element::F16_2(mRS), mAllocSize / 2); - mHalf3Allocation = Allocation::createTyped(mRS, typeF16_3Builder.create()); - mHalf4Allocation = Allocation::createSized(mRS, Element::F16_4(mRS), mAllocSize / 4); - - Type::Builder typeF32_4Builder(mRS, Element::F32_4(mRS)); - typeF32_4Builder.setX(3); - typeF32_4Builder.setY(2); - - mFloatAllocation = Allocation::createSized(mRS, Element::F32(mRS), mAllocSize); - mFloat2Allocation = Allocation::createSized(mRS, Element::F32_2(mRS), mAllocSize / 2); - mFloat3Allocation = Allocation::createSized(mRS, Element::F32_3(mRS), mAllocSize / 4); - mFloat4Allocation = Allocation::createTyped(mRS, typeF32_4Builder.create()); - - Type::Builder typeF64_2Builder(mRS, Element::F64_2(mRS)); - typeF64_2Builder.setX(4); - typeF64_2Builder.setY(1); - typeF64_2Builder.setZ(3); - - mDoubleAllocation = Allocation::createSized(mRS, Element::F64(mRS), mAllocSize); - mDouble2Allocation = Allocation::createTyped(mRS, typeF64_2Builder.create()); - - Type::Builder typeF64_3Builder(mRS, Element::F64_3(mRS)); - typeF64_3Builder.setX(1); - typeF64_3Builder.setY(2); - typeF64_3Builder.setZ(3); - - Type::Builder typeF64_4Builder(mRS, Element::F64_4(mRS)); - typeF64_4Builder.setX(1); - typeF64_4Builder.setY(2); - typeF64_4Builder.setZ(3); - - mDouble3Allocation = Allocation::createTyped(mRS, typeF64_3Builder.create()); - mDouble4Allocation = Allocation::createTyped(mRS, typeF64_4Builder.create()); -} - -void initFloatAllocations() { - __fp16 *buffer_half = new __fp16[mAllocSize]; - float *buffer_float = new float[mAllocSize]; - double *buffer_double = new double[mAllocSize]; - - for(int i = 0; i < mAllocSize; ++i) { - buffer_half[i] = (__fp16) 1 / i; - buffer_float[i] = (float) 1 / i; - buffer_double[i] = (double) 1 / i; - } - - mHalfAllocation->copy1DRangeFrom(0, mAllocSize, buffer_half); - mHalf2Allocation->copy1DRangeFrom(0, mAllocSize/2, buffer_half); - mHalf3Allocation->copy2DRangeFrom(0, 0, 1, 6, buffer_half); - mHalf4Allocation->copy1DRangeFrom(0, mAllocSize/4, buffer_half); - - delete [] buffer_half; - - mFloatAllocation->copy1DRangeFrom(0, mAllocSize, buffer_float); - mFloat2Allocation->copy1DRangeFrom(0, mAllocSize/2, buffer_float); - mFloat3Allocation->copy1DRangeFrom(0, mAllocSize/4, buffer_float); - mFloat4Allocation->copy2DRangeFrom(0, 0, 3, 2, buffer_float); - - delete [] buffer_float; - - mDoubleAllocation->copy1DRangeFrom(0, mAllocSize, buffer_double); - mDouble2Allocation->copy3DRangeFrom(0, 0, 0, 4, 1, 3, buffer_double); - mDouble3Allocation->copy3DRangeFrom(0, 0, 0, 1, 2, 3, buffer_double); - mDouble4Allocation->copy3DRangeFrom(0, 0, 0, 1, 2, 3, buffer_double); - - delete [] buffer_double; -} - -int main() -{ - mRS = new RS(); - - mRS->init("/data/rscache", RS_INIT_LOW_LATENCY | RS_INIT_WAIT_FOR_ATTACH); - - sp<ScriptC_allocs> mScript = new ScriptC_allocs(mRS); - - Type::Builder typeRGBA_888Builder(mRS, Element::RGBA_8888(mRS)); - typeRGBA_888Builder.setX(mBitmapSize); - typeRGBA_888Builder.setY(mBitmapSize); - - sp<Allocation> mInAllocation = Allocation::createTyped(mRS, typeRGBA_888Builder.create()); - - const int image_area = mBitmapSize*mBitmapSize; - const int image_size = image_area*sizeof(int); - - char *zero_buffer = new char[image_size]; - memset(zero_buffer, 0, image_size); - mInAllocation->copy1DRangeFrom(0, image_area, zero_buffer); - delete [] zero_buffer; - - sp<Allocation> mOutAllocation = Allocation::createTyped(mRS, typeRGBA_888Builder.create()); - createSignedAllocations(); - initSignedAllocations(); - - mRS->finish(); - mScript->forEach_swizzle_kernel(mInAllocation, mOutAllocation); - mRS->finish(); - - mCharAllocation.clear(); - mChar2Allocation.clear(); - mChar3Allocation.clear(); - mChar4Allocation.clear(); - - mShort2Allocation.clear(); - mShort3Allocation.clear(); - mShort4Allocation.clear(); - - mIntAllocation.clear(); - mInt2Allocation.clear(); - mInt3Allocation.clear(); - mInt4Allocation.clear(); - - mLongAllocation.clear(); - mLong2Allocation.clear(); - mLong3Allocation.clear(); - mLong4Allocation.clear(); - - mBoolAllocation.clear(); - - createUnsignedAllocations(); - initUnsignedAllocations(); - - mInAllocation = mUShortAllocation; // Host side assignment - - mRS->finish(); - mScript->forEach_square_kernel(mInAllocation, mUIntAllocation); - mRS->finish(); - - mUCharAllocation.clear(); - mUChar2Allocation.clear(); - mUChar3Allocation.clear(); - mUChar4Allocation.clear(); - - mUShortAllocation.clear(); - mUShort2Allocation.clear(); - mUShort3Allocation.clear(); - mUShort4Allocation.clear(); - - mUInt2Allocation.clear(); - mUInt3Allocation.clear(); - mUInt4Allocation.clear(); - - mULongAllocation.clear(); - mULong2Allocation.clear(); - mULong3Allocation.clear(); - mULong4Allocation.clear(); - - createFloatAllocations(); - initFloatAllocations(); - - mRS->finish(); - mScript->forEach_add_half_kernel(mDouble4Allocation, mDouble3Allocation); - mRS->finish(); - - return 0; -} - diff --git a/tests/lldb/cpp/Allocations/Android.mk b/tests/lldb/cpp/Allocations/Android.mk deleted file mode 100644 index 9f72923b..00000000 --- a/tests/lldb/cpp/Allocations/Android.mk +++ /dev/null @@ -1,15 +0,0 @@ -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE := CppAllocations -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice - -LOCAL_SRC_FILES := \ - Allocations.cpp \ - allocs.rscript - -LOCAL_STATIC_LIBRARIES := libcompiler_rt - -include frameworks/rs/tests/lldb/cpp/common.mk -include $(BUILD_EXECUTABLE) diff --git a/tests/lldb/cpp/Allocations/allocs.rscript b/tests/lldb/cpp/Allocations/allocs.rscript deleted file mode 100644 index eff79777..00000000 --- a/tests/lldb/cpp/Allocations/allocs.rscript +++ /dev/null @@ -1,47 +0,0 @@ -/* -* Copyright (C) 2016 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#pragma version(1) -#pragma rs java_package_name(com.android.rs.cppallocations) - -// Kernel performs basic vector swizzle -uchar4 __attribute__((kernel)) swizzle_kernel(uchar4 in) -{ - return in.wzyx; -} - -// Kernel squares every element in allocation -uint __attribute__((kernel)) square_kernel(ushort in) -{ - uint result = (uint)in * (uint)in; - return result; -} - -// Helper function adding 1/2 to passed in double -static double half_helper(double in) -{ - return (in + 0.5); -} - -// Kernel returns first 3 elements of a double4 plus 1/2 -double3 __attribute__((kernel)) add_half_kernel(double4 in) -{ - double3 result; - result.x = half_helper(in.x); - result.y = half_helper(in.y); - result.z = half_helper(in.z); - return result; -} diff --git a/tests/lldb/cpp/Android.mk b/tests/lldb/cpp/Android.mk deleted file mode 100644 index 83384322..00000000 --- a/tests/lldb/cpp/Android.mk +++ /dev/null @@ -1,2 +0,0 @@ -include $(call all-subdir-makefiles) - diff --git a/tests/lldb/cpp/BranchingFunCalls/Android.mk b/tests/lldb/cpp/BranchingFunCalls/Android.mk deleted file mode 100644 index c06e6af3..00000000 --- a/tests/lldb/cpp/BranchingFunCalls/Android.mk +++ /dev/null @@ -1,13 +0,0 @@ -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE := CppBranchingFunCalls -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice - -LOCAL_SRC_FILES := \ - BranchingFunCalls.cpp \ - scalars.rscript - -include frameworks/rs/tests/lldb/cpp/common.mk -include $(BUILD_EXECUTABLE) diff --git a/tests/lldb/cpp/BranchingFunCalls/BranchingFunCalls.cpp b/tests/lldb/cpp/BranchingFunCalls/BranchingFunCalls.cpp deleted file mode 100644 index f0eee09c..00000000 --- a/tests/lldb/cpp/BranchingFunCalls/BranchingFunCalls.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* -* Copyright (C) 2016 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include <RenderScript.h> - -#include "ScriptC_scalars.h" - -int main() -{ - static const int size = 64; - sp<RS> rs = new RS(); - - rs->init("/data/rscache", RS_INIT_LOW_LATENCY | RS_INIT_WAIT_FOR_ATTACH); - - auto e = Element::I32(rs); - Type::Builder tb(rs, e); - tb.setX(size); - tb.setY(size); - auto t = tb.create(); - - auto a = Allocation::createTyped(rs, t); - auto b = Allocation::createTyped(rs, t); - - int * input = new int[size*size]; - for(int i = 0; i < size*size; ++i) { - input[i] = i - (size*size / 2); - } - a->copy2DRangeFrom(0, 0, size, size, input); - delete [] input; - - // Script is executed once, then the data is copied back when finished - sp<ScriptC_scalars> s = new ScriptC_scalars(rs); - s->invoke_addToGlobal(234); - s->forEach_simple_kernel(a, b); - rs->finish(); - int32_t * output = new int32_t[size*size]; - b->copy2DRangeTo(0, 0, size, size, output); - delete [] output; - - return 0; -} - diff --git a/tests/lldb/cpp/BranchingFunCalls/scalars.rscript b/tests/lldb/cpp/BranchingFunCalls/scalars.rscript deleted file mode 100644 index 279694d7..00000000 --- a/tests/lldb/cpp/BranchingFunCalls/scalars.rscript +++ /dev/null @@ -1,76 +0,0 @@ -/* -* Copyright (C) 2016 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#pragma version(1) -#pragma rs java_package_name(com.android.rs.cppbranchingfuncalls) - -static bool is_neg(int a) -{ - if(a < 0) - return true; - else - return false; -} - -static bool is_pos(int a) -{ - if(a > 0) - return true; - else - return false; -} - -static void set_i(int * a, int b) -{ - int tmp = b; - *a = tmp; -} - -static void modify_f(float * f) -{ - *f *= 0.5f; -} - -static void modify_i(int * i) -{ - int j = *i; - int cutoff = 2 << 6; - if(j > cutoff) - j = cutoff; - if(is_neg(j)) - set_i(i, 0); - else if(is_pos(j)) - set_i(i, j); - else - set_i(i, cutoff); -} - -int __attribute__((kernel)) simple_kernel(int in) -{ - int i = in; - float f = (float) i; - modify_f(&f); - modify_i(&i); - int ret = (int) f; - return in * ret; -} - -int glob = 123; - -void addToGlobal(int arg) -{ - glob += arg; -} diff --git a/tests/lldb/cpp/InfiniteLoop/Android.mk b/tests/lldb/cpp/InfiniteLoop/Android.mk deleted file mode 100644 index 86a4ec55..00000000 --- a/tests/lldb/cpp/InfiniteLoop/Android.mk +++ /dev/null @@ -1,13 +0,0 @@ -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE := CppInfiniteLoop -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice - -LOCAL_SRC_FILES := \ - InfiniteLoop.cpp \ - infiniteloop.rscript - -include frameworks/rs/tests/lldb/cpp/common.mk -include $(BUILD_EXECUTABLE) diff --git a/tests/lldb/cpp/InfiniteLoop/InfiniteLoop.cpp b/tests/lldb/cpp/InfiniteLoop/InfiniteLoop.cpp deleted file mode 100644 index 2b55d4e5..00000000 --- a/tests/lldb/cpp/InfiniteLoop/InfiniteLoop.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* -* Copyright (C) 2016 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include <thread> -#include <chrono> - -#include <RenderScript.h> - -#include "ScriptC_infiniteloop.h" - -int main() -{ - static const int size = 64; - sp<RS> rs = new RS(); - - rs->init("/data/rscache", RS_INIT_LOW_LATENCY); - - auto e = Element::RGBA_8888(rs); - Type::Builder tb(rs, e); - tb.setX(size); - tb.setY(size); - auto t = tb.create(); - - auto a = Allocation::createTyped(rs, t); - auto b = Allocation::createTyped(rs, t); - - sp<ScriptC_infiniteloop> s = new ScriptC_infiniteloop(rs); - - // Test is designed to loop forever, waits for two seconds - // between each invocation of the kernel - bool forever = true; - while(forever) - { - s->forEach_simple_kernel(a, b); - std::this_thread::sleep_for(std::chrono::seconds(2)); - } - - uint32_t * output = new uint32_t[size*size]; - b->copy2DRangeTo(0, 0, size, size, output); - delete [] output; - - return 0; -} - diff --git a/tests/lldb/cpp/InfiniteLoop/infiniteloop.rscript b/tests/lldb/cpp/InfiniteLoop/infiniteloop.rscript deleted file mode 100644 index 7eff95c7..00000000 --- a/tests/lldb/cpp/InfiniteLoop/infiniteloop.rscript +++ /dev/null @@ -1,55 +0,0 @@ -/* -* Copyright (C) 2016 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* - * Copyright (C) 2014 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma version(1) -#pragma rs java_package_name(com.android.rs.cppinfiniteloop) - - -float4 gColor = {0.299f, 0.587f, 0.114f, 1.f}; - -/* RenderScript kernel that just sets the colour of the screen and does some - * simple operations so it is not completely empty - * (and can therefore be debugged). - */ -uchar4 __attribute__((kernel)) simple_kernel(uchar4 in) -{ - float4 out = rsUnpackColor8888(in); - - out.r = gColor.r; - out.g = gColor.g; - out.b = gColor.b; - out.a = gColor.a; - - uchar4 result = rsPackColorTo8888(out); - return result; -} - diff --git a/tests/lldb/cpp/KernelVariables/Android.mk b/tests/lldb/cpp/KernelVariables/Android.mk deleted file mode 100644 index 7a68c937..00000000 --- a/tests/lldb/cpp/KernelVariables/Android.mk +++ /dev/null @@ -1,13 +0,0 @@ -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE := CppKernelVariables -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice - -LOCAL_SRC_FILES := \ - KernelVariables.cpp \ - simple.rscript - -include frameworks/rs/tests/lldb/cpp/common.mk -include $(BUILD_EXECUTABLE) diff --git a/tests/lldb/cpp/KernelVariables/KernelVariables.cpp b/tests/lldb/cpp/KernelVariables/KernelVariables.cpp deleted file mode 100644 index e289005b..00000000 --- a/tests/lldb/cpp/KernelVariables/KernelVariables.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* -* Copyright (C) 2016 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include <RenderScript.h> - -#include "ScriptC_simple.h" - -int main() -{ - static const int size = 64; - sp<RS> rs = new RS(); - - rs->init("/data/rscache", RS_INIT_LOW_LATENCY | RS_INIT_WAIT_FOR_ATTACH); - - auto e = Element::RGBA_8888(rs); - Type::Builder tb(rs, e); - tb.setX(size); - tb.setY(size); - auto t = tb.create(); - - auto a = Allocation::createTyped(rs, t); - auto b = Allocation::createTyped(rs, t); - - sp<ScriptC_simple> s = new ScriptC_simple(rs); - - static const int buffer_int[] = {1, 2, 3, 4}; - sp<Allocation> int_allocation = Allocation::createSized(rs, Element::I32(rs), 4); - int_allocation->copy1DRangeFrom(0, 4, buffer_int); - s->set_allocation_1D_global(int_allocation); - - static const int buffer_int2[] = {5, 6, 7, 8}; - - Type::Builder typeI32Builder2D(rs, Element::I32(rs)); - typeI32Builder2D.setX(2); - typeI32Builder2D.setY(2); - - sp<Allocation> int_allocation2 = Allocation::createTyped(rs, typeI32Builder2D.create()); - int_allocation2->copy2DRangeFrom(0, 0, 2, 2, buffer_int2); - s->set_allocation_1D_global2(int_allocation2); - - s->set_allocation_2D_global(a); - s->set_allocation_2D_global2(b); - - static const int buffer_int3[] = {9, 10, 11, 12, 13, 14, 15, 16}; - - Type::Builder typeI32Builder3D(rs, Element::I32(rs)); - typeI32Builder3D.setX(2); - typeI32Builder3D.setY(2); - typeI32Builder3D.setZ(2); - - sp<Allocation> int_allocation3 = Allocation::createTyped(rs, typeI32Builder3D.create()); - int_allocation3->copy3DRangeFrom(0, 0, 0, 2, 2, 2, buffer_int3); - s->set_allocation_3D_global(int_allocation3); - - Type::Builder yuvTypeBuilder(rs, Element::YUV(rs)); - yuvTypeBuilder.setX(4); - yuvTypeBuilder.setY(4); - yuvTypeBuilder.setYuvFormat(RS_YUV_YV12); - - sp<Allocation> yuv_allocation = Allocation::createTyped(rs, yuvTypeBuilder.create()); - s->set_allocation_YUV_2D_global(yuv_allocation); - - s->set_sampler_global(Sampler::CLAMP_LINEAR(rs)); - - // Script is executed once, then the data is copied back when finished - s->forEach_kernel(a, b); - rs->finish(); - uint32_t * output = new uint32_t[size*size]; - b->copy2DRangeTo(0, 0, size, size, output); - delete [] output; - - return 0; -} - diff --git a/tests/lldb/cpp/KernelVariables/simple.rscript b/tests/lldb/cpp/KernelVariables/simple.rscript deleted file mode 100644 index bad675eb..00000000 --- a/tests/lldb/cpp/KernelVariables/simple.rscript +++ /dev/null @@ -1,197 +0,0 @@ -/* -* Copyright (C) 2016 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#pragma version(1) -#pragma rs java_package_name(com.android.rs.cppkernelvariables) - -char char_global = 12; -uchar uchar_global = 234; -short short_global = -321; -ushort ushort_global = 432; -int int_global = 1234; -uint uint_global = 2345; -float float_global = 4.5f; -long long_global = -77777; -ulong ulong_global = 8888; -double double_global = -456.5f; - -char2 char2_global = {11, -22}; -uchar2 uchar2_global = {33, 44}; -short2 short2_global = {-555, 666}; -ushort2 ushort2_global = {777, 888}; -int2 int2_global = {999, -1111}; -uint2 uint2_global = {2222, 3333}; -float2 float2_global = {4.5f, -5.0f}; -long2 long2_global = {-4444, 5555}; -ulong2 ulong2_global = {6666, 7777}; -double2 double2_global = {88.5f, -99.0f}; - -char3 char3_global = {11, -22, -33}; -uchar3 uchar3_global = {33, 44, 55}; -short3 short3_global = {-555, 666, 777}; -ushort3 ushort3_global = {777, 888, 999}; -int3 int3_global = {999, -1111, 2222}; -uint3 uint3_global = {2222, 3333, 4444}; -float3 float3_global = {4.5f, -5.0f, -6.5f}; -long3 long3_global = {-4444, 5555, 6666}; -ulong3 ulong3_global = {6666, 7777, 8888}; -double3 double3_global = {88.5f, -99.0f, 111.5f}; - -char4 char4_global = {55, 11, -22, -33}; -uchar4 uchar4_global = {222, 33, 44, 55}; -short4 short4_global = {-444, -555, 666, 777}; -ushort4 ushort4_global = {666, 777, 888, 999}; -int4 int4_global = {888, 999, -1111, 2222}; -uint4 uint4_global = {1111, 2222, 3333, 4444}; -float4 float4_global = {3.0f, 4.5f, -5.0f, -6.5f}; -long4 long4_global = {-3333, -4444, 5555, 6666}; -ulong4 ulong4_global = {5555, 6666, 7777, 8888}; -double4 double4_global = {-77.0f, 88.5f, -99.0f, 111.5f}; - -rs_matrix2x2 matrix2x2_global; -rs_matrix3x3 matrix3x3_global; -rs_matrix4x4 matrix4x4_global; - -rs_quaternion quaternion_global; - -rs_allocation allocation_1D_global; -rs_allocation allocation_1D_global2; -rs_allocation allocation_2D_global; -rs_allocation allocation_2D_global2; -rs_allocation allocation_3D_global; -rs_allocation allocation_YUV_2D_global; - -rs_allocation_cubemap_face cubemap_face_global; -rs_sampler sampler_global; - -uchar4 __attribute__((kernel)) kernel(uchar4 in) -{ - char char_local = 'a'; - uchar uchar_local = 'b'; - short short_local = -321; - ushort ushort_local = 432; - int int_local = 1234; - uint uint_local = 2345; - float float_local = 4.5f; - long long_local = -77777; - ulong ulong_local = 8888; - double double_local = -456.5f; - - char2 char2_local = {-11, -22}; - uchar2 uchar2_local = {33, 44}; - short2 short2_local = {-555, 666}; - ushort2 ushort2_local = {777, 888}; - int2 int2_local = {999, -1111}; - uint2 uint2_local = {2222, 3333}; - float2 float2_local = {4.5f, -5.0f}; - long2 long2_local = {-4444, 5555}; - ulong2 ulong2_local = {6666, 7777}; - double2 double2_local = {88.5f, -99.0f}; - - char3 char3_local = {11, -22, -33}; - uchar3 uchar3_local = {33, 44, 55}; - short3 short3_local = {-555, 666, 777}; - ushort3 ushort3_local = {777, 888, 999}; - int3 int3_local = {999, -1111, 2222}; - uint3 uint3_local = {2222, 3333, 4444}; - float3 float3_local = {4.5f, -5.0f, -6.5f}; - long3 long3_local = {-4444, 5555, 6666}; - ulong3 ulong3_local = {6666, 7777, 8888}; - double3 double3_local = {88.5f, -99.0f, 111.5f}; - - char4 char4_local = {55, 11, -22, -33}; - uchar4 uchar4_local = {22, 33, 44, 55}; - short4 short4_local = {-444, -555, 666, 777}; - ushort4 ushort4_local = {666, 777, 888, 999}; - int4 int4_local = {888, 999, -1111, 2222}; - uint4 uint4_local = {1111, 2222, 3333, 4444}; - float4 float4_local = {3.0f, 4.5f, -5.0f, -6.5f}; - long4 long4_local = {-3333, -4444, 5555, 6666}; - ulong4 ulong4_local = {5555, 6666, 7777, 8888}; - double4 double4_local = {-77.0f, 88.5f, -99.0f, 111.5f}; - - rs_matrix2x2 matrix2x2_local = {{1., 2.5, - 3., 4.5}}; - rs_matrix3x3 matrix3x3_local = {{5., 6.5, 7., - 8.5, 9., 1.5, - 2., 3.5, 4.}}; - rs_matrix4x4 matrix4x4_local = {{5.5, 6., 7.5, 8., - 9., 1.5, 2., 3.5, - 4.5, 5.5, 6.5, 7., - 8., 9.5, 1.5, 2.5}}; - - matrix2x2_global = matrix2x2_local; - matrix3x3_global = matrix3x3_local; - matrix4x4_global = matrix4x4_local; - - rsQuaternionSet(&quaternion_global, 3.0, 4.5, 5.5, 6.0); - - rs_quaternion quaternion_local; - rsQuaternionSet(&quaternion_local, 7.5, 8.0, 9.0, 0.5); - - char char_combined = char_local + (char)uchar_local + char2_local.x + - (char)uchar2_local.x + char3_local.x - (char)uchar3_local.x + - char4_local.x + (char)uchar4_local.x; - - short short_combined = short_local + (short)ushort_local + short2_local.x + - (short)ushort2_local.x + short3_local.x + (short)ushort3_local.x + - short4_local.x + (short)ushort4_local.x; - - int int_combined = int_local + (int)uint_local + int2_local.x + - (int)uint2_local.x + int3_local.x + (int)uint3_local.x + int4_local.x + - (int)uint4_local.x; - - float float_combined = float_local + float2_local.x + float3_local.x + - float4_local.x; - - long long_combined = long_local + (long)ulong_local + long2_local.x + - (long)ulong2_local.x + long3_local.x + (long)ulong3_local.x + - long4_local.x + (long)ulong4_local.x; - - double double_combined = double_local + double2_local.x + double3_local.x + - double4_local.x; - - char_global = char_combined; - short_global = short_combined; - int_global = int_combined; - float_global = float_combined; - long_global = long_combined; - double_global = double_combined; - - uchar4 result = {1,2,3,4}; - return result; -} - -float use_constants_global; - -void setup(void) -{ - use_constants_global = - M_1_PI + - M_2_PI + - M_2_PIl + - M_2_SQRTPI + - M_E + - M_LN10 + - M_LN2 + - M_LOG10E + - M_LOG2E + - M_PI + - M_PI_2 + - M_PI_4 + - M_SQRT1_2 + - M_SQRT2; -} diff --git a/tests/lldb/cpp/MultipleRSFiles/Android.mk b/tests/lldb/cpp/MultipleRSFiles/Android.mk deleted file mode 100644 index d4b5b35c..00000000 --- a/tests/lldb/cpp/MultipleRSFiles/Android.mk +++ /dev/null @@ -1,14 +0,0 @@ -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE := CppMultipleRSFiles -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice - -LOCAL_SRC_FILES := \ - MultipleRSFiles.cpp \ - first.rscript \ - second.rscript - -include frameworks/rs/tests/lldb/cpp/common.mk -include $(BUILD_EXECUTABLE) diff --git a/tests/lldb/cpp/MultipleRSFiles/MultipleRSFiles.cpp b/tests/lldb/cpp/MultipleRSFiles/MultipleRSFiles.cpp deleted file mode 100644 index 9d0d4e7b..00000000 --- a/tests/lldb/cpp/MultipleRSFiles/MultipleRSFiles.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* -* Copyright (C) 2016 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include <RenderScript.h> - -#include "ScriptC_first.h" -#include "ScriptC_second.h" - -int main() -{ - static const int size = 64; - sp<RS> rs = new RS(); - - rs->init("/data/rscache", RS_INIT_LOW_LATENCY | RS_INIT_WAIT_FOR_ATTACH); - - auto e = Element::RGBA_8888(rs); - Type::Builder tb(rs, e); - tb.setX(size); - tb.setY(size); - auto t = tb.create(); - - auto a = Allocation::createTyped(rs, t); - auto b = Allocation::createTyped(rs, t); - - // Script is executed once, then the data is copied back when finished - sp<ScriptC_first> s1 = new ScriptC_first(rs); - sp<ScriptC_second> s2 = new ScriptC_second(rs); - - s1->forEach_first_kernel(a, b); - uint32_t * output = new uint32_t[size*size]; - b->copy2DRangeTo(0, 0, size, size, output); - delete [] output; - - s2->forEach_second_kernel(a, b); - - rs->finish(); - return 0; -} diff --git a/tests/lldb/cpp/MultipleRSFiles/first.rscript b/tests/lldb/cpp/MultipleRSFiles/first.rscript deleted file mode 100644 index 2f84c465..00000000 --- a/tests/lldb/cpp/MultipleRSFiles/first.rscript +++ /dev/null @@ -1,32 +0,0 @@ -/* -* Copyright (C) 2016 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#pragma version(1) -#pragma rs java_package_name(com.android.rs.cppmultiplersfiles) - -float4 gColor = {0.299f, 0.587f, 0.114f, 1.f}; - -/* RenderScript kernel that just sets the colour of the screen and does some - * simple operations so it is not completely empty - * (and can therefore be debugged). - */ -uchar4 __attribute__((kernel)) first_kernel(uchar4 in) -{ - float4 temp = rsUnpackColor8888(in); - temp = gColor; - uchar4 result = rsPackColorTo8888(temp); - return result; -} diff --git a/tests/lldb/cpp/MultipleRSFiles/second.rscript b/tests/lldb/cpp/MultipleRSFiles/second.rscript deleted file mode 100644 index 0279d0ff..00000000 --- a/tests/lldb/cpp/MultipleRSFiles/second.rscript +++ /dev/null @@ -1,25 +0,0 @@ -/* -* Copyright (C) 2016 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#pragma version(1) -#pragma rs java_package_name(com.android.rs.cppmultiplersfiles) - -/* RenderScript kernel that just returns the swizzled input. */ -uchar4 __attribute__((kernel)) second_kernel(uchar4 in) -{ - uchar4 result = in.wzyx; - return result; -} diff --git a/tests/lldb/cpp/WaitAttach/Android.mk b/tests/lldb/cpp/WaitAttach/Android.mk deleted file mode 100644 index 00bf745d..00000000 --- a/tests/lldb/cpp/WaitAttach/Android.mk +++ /dev/null @@ -1,27 +0,0 @@ -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE := CppDebugWaitAttach -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice - -LOCAL_SRC_FILES := \ - WaitAttach.cpp \ - simple.rscript - -include frameworks/rs/tests/lldb/cpp/common.mk -include $(BUILD_EXECUTABLE) - -include $(CLEAR_VARS) - -LOCAL_MODULE := CppNoDebugWaitAttach -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice - -LOCAL_SRC_FILES := \ - WaitAttach.cpp \ - simple.rscript - -include frameworks/rs/tests/lldb/cpp/common.mk -LOCAL_RENDERSCRIPT_FLAGS := $(filter-out -g,$(LOCAL_RENDERSCRIPT_FLAGS)) -include $(BUILD_EXECUTABLE) diff --git a/tests/lldb/cpp/WaitAttach/WaitAttach.cpp b/tests/lldb/cpp/WaitAttach/WaitAttach.cpp deleted file mode 100644 index c6c1980b..00000000 --- a/tests/lldb/cpp/WaitAttach/WaitAttach.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* -* Copyright (C) 2016 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include <RenderScript.h> - -#include "ScriptC_simple.h" - -int main() -{ - static const int size = 8; - sp<RS> rs = new RS(); - - rs->init("/data/rscache", RS_INIT_LOW_LATENCY | RS_INIT_WAIT_FOR_ATTACH); - - auto e = Element::RGBA_8888(rs); - Type::Builder tb(rs, e); - tb.setX(size); - tb.setY(size); - auto t = tb.create(); - - auto a = Allocation::createTyped(rs, t); - auto b = Allocation::createTyped(rs, t); - - // Script is executed once, then the data is copied back when finished - sp<ScriptC_simple> s = new ScriptC_simple(rs); - s->forEach_simple_kernel(a, b); - uint32_t * output = new uint32_t[size*size]; - b->copy2DRangeTo(0, 0, size, size, output); - delete [] output; - - s->forEach_other_kernel(a, b); - - rs->finish(); - return 0; -} diff --git a/tests/lldb/cpp/WaitAttach/simple.rscript b/tests/lldb/cpp/WaitAttach/simple.rscript deleted file mode 100644 index 1e9780a2..00000000 --- a/tests/lldb/cpp/WaitAttach/simple.rscript +++ /dev/null @@ -1,39 +0,0 @@ -/* -* Copyright (C) 2016 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#pragma version(1) -#pragma rs java_package_name(com.android.rs.cppwaitattach) - -float4 gColor = {0.299f, 0.587f, 0.114f, 1.f}; - -/* RenderScript kernel that just sets the colour of the screen and does some - * simple operations so it is not completely empty - * (and can therefore be debugged). - */ -uchar4 __attribute__((kernel)) simple_kernel(uchar4 in) -{ - float4 temp = rsUnpackColor8888(in); - temp = gColor; - uchar4 result = rsPackColorTo8888(temp); - return result; -} - -// Extra kernel to test lldb setting breakpoints on all the RS kernels. -uchar4 __attribute__((kernel)) other_kernel(uchar4 in) -{ - uchar4 result = in.wzyx; - return result; -} diff --git a/tests/lldb/cpp/common.mk b/tests/lldb/cpp/common.mk deleted file mode 100644 index 3b657412..00000000 --- a/tests/lldb/cpp/common.mk +++ /dev/null @@ -1,11 +0,0 @@ -LOCAL_MODULE_TAGS := tests - -LOCAL_RENDERSCRIPT_FLAGS += -g -O0 -target-api 0 -LOCAL_CFLAGS := -Werror -Wall -Wextra -std=c++11 -LOCAL_LDFLAGS += -llog - -LOCAL_STATIC_LIBRARIES += libRScpp_static - -intermediates += $(call intermediates-dir-for,STATIC_LIBRARIES,libRS,TARGET,) - -LOCAL_C_INCLUDES += $(intermediates) diff --git a/tests/lldb/java/Allocations/Android.mk b/tests/lldb/java/Allocations/Android.mk deleted file mode 100644 index cff322f3..00000000 --- a/tests/lldb/java/Allocations/Android.mk +++ /dev/null @@ -1,17 +0,0 @@ -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE_TAGS := tests - -LOCAL_SRC_FILES := \ - $(call all-java-files-under, src) \ - $(call all-renderscript-files-under, src) - -LOCAL_PACKAGE_NAME := Allocations -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_PRIVATE_PLATFORM_APIS := true - -LOCAL_RENDERSCRIPT_FLAGS := -g -O0 -Wno-unused -target-api 0 - -include $(BUILD_PACKAGE) diff --git a/tests/lldb/java/Allocations/AndroidManifest.xml b/tests/lldb/java/Allocations/AndroidManifest.xml deleted file mode 100644 index 8650cb0c..00000000 --- a/tests/lldb/java/Allocations/AndroidManifest.xml +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.rs.allocations"> - <uses-sdk android:minSdkVersion="21" /> - <application android:label="Allocations" - android:hardwareAccelerated="true"> - <activity android:name="MainActivity"> - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> - </intent-filter> - </activity> - </application> -</manifest> - diff --git a/tests/lldb/java/Allocations/res/layout/main_layout.xml b/tests/lldb/java/Allocations/res/layout/main_layout.xml deleted file mode 100644 index 131c3b57..00000000 --- a/tests/lldb/java/Allocations/res/layout/main_layout.xml +++ /dev/null @@ -1,15 +0,0 @@ -<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:background="#0099cc" - tools:context=".MainActivity"> - - <ImageView - android:id="@+id/imageView" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:scaleType="fitCenter" /> - -</FrameLayout> - diff --git a/tests/lldb/java/Allocations/src/com/android/rs/allocations/MainActivity.java b/tests/lldb/java/Allocations/src/com/android/rs/allocations/MainActivity.java deleted file mode 100644 index f06f2b97..00000000 --- a/tests/lldb/java/Allocations/src/com/android/rs/allocations/MainActivity.java +++ /dev/null @@ -1,552 +0,0 @@ -/* -* Copyright (C) 2016 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -package com.android.rs.allocations; - -import android.app.Activity; -import android.os.Bundle; -import android.graphics.Bitmap; -import android.renderscript.*; - -public class MainActivity extends Activity { - private RenderScript mRS; - - private Allocation mInAllocation; // script input - private Allocation mOutAllocation; // script output - - private Allocation mStructInAlloc; // complexStruct input - private Allocation mStructOutAlloc; // complexStruct output - - private Allocation mBoolAllocation; // boolean - - private Allocation mCharAllocation; // char - private Allocation mChar2Allocation; // char2 - private Allocation mChar3Allocation; // char3 - private Allocation mChar4Allocation; // char4 - - private Allocation mUCharAllocation; // uchar - private Allocation mUChar2Allocation; // uchar2 - private Allocation mUChar3Allocation; // uchar3 - private Allocation mUChar4Allocation; // uchar4 - - private Allocation mShortAllocation; // short - private Allocation mShort2Allocation; // short2 - private Allocation mShort3Allocation; // short3 - private Allocation mShort4Allocation; // short4 - - private Allocation mUShortAllocation; // ushort - private Allocation mUShort2Allocation; // ushort2 - private Allocation mUShort3Allocation; // ushort3 - private Allocation mUShort4Allocation; // ushort4 - - private Allocation mIntAllocation; // int - private Allocation mInt2Allocation; // int2 - private Allocation mInt3Allocation; // int3 - private Allocation mInt4Allocation; // int4 - - private Allocation mUIntAllocation; // uint - private Allocation mUInt2Allocation; // uint2 - private Allocation mUInt3Allocation; // uint3 - private Allocation mUInt4Allocation; // uint4 - - private Allocation mLongAllocation; // long - private Allocation mLong2Allocation; // long2 - private Allocation mLong3Allocation; // long3 - private Allocation mLong4Allocation; // long4 - - private Allocation mULongAllocation; // ulong - private Allocation mULong2Allocation; // ulong2 - private Allocation mULong3Allocation; // ulong3 - private Allocation mULong4Allocation; // ulong4 - - private Allocation mHalfAllocation; // half - private Allocation mHalf2Allocation; // half2 - private Allocation mHalf3Allocation; // half3 - private Allocation mHalf4Allocation; // half4 - - private Allocation mFloatAllocation; // float - private Allocation mFloat2Allocation; // float2 - private Allocation mFloat3Allocation; // float3 - private Allocation mFloat4Allocation; // float4 - - private Allocation mDoubleAllocation; // double - private Allocation mDouble2Allocation; // double2 - private Allocation mDouble3Allocation; // double3 - private Allocation mDouble4Allocation; // double4 - - private ScriptC_allocs mScript; - - private int mAllocSize = 24; // Chosen as allocation size since it's easily divisible - - private Bitmap mBitmapIn; - private Bitmap mBitmapOut; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - setContentView(R.layout.main_layout); - - mBitmapIn = Bitmap.createBitmap(64, 64, Bitmap.Config.ARGB_8888); - mBitmapOut = Bitmap.createBitmap(mBitmapIn.getWidth(), mBitmapIn.getHeight(), mBitmapIn.getConfig()); - - createScript(); - runScript(); - } - - private void createScript() { - mRS = RenderScript.create(this, - RenderScript.ContextType.NORMAL, - RenderScript.CREATE_FLAG_LOW_LATENCY | - RenderScript.CREATE_FLAG_WAIT_FOR_ATTACH); - - mScript = new ScriptC_allocs(mRS); - } - - private void createSignedAllocations() { - Type.Builder typeI8Builder = new Type.Builder(mRS, Element.I8(mRS)); - typeI8Builder.setX(1); // One element here to test 16 byte memory alignment - typeI8Builder.setY(3); - typeI8Builder.setZ(8); - - mCharAllocation = Allocation.createTyped(mRS, typeI8Builder.create()); - mRS.finish(); - mChar2Allocation = Allocation.createSized(mRS, Element.I8_2(mRS), mAllocSize / 2); - mRS.finish(); - mChar3Allocation = Allocation.createSized(mRS, Element.I8_3(mRS), mAllocSize / 4); - mRS.finish(); - mChar4Allocation = Allocation.createSized(mRS, Element.I8_4(mRS), mAllocSize / 4); - mRS.finish(); - - Type.Builder typeI16_2Builder = new Type.Builder(mRS, Element.I16_2(mRS)); - typeI16_2Builder.setX(6); - typeI16_2Builder.setY(1); - typeI16_2Builder.setZ(2); - - mShortAllocation = Allocation.createSized(mRS, Element.I16(mRS), mAllocSize); - mRS.finish(); - mShort2Allocation = Allocation.createTyped(mRS, typeI16_2Builder.create()); - mRS.finish(); - mShort3Allocation = Allocation.createSized(mRS, Element.I16_3(mRS), mAllocSize / 4); - mRS.finish(); - mShort4Allocation = Allocation.createSized(mRS, Element.I16_4(mRS), mAllocSize / 4); - mRS.finish(); - - Type.Builder typeI32_3Builder = new Type.Builder(mRS, Element.I32_3(mRS)); - typeI32_3Builder.setX(3); - typeI32_3Builder.setY(2); - - mIntAllocation = Allocation.createSized(mRS, Element.I32(mRS), mAllocSize); - mRS.finish(); - mInt2Allocation = Allocation.createSized(mRS, Element.I32_2(mRS), mAllocSize / 2); - mRS.finish(); - mInt3Allocation = Allocation.createTyped(mRS, typeI32_3Builder.create()); - mRS.finish(); - mInt4Allocation = Allocation.createSized(mRS, Element.I32_4(mRS), mAllocSize / 4); - mRS.finish(); - - Type.Builder typeI64_4Builder = new Type.Builder(mRS, Element.I64_4(mRS)); - typeI64_4Builder.setX(1); - typeI64_4Builder.setY(6); - - mLongAllocation = Allocation.createSized(mRS, Element.I64(mRS), mAllocSize); - mRS.finish(); - mLong2Allocation = Allocation.createSized(mRS, Element.I64_2(mRS), mAllocSize / 2); - mRS.finish(); - mLong3Allocation = Allocation.createSized(mRS, Element.I64_3(mRS), mAllocSize / 4); - mRS.finish(); - mLong4Allocation = Allocation.createTyped(mRS, typeI64_4Builder.create()); - mRS.finish(); - - mBoolAllocation = Allocation.createSized(mRS, Element.BOOLEAN(mRS), mAllocSize); - mRS.finish(); - } - - private void initSignedAllocations() { - byte[] buffer_char = new byte[mAllocSize]; - short[] buffer_short = new short[mAllocSize]; - int[] buffer_int = new int[mAllocSize]; - long[] buffer_long = new long[mAllocSize]; - byte[] buffer_bool = new byte[mAllocSize]; - - for(int i = 0; i < mAllocSize; ++i) { - buffer_char[i] = (byte) i; - buffer_short[i] = (short) i; - buffer_int[i] = (int) i; - buffer_long[i] = (long) i; - buffer_bool[i] = (byte) (0x01 & i); - } - - mCharAllocation.copyFrom(buffer_char); - mChar2Allocation.copyFrom(buffer_char); - mChar3Allocation.copyFrom(buffer_char); - mChar4Allocation.copyFrom(buffer_char); - - mShortAllocation.copyFrom(buffer_short); - mShort2Allocation.copyFrom(buffer_short); - mShort3Allocation.copyFrom(buffer_short); - mShort4Allocation.copyFrom(buffer_short); - - mIntAllocation.copyFrom(buffer_int); - mInt2Allocation.copyFrom(buffer_int); - mInt3Allocation.copyFrom(buffer_int); - mInt4Allocation.copyFrom(buffer_int); - - mLongAllocation.copyFrom(buffer_long); - mLong2Allocation.copyFrom(buffer_long); - mLong3Allocation.copyFrom(buffer_long); - mLong4Allocation.copyFrom(buffer_long); - - mBoolAllocation.copyFromUnchecked(buffer_bool); - } - - private void createUnsignedAllocations() { - Type.Builder typeU8_2Builder = new Type.Builder(mRS, Element.U8_2(mRS)); - typeU8_2Builder.setX(2); - typeU8_2Builder.setY(6); - - mUCharAllocation = Allocation.createSized(mRS, Element.U8(mRS), mAllocSize); - mRS.finish(); - mUChar2Allocation = Allocation.createTyped(mRS, typeU8_2Builder.create()); - mRS.finish(); - mUChar3Allocation = Allocation.createSized(mRS, Element.U8_3(mRS), mAllocSize / 4); - mRS.finish(); - mUChar4Allocation = Allocation.createSized(mRS, Element.U8_4(mRS), mAllocSize / 4); - mRS.finish(); - - Type.Builder typeU16_3Builder = new Type.Builder(mRS, Element.U16_3(mRS)); - typeU16_3Builder.setX(1); - typeU16_3Builder.setY(6); - - mUShortAllocation = Allocation.createSized(mRS, Element.U16(mRS), mAllocSize); - mRS.finish(); - mUShort2Allocation = Allocation.createSized(mRS, Element.U16_2(mRS), mAllocSize / 2); - mRS.finish(); - mUShort3Allocation = Allocation.createTyped(mRS, typeU16_3Builder.create()); - mRS.finish(); - mUShort4Allocation = Allocation.createSized(mRS, Element.U16_4(mRS), mAllocSize / 4); - mRS.finish(); - - Type.Builder typeU32_4Builder = new Type.Builder(mRS, Element.U32_4(mRS)); - typeU32_4Builder.setX(1); - typeU32_4Builder.setY(1); - typeU32_4Builder.setZ(6); - - mUIntAllocation = Allocation.createSized(mRS, Element.U32(mRS), mAllocSize); - mRS.finish(); - mUInt2Allocation = Allocation.createSized(mRS, Element.U32_2(mRS), mAllocSize / 2); - mRS.finish(); - mUInt3Allocation = Allocation.createSized(mRS, Element.U32_3(mRS), mAllocSize / 4); - mRS.finish(); - mUInt4Allocation = Allocation.createTyped(mRS, typeU32_4Builder.create()); - mRS.finish(); - - Type.Builder typeU64Builder = new Type.Builder(mRS, Element.U64(mRS)); - typeU64Builder.setX(4); - typeU64Builder.setY(3); - typeU64Builder.setZ(2); - - mULongAllocation = Allocation.createTyped(mRS, typeU64Builder.create()); - mRS.finish(); - mULong2Allocation = Allocation.createSized(mRS, Element.U64_2(mRS), mAllocSize / 2); - mRS.finish(); - mULong3Allocation = Allocation.createSized(mRS, Element.U64_3(mRS), mAllocSize / 4); - mRS.finish(); - mULong4Allocation = Allocation.createSized(mRS, Element.U64_4(mRS), mAllocSize / 4); - mRS.finish(); - } - - private void initUnsignedAllocations() { - byte[] buffer_char = new byte[mAllocSize]; - short[] buffer_short = new short[mAllocSize]; - int[] buffer_int = new int[mAllocSize]; - long[] buffer_long = new long[mAllocSize]; - - for(int i = 0; i < mAllocSize; ++i) { - buffer_char[i] = (byte) i; - buffer_short[i] = (short) i; - buffer_int[i] = (int) i; - buffer_long[i] = (long) i; - } - - mUCharAllocation.copyFrom(buffer_char); - mUChar2Allocation.copyFrom(buffer_char); - mUChar3Allocation.copyFrom(buffer_char); - mUChar4Allocation.copyFrom(buffer_char); - - mUShortAllocation.copyFrom(buffer_short); - mUShort2Allocation.copyFrom(buffer_short); - mUShort3Allocation.copyFrom(buffer_short); - mUShort4Allocation.copyFrom(buffer_short); - - mUIntAllocation.copyFrom(buffer_int); - mUInt2Allocation.copyFrom(buffer_int); - mUInt3Allocation.copyFrom(buffer_int); - mUInt4Allocation.copyFrom(buffer_int); - - mULongAllocation.copyFrom(buffer_long); - mULong2Allocation.copyFrom(buffer_long); - mULong3Allocation.copyFrom(buffer_long); - mULong4Allocation.copyFrom(buffer_long); - } - - private void createFloatAllocations() { - Type.Builder typeF16_3Builder = new Type.Builder(mRS, Element.F16_3(mRS)); - typeF16_3Builder.setX(1); - typeF16_3Builder.setY(6); - - mHalfAllocation = Allocation.createSized(mRS, Element.F16(mRS), mAllocSize); - mRS.finish(); - mHalf2Allocation = Allocation.createSized(mRS, Element.F16_2(mRS), mAllocSize / 2); - mRS.finish(); - mHalf3Allocation = Allocation.createTyped(mRS, typeF16_3Builder.create()); - mRS.finish(); - mHalf4Allocation = Allocation.createSized(mRS, Element.F16_4(mRS), mAllocSize / 4); - mRS.finish(); - - Type.Builder typeF32_4Builder = new Type.Builder(mRS, Element.F32_4(mRS)); - typeF32_4Builder.setX(3); - typeF32_4Builder.setY(2); - - mFloatAllocation = Allocation.createSized(mRS, Element.F32(mRS), mAllocSize); - mRS.finish(); - mFloat2Allocation = Allocation.createSized(mRS, Element.F32_2(mRS), mAllocSize / 2); - mRS.finish(); - mFloat3Allocation = Allocation.createSized(mRS, Element.F32_3(mRS), mAllocSize / 4); - mRS.finish(); - mFloat4Allocation = Allocation.createTyped(mRS, typeF32_4Builder.create()); - mRS.finish(); - - Type.Builder typeF64_2Builder = new Type.Builder(mRS, Element.F64_2(mRS)); - typeF64_2Builder.setX(4); - typeF64_2Builder.setY(1); - typeF64_2Builder.setZ(3); - - mDoubleAllocation = Allocation.createSized(mRS, Element.F64(mRS), mAllocSize); - mRS.finish(); - mDouble2Allocation = Allocation.createTyped(mRS, typeF64_2Builder.create()); - mRS.finish(); - - Type.Builder typeF64_3Builder = new Type.Builder(mRS, Element.F64_3(mRS)); - typeF64_3Builder.setX(1); - typeF64_3Builder.setY(2); - typeF64_3Builder.setZ(3); - - Type.Builder typeF64_4Builder = new Type.Builder(mRS, Element.F64_4(mRS)); - typeF64_4Builder.setX(1); - typeF64_4Builder.setY(2); - typeF64_4Builder.setZ(3); - - mDouble3Allocation = Allocation.createTyped(mRS, typeF64_3Builder.create()); - mRS.finish(); - mDouble4Allocation = Allocation.createTyped(mRS, typeF64_4Builder.create()); - mRS.finish(); - } - - private void initFloatAllocations() { - // No java type for half precision float, so bitcast 16-bit int - short[] buffer_half = new short[mAllocSize]; - float[] buffer_float = new float[mAllocSize]; - double[] buffer_double = new double[mAllocSize]; - - for(int i = 0; i < mAllocSize; ++i) { - // Construct IEEE 754 half with increasing fraction. - byte mantissa = (byte)(i); - byte exponent = 0b00111100; // keep exponent constant at one - buffer_half[i] = (short)((exponent << 8) | mantissa); - - buffer_float[i] = (float) 1 / i; - buffer_double[i] = (double) 1 / i; - } - - mHalfAllocation.copyFromUnchecked(buffer_half); - mHalf2Allocation.copyFromUnchecked(buffer_half); - mHalf3Allocation.copyFromUnchecked(buffer_half); - mHalf4Allocation.copyFromUnchecked(buffer_half); - - mFloatAllocation.copyFrom(buffer_float); - mFloat2Allocation.copyFrom(buffer_float); - mFloat3Allocation.copyFrom(buffer_float); - mFloat4Allocation.copyFrom(buffer_float); - - mDoubleAllocation.copyFrom(buffer_double); - mDouble2Allocation.copyFrom(buffer_double); - mDouble3Allocation.copyFrom(buffer_double); - mDouble4Allocation.copyFrom(buffer_double); - } - - private void createStructAllocations() { - ScriptField_complexStruct complex_struct; - - complex_struct = new ScriptField_complexStruct(mRS, mAllocSize); - mRS.finish(); - mScript.bind_g_complexStruct_in(complex_struct); - mRS.finish(); - mStructInAlloc = complex_struct.getAllocation(); - mRS.finish(); - - complex_struct = new ScriptField_complexStruct(mRS, mAllocSize); - mRS.finish(); - mScript.bind_g_complexStruct_out(complex_struct); - mRS.finish(); - mStructOutAlloc = complex_struct.getAllocation(); - mRS.finish(); - } - - private void overwriteFloatAllocations() { - float[] buffer_float = new float[mAllocSize]; - - // Set float allocations to -1/n - for(int i = 0; i < mAllocSize; ++i) { - buffer_float[i] = -1f / i; - } - - mFloatAllocation.copyFrom(buffer_float); - mFloat2Allocation.copyFrom(buffer_float); - mFloat3Allocation.copyFrom(buffer_float); - mFloat4Allocation.copyFrom(buffer_float); - } - - private void runScript() { - mInAllocation = Allocation.createFromBitmap(mRS, mBitmapIn); - mRS.finish(); - mOutAllocation = Allocation.createFromBitmap(mRS, mBitmapOut); - mRS.finish(); - - - createSignedAllocations(); - initSignedAllocations(); - - mRS.finish(); - mScript.forEach_swizzle_kernel(mInAllocation, mOutAllocation); - mRS.finish(); - - mOutAllocation.copyTo(mBitmapOut); - - mCharAllocation.destroy(); - mRS.finish(); - mChar2Allocation.destroy(); - mRS.finish(); - mChar3Allocation.destroy(); - mRS.finish(); - mChar4Allocation.destroy(); - mRS.finish(); - - mShort2Allocation.destroy(); - mRS.finish(); - mShort3Allocation.destroy(); - mRS.finish(); - mShort4Allocation.destroy(); - mRS.finish(); - - mIntAllocation.destroy(); - mRS.finish(); - mInt2Allocation.destroy(); - mRS.finish(); - mInt3Allocation.destroy(); - mRS.finish(); - mInt4Allocation.destroy(); - mRS.finish(); - - mLongAllocation.destroy(); - mRS.finish(); - mLong2Allocation.destroy(); - mRS.finish(); - mLong3Allocation.destroy(); - mRS.finish(); - mLong4Allocation.destroy(); - mRS.finish(); - - mBoolAllocation.destroy(); - mRS.finish(); - - - createUnsignedAllocations(); - initUnsignedAllocations(); - - mInAllocation = mUShortAllocation; // Host side assignment - - mRS.finish(); - mScript.forEach_square_kernel(mInAllocation, mUIntAllocation); - mRS.finish(); - - mUCharAllocation.destroy(); - mRS.finish(); - mUChar2Allocation.destroy(); - mRS.finish(); - mUChar3Allocation.destroy(); - mRS.finish(); - mUChar4Allocation.destroy(); - mRS.finish(); - - mUShortAllocation.destroy(); - mRS.finish(); - mUShort2Allocation.destroy(); - mRS.finish(); - mUShort3Allocation.destroy(); - mRS.finish(); - mUShort4Allocation.destroy(); - mRS.finish(); - - mUInt2Allocation.destroy(); - mRS.finish(); - mUInt3Allocation.destroy(); - mRS.finish(); - mUInt4Allocation.destroy(); - mRS.finish(); - - mULongAllocation.destroy(); - mRS.finish(); - mULong2Allocation.destroy(); - mRS.finish(); - mULong3Allocation.destroy(); - mRS.finish(); - mULong4Allocation.destroy(); - mRS.finish(); - - - createFloatAllocations(); - initFloatAllocations(); - - mRS.finish(); - mScript.forEach_add_half_kernel(mDouble4Allocation, mDouble3Allocation); - mRS.finish(); - - mHalfAllocation.destroy(); - mRS.finish(); - mHalf2Allocation.destroy(); - mRS.finish(); - mHalf3Allocation.destroy(); - mRS.finish(); - mHalf4Allocation.destroy(); - mRS.finish(); - - mDoubleAllocation.destroy(); - mRS.finish(); - mDouble2Allocation.destroy(); - mRS.finish(); - mDouble4Allocation.destroy(); - mRS.finish(); - - overwriteFloatAllocations(); - - createStructAllocations(); - - mRS.finish(); - mScript.forEach_struct_kernel(mStructInAlloc, mStructOutAlloc); - mRS.finish(); - } -} diff --git a/tests/lldb/java/Allocations/src/rs/allocs.rscript b/tests/lldb/java/Allocations/src/rs/allocs.rscript deleted file mode 100644 index 0ec39c52..00000000 --- a/tests/lldb/java/Allocations/src/rs/allocs.rscript +++ /dev/null @@ -1,82 +0,0 @@ -/* -* Copyright (C) 2016 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#pragma version(1) -#pragma rs java_package_name(com.android.rs.allocations) - -struct simpleStruct { - int i; - unsigned int j; -}; - -struct complexStruct { - struct simpleStruct s; - uchar4 c; - float f[2]; -}; - -struct complexStruct *g_complexStruct_in; -struct complexStruct *g_complexStruct_out; - -// Kernel performs basic vector swizzle -uchar4 __attribute__((kernel)) swizzle_kernel(uchar4 in) -{ - return in.wzyx; -} - -// Kernel squares every element in allocation -uint __attribute__((kernel)) square_kernel(ushort in) -{ - uint result = (uint)(in) * (uint)in; - return result; -} - -// Helper function adding 1/2 to passed in double -static double half_helper(double in) -{ - return (in + 0.5); -} - -// Kernel returns first 3 elements of a double4 plus 1/2 -double3 __attribute__((kernel)) add_half_kernel(double4 in) -{ - double3 result; - result.x = half_helper(in.x); - result.y = half_helper(in.y); - result.z = half_helper(in.z); - return result; -} - -// Kernel for testing structs -struct complexStruct __attribute__((kernel)) -struct_kernel(struct complexStruct in, uint32_t x) -{ - struct complexStruct complex_out; - struct simpleStruct simple_out; - simple_out.i = (int) x; - simple_out.j = x; - complex_out.s = simple_out; - - complex_out.f[0] = (float) x; - complex_out.f[1] = (float) x + 0.5; - - complex_out.c.x = (uchar) (x % 128); - complex_out.c.y = 'A'; - complex_out.c.z = 'B'; - complex_out.c.w = 'C'; - - return complex_out; -} diff --git a/tests/lldb/java/Android.mk b/tests/lldb/java/Android.mk deleted file mode 100644 index 5053e7d6..00000000 --- a/tests/lldb/java/Android.mk +++ /dev/null @@ -1 +0,0 @@ -include $(call all-subdir-makefiles) diff --git a/tests/lldb/java/BranchingFunCalls/Android.mk b/tests/lldb/java/BranchingFunCalls/Android.mk deleted file mode 100644 index 94f9d6fb..00000000 --- a/tests/lldb/java/BranchingFunCalls/Android.mk +++ /dev/null @@ -1,17 +0,0 @@ -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE_TAGS := tests - -LOCAL_SRC_FILES := \ - $(call all-java-files-under, src) \ - $(call all-renderscript-files-under, src) - -LOCAL_PACKAGE_NAME := BranchingFunCalls -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_PRIVATE_PLATFORM_APIS := true - -LOCAL_RENDERSCRIPT_FLAGS := -g -O0 -target-api 0 - -include $(BUILD_PACKAGE) diff --git a/tests/lldb/java/BranchingFunCalls/AndroidManifest.xml b/tests/lldb/java/BranchingFunCalls/AndroidManifest.xml deleted file mode 100644 index fb83a04e..00000000 --- a/tests/lldb/java/BranchingFunCalls/AndroidManifest.xml +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.rs.branchingfuncalls"> - <uses-sdk android:minSdkVersion="21" /> - <application android:label="BranchingFunCalls" - android:hardwareAccelerated="true"> - <activity android:name="MainActivity"> - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> - </intent-filter> - </activity> - </application> -</manifest> - diff --git a/tests/lldb/java/BranchingFunCalls/res/layout/main_layout.xml b/tests/lldb/java/BranchingFunCalls/res/layout/main_layout.xml deleted file mode 100644 index 131c3b57..00000000 --- a/tests/lldb/java/BranchingFunCalls/res/layout/main_layout.xml +++ /dev/null @@ -1,15 +0,0 @@ -<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:background="#0099cc" - tools:context=".MainActivity"> - - <ImageView - android:id="@+id/imageView" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:scaleType="fitCenter" /> - -</FrameLayout> - diff --git a/tests/lldb/java/BranchingFunCalls/src/com/android/rs/branchingfuncalls/MainActivity.java b/tests/lldb/java/BranchingFunCalls/src/com/android/rs/branchingfuncalls/MainActivity.java deleted file mode 100644 index a2c1f824..00000000 --- a/tests/lldb/java/BranchingFunCalls/src/com/android/rs/branchingfuncalls/MainActivity.java +++ /dev/null @@ -1,63 +0,0 @@ -/* -* Copyright (C) 2016 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -package com.android.rs.branchingfuncalls; - -import android.app.Activity; -import android.os.Bundle; -import android.renderscript.*; - -public class MainActivity extends Activity { - private RenderScript mRS; - private Allocation mInAllocation; - private Allocation mOutAllocation; - private ScriptC_scalars mScript; - private int mAllocSize = 256; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - setContentView(R.layout.main_layout); - createScript(); - runScript(); - } - - private void createScript() { - mRS = RenderScript.create(this, - RenderScript.ContextType.NORMAL, - RenderScript.CREATE_FLAG_LOW_LATENCY | - RenderScript.CREATE_FLAG_WAIT_FOR_ATTACH); - - Element e = Element.I32(mRS); - mInAllocation = Allocation.createSized(mRS, e, mAllocSize); - mOutAllocation = Allocation.createSized(mRS, e, mAllocSize); - - mScript = new ScriptC_scalars(mRS); - } - - private void runScript() { - mScript.invoke_addToGlobal(234); - - int[] init = new int[mAllocSize]; - for(int i = 0; i < mAllocSize; ++i) { - init[i] = i - (mAllocSize / 2); - } - mInAllocation.copy1DRangeFrom(0, mAllocSize, init); - mScript.forEach_simple_kernel(mInAllocation, mOutAllocation); - } -} - diff --git a/tests/lldb/java/BranchingFunCalls/src/rs/scalars.rscript b/tests/lldb/java/BranchingFunCalls/src/rs/scalars.rscript deleted file mode 100644 index 7206330d..00000000 --- a/tests/lldb/java/BranchingFunCalls/src/rs/scalars.rscript +++ /dev/null @@ -1,76 +0,0 @@ -/* -* Copyright (C) 2016 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#pragma version(1) -#pragma rs java_package_name(com.android.rs.branchingfuncalls) - -static bool is_neg(int a) -{ - if(a < 0) - return true; - else - return false; -} - -static bool is_pos(int a) -{ - if(a > 0) - return true; - else - return false; -} - -static void set_i(int * a, int b) -{ - int tmp = b; - *a = tmp; -} - -static void modify_f(float * f) -{ - *f *= 0.5f; -} - -static void modify_i(int * i) -{ - int j = *i; - int cutoff = 2 << 6; - if(j > cutoff) - j = cutoff; - if(is_neg(j)) - set_i(i, 0); - else if(is_pos(j)) - set_i(i, j); - else - set_i(i, cutoff); -} - -int __attribute__((kernel)) simple_kernel(int in) -{ - int i = in; - float f = (float) i; - modify_f(&f); - modify_i(&i); - int ret = (int) f; - return in * ret; -} - -int glob = 123; - -void addToGlobal(int arg) -{ - glob += arg; -} diff --git a/tests/lldb/java/DebugWaitAttach/Android.mk b/tests/lldb/java/DebugWaitAttach/Android.mk deleted file mode 100644 index 3486b780..00000000 --- a/tests/lldb/java/DebugWaitAttach/Android.mk +++ /dev/null @@ -1,15 +0,0 @@ -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE_TAGS := tests - -LOCAL_SRC_FILES := $(call all-java-files-under, src) $(call all-renderscript-files-under, src) - -LOCAL_PACKAGE_NAME := JavaDebugWaitAttach -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_PRIVATE_PLATFORM_APIS := true - -LOCAL_RENDERSCRIPT_FLAGS := -g -O0 -target-api 0 - -include $(BUILD_PACKAGE) diff --git a/tests/lldb/java/DebugWaitAttach/AndroidManifest.xml b/tests/lldb/java/DebugWaitAttach/AndroidManifest.xml deleted file mode 100644 index 862af289..00000000 --- a/tests/lldb/java/DebugWaitAttach/AndroidManifest.xml +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.rs.waitattachdebug"> - <uses-sdk android:minSdkVersion="21" /> - <application android:label="JavaDebugWaitAttach" - android:hardwareAccelerated="true"> - <activity android:name="MainActivity"> - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> - </intent-filter> - </activity> - </application> -</manifest> diff --git a/tests/lldb/java/DebugWaitAttach/res/layout/main_layout.xml b/tests/lldb/java/DebugWaitAttach/res/layout/main_layout.xml deleted file mode 100644 index 4ef172f3..00000000 --- a/tests/lldb/java/DebugWaitAttach/res/layout/main_layout.xml +++ /dev/null @@ -1,14 +0,0 @@ -<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:background="#0099cc" - tools:context=".MainActivity"> - - <ImageView - android:id="@+id/imageView" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:scaleType="fitCenter" /> - -</FrameLayout> diff --git a/tests/lldb/java/DebugWaitAttach/src/com/android/rs/waitattachdebug/MainActivity.java b/tests/lldb/java/DebugWaitAttach/src/com/android/rs/waitattachdebug/MainActivity.java deleted file mode 100644 index 3aeefd3b..00000000 --- a/tests/lldb/java/DebugWaitAttach/src/com/android/rs/waitattachdebug/MainActivity.java +++ /dev/null @@ -1,72 +0,0 @@ -/* -* Copyright (C) 2016 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -package com.android.rs.waitattachdebug; - -import android.app.Activity; -import android.graphics.Bitmap; -import android.os.Bundle; -import android.widget.ImageView; -import android.renderscript.*; - -public class MainActivity extends Activity { - private Bitmap mBitmapIn; - private Bitmap mBitmapOut; - private ImageView mImageView; - - private RenderScript mRS; - private Allocation mInAllocation; - private Allocation mOutAllocation; - private ScriptC_simple mScript; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - setContentView(R.layout.main_layout); - - mBitmapIn = Bitmap.createBitmap(8, 8, Bitmap.Config.ARGB_8888); - mBitmapOut = Bitmap.createBitmap(mBitmapIn.getWidth(), - mBitmapIn.getHeight(), mBitmapIn.getConfig()); - - mImageView = findViewById(R.id.imageView); - mImageView.setImageBitmap(mBitmapOut); - - createScript(); - updateImage(1.0f); - } - - private void createScript() { - mRS = RenderScript.create(this, - RenderScript.ContextType.NORMAL, - RenderScript.CREATE_FLAG_LOW_LATENCY | - RenderScript.CREATE_FLAG_WAIT_FOR_ATTACH); - - mInAllocation = Allocation.createFromBitmap(mRS, mBitmapIn); - mOutAllocation = Allocation.createFromBitmap(mRS, mBitmapOut); - - mScript = new ScriptC_simple(mRS); - } - - - private void updateImage(final float f) { - mScript.set_gColor(new Float4(0.9f, 0.8f, 0.5f, 1.0f)); - mScript.forEach_simple_kernel(mInAllocation, mOutAllocation); - mOutAllocation.copyTo(mBitmapOut); - mScript.forEach_other_kernel(mInAllocation, mOutAllocation); - } -} - diff --git a/tests/lldb/java/DebugWaitAttach/src/rs/simple.rscript b/tests/lldb/java/DebugWaitAttach/src/rs/simple.rscript deleted file mode 100644 index 6b564c0f..00000000 --- a/tests/lldb/java/DebugWaitAttach/src/rs/simple.rscript +++ /dev/null @@ -1,39 +0,0 @@ -/* -* Copyright (C) 2016 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#pragma version(1) -#pragma rs java_package_name(com.android.rs.waitattachdebug) - -float4 gColor = {0.299f, 0.587f, 0.114f, 1.f}; - -/* RenderScript kernel that just sets the colour of the screen and does some - * simple operations so it is not completely empty - * (and can therefore be debugged). - */ -uchar4 __attribute__((kernel)) simple_kernel(uchar4 in) -{ - float4 temp = rsUnpackColor8888(in); - temp = gColor; - uchar4 result = rsPackColorTo8888(temp); - return result; -} - -// Extra kernel to test lldb setting breakpoints on all the RS kernels. -uchar4 __attribute__((kernel)) other_kernel(uchar4 in) -{ - uchar4 result = in.wzyx; - return result; -} diff --git a/tests/lldb/java/InfiniteLoop/Android.mk b/tests/lldb/java/InfiniteLoop/Android.mk deleted file mode 100644 index 02e27908..00000000 --- a/tests/lldb/java/InfiniteLoop/Android.mk +++ /dev/null @@ -1,15 +0,0 @@ -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE_TAGS := tests - -LOCAL_SRC_FILES := $(call all-java-files-under, src) $(call all-renderscript-files-under, src) - -LOCAL_PACKAGE_NAME := JavaInfiniteLoop -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_SDK_VERSION := current - -LOCAL_RENDERSCRIPT_FLAGS := -g -O0 -target-api 0 - -include $(BUILD_PACKAGE) diff --git a/tests/lldb/java/InfiniteLoop/AndroidManifest.xml b/tests/lldb/java/InfiniteLoop/AndroidManifest.xml deleted file mode 100644 index ba846cde..00000000 --- a/tests/lldb/java/InfiniteLoop/AndroidManifest.xml +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.rs.infiniteloop"> - <uses-sdk android:minSdkVersion="21" /> - <application android:label="InfiniteLoop" - android:hardwareAccelerated="true"> - - <activity android:name="MainActivity"> - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> - </intent-filter> - </activity> - </application> -</manifest> diff --git a/tests/lldb/java/InfiniteLoop/res/layout/main_layout.xml b/tests/lldb/java/InfiniteLoop/res/layout/main_layout.xml deleted file mode 100755 index 4ef172f3..00000000 --- a/tests/lldb/java/InfiniteLoop/res/layout/main_layout.xml +++ /dev/null @@ -1,14 +0,0 @@ -<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:background="#0099cc" - tools:context=".MainActivity"> - - <ImageView - android:id="@+id/imageView" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:scaleType="fitCenter" /> - -</FrameLayout> diff --git a/tests/lldb/java/InfiniteLoop/src/com/android/rs/infiniteloop/MainActivity.java b/tests/lldb/java/InfiniteLoop/src/com/android/rs/infiniteloop/MainActivity.java deleted file mode 100644 index 7243cc50..00000000 --- a/tests/lldb/java/InfiniteLoop/src/com/android/rs/infiniteloop/MainActivity.java +++ /dev/null @@ -1,174 +0,0 @@ -/* -* Copyright (C) 2016 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -package com.android.rs.infiniteloop; - -import android.app.Activity; -import android.graphics.Bitmap; -import android.os.AsyncTask; -import android.os.Bundle; -import android.widget.ImageView; -import android.renderscript.*; - -import java.util.Random; -import java.util.Timer; -import java.util.TimerTask; - -public class MainActivity extends Activity { - /* Number of bitmaps that are used for renderScript thread and UI thread synchronization. - Ideally, this can be reduced to 2, however in some devices, 2 buffers still showing tearing on UI. - */ - private final int NUM_BITMAPS = 3; - private int mCurrentBitmap = 0; - private Bitmap mBitmapIn; - private Bitmap[] mBitmapsOut; - private ImageView mImageView; - private Random mRand; - - private RenderScript mRS; - private Allocation mInAllocation; - private Allocation[] mOutAllocations; - private ScriptC_infiniteloop mScript; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - setContentView(R.layout.main_layout); - mRand = new Random(); - - /* - * Initialize UI - */ - mBitmapIn = Bitmap.createBitmap(500, 500, Bitmap.Config.ARGB_8888); - mBitmapsOut = new Bitmap[NUM_BITMAPS]; - for (int i = 0; i < NUM_BITMAPS; ++i) { - mBitmapsOut[i] = Bitmap.createBitmap(mBitmapIn.getWidth(), - mBitmapIn.getHeight(), mBitmapIn.getConfig()); - } - - mImageView = findViewById(R.id.imageView); - mImageView.setImageBitmap(mBitmapsOut[mCurrentBitmap]); - mCurrentBitmap += (mCurrentBitmap + 1) % NUM_BITMAPS; - - /* - * Create renderScript - */ - createScript(); - - /* - * Invoke renderScript kernel and update imageView - */ - updateImage(1.0f); - - Timer t = new Timer(); - t.schedule(new TimerTask() { - @Override - public void run() { - updateImage(1.f); - } - }, 2000, 2000); - } - - /* - * Initialize RenderScript - * In the sample, it creates RenderScript kernel that performs saturation manipulation. - */ - private void createScript() { - // Initialize RS - mRS = RenderScript.create(this, - RenderScript.ContextType.NORMAL, - RenderScript.CREATE_FLAG_LOW_LATENCY); - - // Allocate buffers - mInAllocation = Allocation.createFromBitmap(mRS, mBitmapIn); - mOutAllocations = new Allocation[NUM_BITMAPS]; - for (int i = 0; i < NUM_BITMAPS; ++i) { - mOutAllocations[i] = Allocation.createFromBitmap(mRS, mBitmapsOut[i]); - } - - // Load script - mScript = new ScriptC_infiniteloop(mRS); - } - - /* - * In the AsyncTask, it invokes a simple RenderScript kernel. - * After the kernel is done, an operation blocks at Allocation.copyTo() in AsyncTask thread. - * Once operations are finished and we reach onPostExecute() in the UI thread, - * it can invalidate and update the ImageView UI. - */ - private class RenderScriptTask extends AsyncTask<Float, Integer, Integer> { - Boolean issued = false; - - protected Integer doInBackground(Float... values) { - int index = -1; - if (isCancelled() == false) { - issued = true; - index = mCurrentBitmap; - - /* - * Set global variable in RS - */ - mScript.set_gColour(new Float4(mRand.nextFloat(), mRand.nextFloat(), - mRand.nextFloat(), 1.f)); - - /* - * Invoke saturation filter kernel - */ - mScript.forEach_simple_kernel(mInAllocation, mOutAllocations[index]); - - /* - * Copy to bitmap and invalidate image view - */ - mOutAllocations[index].copyTo(mBitmapsOut[index]); - mCurrentBitmap = (mCurrentBitmap + 1) % NUM_BITMAPS; - } - return index; - } - - void updateView(Integer result) { - if (result != -1) { - // Request UI update - mImageView.setImageBitmap(mBitmapsOut[result]); - mImageView.invalidate(); - } - } - - protected void onPostExecute(Integer result) { - updateView(result); - } - - protected void onCancelled(Integer result) { - if (issued) { - updateView(result); - } - } - } - - RenderScriptTask currentTask = null; - - /* - * Invoke AsyncTask and cancel the previous task. - * When AsyncTasks are piled up (typically in slow device with heavy kernel), - * only the latest (and already started) task invokes RenderScript operation. - */ - private void updateImage(final float f) { - if (currentTask != null) - currentTask.cancel(false); - currentTask = new RenderScriptTask(); - currentTask.execute(f); - } -} diff --git a/tests/lldb/java/InfiniteLoop/src/com/android/rs/infiniteloop/infiniteloop.rscript b/tests/lldb/java/InfiniteLoop/src/com/android/rs/infiniteloop/infiniteloop.rscript deleted file mode 100644 index 5042ebfa..00000000 --- a/tests/lldb/java/InfiniteLoop/src/com/android/rs/infiniteloop/infiniteloop.rscript +++ /dev/null @@ -1,49 +0,0 @@ -/* -* Copyright (C) 2016 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* - * Copyright (C) 2014 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma version(1) -#pragma rs java_package_name(com.android.rs.infiniteloop) -#pragma rs_fp_relaxed - -float4 gColour = {0.299f, 0.587f, 0.114f, 1.f}; - -/* RenderScript kernel that just sets the colour of the screen and does some - * simple operations so it is not completely empty - * (and can therefore be debugged). - */ -uchar4 __attribute__((kernel)) simple_kernel(uchar4 in) -{ - float4 temp = rsUnpackColor8888(in); - temp = gColour; - uchar4 result = rsPackColorTo8888(temp); - return result; -} diff --git a/tests/lldb/java/KernelVariables/Android.mk b/tests/lldb/java/KernelVariables/Android.mk deleted file mode 100644 index c642a9d0..00000000 --- a/tests/lldb/java/KernelVariables/Android.mk +++ /dev/null @@ -1,15 +0,0 @@ -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE_TAGS := tests - -LOCAL_SRC_FILES := $(call all-java-files-under, src) $(call all-renderscript-files-under, src) - -LOCAL_PACKAGE_NAME := KernelVariables -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_PRIVATE_PLATFORM_APIS := true - -LOCAL_RENDERSCRIPT_FLAGS := -g -O0 -target-api 0 - -include $(BUILD_PACKAGE) diff --git a/tests/lldb/java/KernelVariables/AndroidManifest.xml b/tests/lldb/java/KernelVariables/AndroidManifest.xml deleted file mode 100644 index a1e2a746..00000000 --- a/tests/lldb/java/KernelVariables/AndroidManifest.xml +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.rs.kernelvariables"> - <uses-sdk android:minSdkVersion="21" /> - <application android:label="KernelVariables" - android:hardwareAccelerated="true"> - <activity android:name="MainActivity"> - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> - </intent-filter> - </activity> - </application> -</manifest> - diff --git a/tests/lldb/java/KernelVariables/res/layout/main_layout.xml b/tests/lldb/java/KernelVariables/res/layout/main_layout.xml deleted file mode 100644 index 131c3b57..00000000 --- a/tests/lldb/java/KernelVariables/res/layout/main_layout.xml +++ /dev/null @@ -1,15 +0,0 @@ -<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:background="#0099cc" - tools:context=".MainActivity"> - - <ImageView - android:id="@+id/imageView" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:scaleType="fitCenter" /> - -</FrameLayout> - diff --git a/tests/lldb/java/KernelVariables/src/com/android/rs/kernelvariables/MainActivity.java b/tests/lldb/java/KernelVariables/src/com/android/rs/kernelvariables/MainActivity.java deleted file mode 100644 index 728b872d..00000000 --- a/tests/lldb/java/KernelVariables/src/com/android/rs/kernelvariables/MainActivity.java +++ /dev/null @@ -1,110 +0,0 @@ -/* -* Copyright (C) 2016 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -package com.android.rs.kernelvariables; - -import android.app.Activity; -import android.graphics.Bitmap; -import android.graphics.ImageFormat; -import android.os.Bundle; -import android.widget.ImageView; -import android.renderscript.*; - -public class MainActivity extends Activity { - private Bitmap mBitmapIn; - private Bitmap mBitmapOut; - private ImageView mImageView; - - private RenderScript mRS; - private Allocation mInAllocation; - private Allocation mOutAllocation; - private ScriptC_simple mScript; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - setContentView(R.layout.main_layout); - - mBitmapIn = Bitmap.createBitmap(500, 500, Bitmap.Config.ARGB_8888); - mBitmapOut = Bitmap.createBitmap(mBitmapIn.getWidth(), - mBitmapIn.getHeight(), mBitmapIn.getConfig()); - - mImageView = findViewById(R.id.imageView); - mImageView.setImageBitmap(mBitmapOut); - - createScript(); - updateImage(); - } - - private void createScript() { - mRS = RenderScript.create(this, - RenderScript.ContextType.NORMAL, - RenderScript.CREATE_FLAG_LOW_LATENCY | - RenderScript.CREATE_FLAG_WAIT_FOR_ATTACH); - - mInAllocation = Allocation.createFromBitmap(mRS, mBitmapIn); - mOutAllocation = Allocation.createFromBitmap(mRS, mBitmapOut); - - mScript = new ScriptC_simple(mRS); - } - - private void updateImage() { - int[] buffer_int = {1, 2, 3, 4}; - Allocation int_allocation = Allocation.createSized(mRS, Element.I32(mRS), 4); - int_allocation.copyFrom(buffer_int); - mScript.set_allocation_1D_global(int_allocation); - - int[] buffer_int2 = {5, 6, 7, 8}; - - Type.Builder typeI32Builder2D = new Type.Builder(mRS, Element.I32(mRS)); - typeI32Builder2D.setX(2); - typeI32Builder2D.setY(2); - - Allocation int_allocation2 = Allocation.createTyped(mRS, typeI32Builder2D.create()); - int_allocation2.copyFrom(buffer_int2); - mScript.set_allocation_1D_global2(int_allocation2); - - mScript.set_allocation_2D_global(mInAllocation); - mScript.set_allocation_2D_global2(mOutAllocation); - - int[] buffer_int3 = new int[64]; - - for (int i=0; i<4*4*4; ++i) - buffer_int3[i] = 9 + i; - - Type.Builder typeI32Builder3D = new Type.Builder(mRS, Element.I32(mRS)); - typeI32Builder3D.setX(4); - typeI32Builder3D.setY(4); - typeI32Builder3D.setZ(4); - - Allocation int_allocation3 = Allocation.createTyped(mRS, typeI32Builder3D.create()); - int_allocation3.copyFrom(buffer_int3); - mScript.set_allocation_3D_global(int_allocation3); - - Type.Builder yuvTypeBuilder = new Type.Builder(mRS, Element.YUV(mRS)); - yuvTypeBuilder.setX(4); - yuvTypeBuilder.setY(4); - yuvTypeBuilder.setYuvFormat(ImageFormat.YV12); - Allocation yuv_allocation = Allocation.createTyped(mRS, yuvTypeBuilder.create()); - mScript.set_allocation_YUV_2D_global(yuv_allocation); - - mScript.set_sampler_global(Sampler.CLAMP_LINEAR(mRS)); - - mScript.forEach_kernel(mInAllocation, mOutAllocation); - mOutAllocation.copyTo(mBitmapOut); - } -} diff --git a/tests/lldb/java/KernelVariables/src/rs/simple.rscript b/tests/lldb/java/KernelVariables/src/rs/simple.rscript deleted file mode 100644 index 26b6affc..00000000 --- a/tests/lldb/java/KernelVariables/src/rs/simple.rscript +++ /dev/null @@ -1,197 +0,0 @@ -/* -* Copyright (C) 2016 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#pragma version(1) -#pragma rs java_package_name(com.android.rs.kernelvariables) - -char char_global = 12; -uchar uchar_global = 234; -short short_global = -321; -ushort ushort_global = 432; -int int_global = 1234; -uint uint_global = 2345; -float float_global = 4.5f; -long long_global = -77777; -ulong ulong_global = 8888; -double double_global = -456.5f; - -char2 char2_global = {11, -22}; -uchar2 uchar2_global = {33, 44}; -short2 short2_global = {-555, 666}; -ushort2 ushort2_global = {777, 888}; -int2 int2_global = {999, -1111}; -uint2 uint2_global = {2222, 3333}; -float2 float2_global = {4.5f, -5.0f}; -long2 long2_global = {-4444, 5555}; -ulong2 ulong2_global = {6666, 7777}; -double2 double2_global = {88.5f, -99.0f}; - -char3 char3_global = {11, -22, -33}; -uchar3 uchar3_global = {33, 44, 55}; -short3 short3_global = {-555, 666, 777}; -ushort3 ushort3_global = {777, 888, 999}; -int3 int3_global = {999, -1111, 2222}; -uint3 uint3_global = {2222, 3333, 4444}; -float3 float3_global = {4.5f, -5.0f, -6.5f}; -long3 long3_global = {-4444, 5555, 6666}; -ulong3 ulong3_global = {6666, 7777, 8888}; -double3 double3_global = {88.5f, -99.0f, 111.5f}; - -char4 char4_global = {55, 11, -22, -33}; -uchar4 uchar4_global = {222, 33, 44, 55}; -short4 short4_global = {-444, -555, 666, 777}; -ushort4 ushort4_global = {666, 777, 888, 999}; -int4 int4_global = {888, 999, -1111, 2222}; -uint4 uint4_global = {1111, 2222, 3333, 4444}; -float4 float4_global = {3.0f, 4.5f, -5.0f, -6.5f}; -long4 long4_global = {-3333, -4444, 5555, 6666}; -ulong4 ulong4_global = {5555, 6666, 7777, 8888}; -double4 double4_global = {-77.0f, 88.5f, -99.0f, 111.5f}; - -rs_matrix2x2 matrix2x2_global; -rs_matrix3x3 matrix3x3_global; -rs_matrix4x4 matrix4x4_global; - -rs_quaternion quaternion_global; - -rs_allocation allocation_1D_global; -rs_allocation allocation_1D_global2; -rs_allocation allocation_2D_global; -rs_allocation allocation_2D_global2; -rs_allocation allocation_3D_global; -rs_allocation allocation_YUV_2D_global; - -rs_allocation_cubemap_face cubemap_face_global; -rs_sampler sampler_global; - -uchar4 __attribute__((kernel)) kernel(uchar4 in) -{ - char char_local = 'a'; - uchar uchar_local = 'b'; - short short_local = -321; - ushort ushort_local = 432; - int int_local = 1234; - uint uint_local = 2345; - float float_local = 4.5f; - long long_local = -77777; - ulong ulong_local = 8888; - double double_local = -456.5f; - - char2 char2_local = {-11, -22}; - uchar2 uchar2_local = {33, 44}; - short2 short2_local = {-555, 666}; - ushort2 ushort2_local = {777, 888}; - int2 int2_local = {999, -1111}; - uint2 uint2_local = {2222, 3333}; - float2 float2_local = {4.5f, -5.0f}; - long2 long2_local = {-4444, 5555}; - ulong2 ulong2_local = {6666, 7777}; - double2 double2_local = {88.5f, -99.0f}; - - char3 char3_local = {11, -22, -33}; - uchar3 uchar3_local = {33, 44, 55}; - short3 short3_local = {-555, 666, 777}; - ushort3 ushort3_local = {777, 888, 999}; - int3 int3_local = {999, -1111, 2222}; - uint3 uint3_local = {2222, 3333, 4444}; - float3 float3_local = {4.5f, -5.0f, -6.5f}; - long3 long3_local = {-4444, 5555, 6666}; - ulong3 ulong3_local = {6666, 7777, 8888}; - double3 double3_local = {88.5f, -99.0f, 111.5f}; - - char4 char4_local = {55, 11, -22, -33}; - uchar4 uchar4_local = {22, 33, 44, 55}; - short4 short4_local = {-444, -555, 666, 777}; - ushort4 ushort4_local = {666, 777, 888, 999}; - int4 int4_local = {888, 999, -1111, 2222}; - uint4 uint4_local = {1111, 2222, 3333, 4444}; - float4 float4_local = {3.0f, 4.5f, -5.0f, -6.5f}; - long4 long4_local = {-3333, -4444, 5555, 6666}; - ulong4 ulong4_local = {5555, 6666, 7777, 8888}; - double4 double4_local = {-77.0f, 88.5f, -99.0f, 111.5f}; - - rs_matrix2x2 matrix2x2_local = {{1., 2.5, - 3., 4.5}}; - rs_matrix3x3 matrix3x3_local = {{5., 6.5, 7., - 8.5, 9., 1.5, - 2., 3.5, 4.}}; - rs_matrix4x4 matrix4x4_local = {{5.5, 6., 7.5, 8., - 9., 1.5, 2., 3.5, - 4.5, 5.5, 6.5, 7., - 8., 9.5, 1.5, 2.5}}; - - matrix2x2_global = matrix2x2_local; - matrix3x3_global = matrix3x3_local; - matrix4x4_global = matrix4x4_local; - - rsQuaternionSet(&quaternion_global, 3.0, 4.5, 5.5, 6.0); - - rs_quaternion quaternion_local; - rsQuaternionSet(&quaternion_local, 7.5, 8.0, 9.0, 0.5); - - char char_combined = char_local + (char)uchar_local + char2_local.x + - (char)uchar2_local.x + char3_local.x - (char)uchar3_local.x + - char4_local.x + (char)uchar4_local.x; - - short short_combined = short_local + (short)ushort_local + short2_local.x + - (short)ushort2_local.x + short3_local.x + (short)ushort3_local.x + - short4_local.x + (short)ushort4_local.x; - - int int_combined = int_local + (int)uint_local + int2_local.x + - (int)uint2_local.x + int3_local.x + (int)uint3_local.x + int4_local.x + - (int)uint4_local.x; - - float float_combined = float_local + float2_local.x + float3_local.x + - float4_local.x; - - long long_combined = long_local + (long)ulong_local + long2_local.x + - (long)ulong2_local.x + long3_local.x + (long)ulong3_local.x + - long4_local.x + (long)ulong4_local.x; - - double double_combined = double_local + double2_local.x + double3_local.x + - double4_local.x; - - char_global = char_combined; - short_global = short_combined; - int_global = int_combined; - float_global = float_combined; - long_global = long_combined; - double_global = double_combined; - - uchar4 result = {1,2,3,4}; - return result; -} - -float use_constants_global; - -void setup(void) -{ - use_constants_global = - M_1_PI + - M_2_PI + - M_2_PIl + - M_2_SQRTPI + - M_E + - M_LN10 + - M_LN2 + - M_LOG10E + - M_LOG2E + - M_PI + - M_PI_2 + - M_PI_4 + - M_SQRT1_2 + - M_SQRT2; -} diff --git a/tests/lldb/java/MultipleRSFiles/Android.mk b/tests/lldb/java/MultipleRSFiles/Android.mk deleted file mode 100644 index b45cc517..00000000 --- a/tests/lldb/java/MultipleRSFiles/Android.mk +++ /dev/null @@ -1,15 +0,0 @@ -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE_TAGS := tests - -LOCAL_SRC_FILES := $(call all-java-files-under, src) $(call all-renderscript-files-under, src) - -LOCAL_PACKAGE_NAME := MultipleRSFiles -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_PRIVATE_PLATFORM_APIS := true - -LOCAL_RENDERSCRIPT_FLAGS := -g -O0 -target-api 0 - -include $(BUILD_PACKAGE) diff --git a/tests/lldb/java/MultipleRSFiles/AndroidManifest.xml b/tests/lldb/java/MultipleRSFiles/AndroidManifest.xml deleted file mode 100644 index 5a839012..00000000 --- a/tests/lldb/java/MultipleRSFiles/AndroidManifest.xml +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.rs.multiplersfiles"> - <uses-sdk android:minSdkVersion="21" /> - <application android:label="MultipleRSFiles" - android:hardwareAccelerated="true"> - <activity android:name="MainActivity"> - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> - </intent-filter> - </activity> - </application> -</manifest> diff --git a/tests/lldb/java/MultipleRSFiles/res/layout/main_layout.xml b/tests/lldb/java/MultipleRSFiles/res/layout/main_layout.xml deleted file mode 100644 index 4ef172f3..00000000 --- a/tests/lldb/java/MultipleRSFiles/res/layout/main_layout.xml +++ /dev/null @@ -1,14 +0,0 @@ -<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:background="#0099cc" - tools:context=".MainActivity"> - - <ImageView - android:id="@+id/imageView" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:scaleType="fitCenter" /> - -</FrameLayout> diff --git a/tests/lldb/java/MultipleRSFiles/src/com/android/rs/multiplersfiles/MainActivity.java b/tests/lldb/java/MultipleRSFiles/src/com/android/rs/multiplersfiles/MainActivity.java deleted file mode 100644 index 78954840..00000000 --- a/tests/lldb/java/MultipleRSFiles/src/com/android/rs/multiplersfiles/MainActivity.java +++ /dev/null @@ -1,74 +0,0 @@ -/* -* Copyright (C) 2016 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -package com.android.rs.multiplersfiles; - -import android.app.Activity; -import android.graphics.Bitmap; -import android.os.Bundle; -import android.widget.ImageView; -import android.renderscript.*; - -public class MainActivity extends Activity { - private Bitmap mBitmapIn; - private Bitmap mBitmapOut; - private ImageView mImageView; - - private RenderScript mRS; - private Allocation mInAllocation; - private Allocation mOutAllocation; - private ScriptC_first mFirstScript; - private ScriptC_second mSecondScript; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - setContentView(R.layout.main_layout); - - mBitmapIn = Bitmap.createBitmap(500, 500, Bitmap.Config.ARGB_8888); - mBitmapOut = Bitmap.createBitmap(mBitmapIn.getWidth(), - mBitmapIn.getHeight(), mBitmapIn.getConfig()); - - mImageView = findViewById(R.id.imageView); - mImageView.setImageBitmap(mBitmapOut); - - createScript(); - updateImage(1.0f); - } - - private void createScript() { - mRS = RenderScript.create(this, - RenderScript.ContextType.NORMAL, - RenderScript.CREATE_FLAG_LOW_LATENCY | - RenderScript.CREATE_FLAG_WAIT_FOR_ATTACH); - - mInAllocation = Allocation.createFromBitmap(mRS, mBitmapIn); - mOutAllocation = Allocation.createFromBitmap(mRS, mBitmapOut); - - mFirstScript = new ScriptC_first(mRS); - mSecondScript = new ScriptC_second(mRS); - } - - - private void updateImage(final float f) { - mFirstScript.set_gColor(new Float4(0.9f, 0.8f, 0.5f, 1.0f)); - mFirstScript.forEach_first_kernel(mInAllocation, mOutAllocation); - mOutAllocation.copyTo(mBitmapOut); - mSecondScript.forEach_second_kernel(mInAllocation, mOutAllocation); - } -} - diff --git a/tests/lldb/java/MultipleRSFiles/src/rs/first.rscript b/tests/lldb/java/MultipleRSFiles/src/rs/first.rscript deleted file mode 100644 index cbed426f..00000000 --- a/tests/lldb/java/MultipleRSFiles/src/rs/first.rscript +++ /dev/null @@ -1,32 +0,0 @@ -/* -* Copyright (C) 2016 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#pragma version(1) -#pragma rs java_package_name(com.android.rs.multiplersfiles) - -float4 gColor = {0.299f, 0.587f, 0.114f, 1.f}; - -/* RenderScript kernel that just sets the colour of the screen and does some - * simple operations so it is not completely empty - * (and can therefore be debugged). - */ -uchar4 __attribute__((kernel)) first_kernel(uchar4 in) -{ - float4 temp = rsUnpackColor8888(in); - temp = gColor; - uchar4 result = rsPackColorTo8888(temp); - return result; -} diff --git a/tests/lldb/java/MultipleRSFiles/src/rs/second.rscript b/tests/lldb/java/MultipleRSFiles/src/rs/second.rscript deleted file mode 100644 index c87d7ae0..00000000 --- a/tests/lldb/java/MultipleRSFiles/src/rs/second.rscript +++ /dev/null @@ -1,25 +0,0 @@ -/* -* Copyright (C) 2016 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#pragma version(1) -#pragma rs java_package_name(com.android.rs.multiplersfiles) - -/* RenderScript kernel that just returns the swizzled input. */ -uchar4 __attribute__((kernel)) second_kernel(uchar4 in) -{ - uchar4 result = in.wzyx; - return result; -} diff --git a/tests/lldb/java/NoDebugWaitAttach/Android.mk b/tests/lldb/java/NoDebugWaitAttach/Android.mk deleted file mode 100644 index 355ffb74..00000000 --- a/tests/lldb/java/NoDebugWaitAttach/Android.mk +++ /dev/null @@ -1,13 +0,0 @@ -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE_TAGS := tests - -LOCAL_SRC_FILES := $(call all-java-files-under, src) $(call all-renderscript-files-under, src) - -LOCAL_PACKAGE_NAME := JavaNoDebugWaitAttach -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_PRIVATE_PLATFORM_APIS := true - -include $(BUILD_PACKAGE) diff --git a/tests/lldb/java/NoDebugWaitAttach/AndroidManifest.xml b/tests/lldb/java/NoDebugWaitAttach/AndroidManifest.xml deleted file mode 100644 index dbc31a54..00000000 --- a/tests/lldb/java/NoDebugWaitAttach/AndroidManifest.xml +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.rs.waitattachnodebug"> - <uses-sdk android:minSdkVersion="21" /> - <application android:label="JavaNoDebugWaitAttach" - android:hardwareAccelerated="true"> - <activity android:name="MainActivity"> - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> - </intent-filter> - </activity> - </application> -</manifest> diff --git a/tests/lldb/java/NoDebugWaitAttach/res/layout/main_layout.xml b/tests/lldb/java/NoDebugWaitAttach/res/layout/main_layout.xml deleted file mode 100644 index 4ef172f3..00000000 --- a/tests/lldb/java/NoDebugWaitAttach/res/layout/main_layout.xml +++ /dev/null @@ -1,14 +0,0 @@ -<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:background="#0099cc" - tools:context=".MainActivity"> - - <ImageView - android:id="@+id/imageView" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:scaleType="fitCenter" /> - -</FrameLayout> diff --git a/tests/lldb/java/NoDebugWaitAttach/src/com/android/rs/waitattachnodebug/MainActivity.java b/tests/lldb/java/NoDebugWaitAttach/src/com/android/rs/waitattachnodebug/MainActivity.java deleted file mode 100644 index a43b387e..00000000 --- a/tests/lldb/java/NoDebugWaitAttach/src/com/android/rs/waitattachnodebug/MainActivity.java +++ /dev/null @@ -1,71 +0,0 @@ -/* -* Copyright (C) 2016 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -package com.android.rs.waitattachnodebug; - -import android.app.Activity; -import android.graphics.Bitmap; -import android.os.Bundle; -import android.widget.ImageView; -import android.renderscript.*; - -public class MainActivity extends Activity { - private Bitmap mBitmapIn; - private Bitmap mBitmapOut; - private ImageView mImageView; - - private RenderScript mRS; - private Allocation mInAllocation; - private Allocation mOutAllocation; - private ScriptC_simple mScript; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - setContentView(R.layout.main_layout); - - mBitmapIn = Bitmap.createBitmap(8, 8, Bitmap.Config.ARGB_8888); - mBitmapOut = Bitmap.createBitmap(mBitmapIn.getWidth(), - mBitmapIn.getHeight(), mBitmapIn.getConfig()); - - mImageView = findViewById(R.id.imageView); - mImageView.setImageBitmap(mBitmapOut); - - createScript(); - updateImage(1.0f); - } - - private void createScript() { - mRS = RenderScript.create(this, - RenderScript.ContextType.NORMAL, - RenderScript.CREATE_FLAG_LOW_LATENCY | - RenderScript.CREATE_FLAG_WAIT_FOR_ATTACH); - - mInAllocation = Allocation.createFromBitmap(mRS, mBitmapIn); - mOutAllocation = Allocation.createFromBitmap(mRS, mBitmapOut); - - mScript = new ScriptC_simple(mRS); - } - - - private void updateImage(final float f) { - mScript.set_gColor(new Float4(0.9f, 0.8f, 0.5f, 1.0f)); - mScript.forEach_simple_kernel(mInAllocation, mOutAllocation); - mOutAllocation.copyTo(mBitmapOut); - } -} - diff --git a/tests/lldb/java/NoDebugWaitAttach/src/rs/simple.rscript b/tests/lldb/java/NoDebugWaitAttach/src/rs/simple.rscript deleted file mode 100644 index 6652675c..00000000 --- a/tests/lldb/java/NoDebugWaitAttach/src/rs/simple.rscript +++ /dev/null @@ -1,33 +0,0 @@ -/* -* Copyright (C) 2016 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#pragma version(1) -#pragma rs java_package_name(com.android.rs.waitattachnodebug) - -float4 gColor = {0.299f, 0.587f, 0.114f, 1.f}; - -/* RenderScript kernel that just sets the colour of the screen and does some - * simple operations so it is not completely empty - * (and can therefore be debugged). - */ -uchar4 __attribute__((kernel)) simple_kernel(uchar4 in) -{ - float4 temp = rsUnpackColor8888(in); - temp = gColor; - uchar4 result = rsPackColorTo8888(temp); - return result; -} - diff --git a/tests/lldb/java/Reduction/Android.mk b/tests/lldb/java/Reduction/Android.mk deleted file mode 100644 index 6e71659d..00000000 --- a/tests/lldb/java/Reduction/Android.mk +++ /dev/null @@ -1,31 +0,0 @@ -# -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE_TAGS := tests - -LOCAL_SRC_FILES := $(call all-java-files-under, src) $(call all-renderscript-files-under, src) - -LOCAL_RENDERSCRIPT_FLAGS := -target-api 0 -O0 -g - -LOCAL_PACKAGE_NAME := Reduction -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_PRIVATE_PLATFORM_APIS := true - -include $(BUILD_PACKAGE) diff --git a/tests/lldb/java/Reduction/AndroidManifest.xml b/tests/lldb/java/Reduction/AndroidManifest.xml deleted file mode 100644 index 61177d9e..00000000 --- a/tests/lldb/java/Reduction/AndroidManifest.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.rs.lldbreductiontest"> - <uses-sdk android:minSdkVersion="21" /> - <application android:label="Reduction"> - <activity android:name="MainActivity" android:screenOrientation="portrait"> - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> - </intent-filter> - </activity> - </application> -</manifest> diff --git a/tests/lldb/java/Reduction/src/com/android/rs/lldbreductiontest/MainActivity.java b/tests/lldb/java/Reduction/src/com/android/rs/lldbreductiontest/MainActivity.java deleted file mode 100644 index b10d5d28..00000000 --- a/tests/lldb/java/Reduction/src/com/android/rs/lldbreductiontest/MainActivity.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (C) 2016 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* This application is a simple scheduler for testing the lldb debugger - * implementation for general reduction kernels. - * - * It launches one of two simple reductions in a loop - */ - -package com.android.rs.lldbreductiontest; - -import android.app.Activity; -import android.content.Context; -import android.content.res.Resources; -import android.os.Handler; -import android.os.Bundle; -import android.util.Log; -import android.renderscript.*; - -import java.lang.Float; -import java.lang.Math; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Random; - -public class MainActivity extends Activity { - static private int idxOffset = 10; - static private int mX = 128; - static private int mY = 2; - static private int mZ = 2; - static private float mMultiplier = 2.f; - private RenderScript mRS; - private ScriptC_reduce mScript; - private ScriptC_reduce_auto_comb mScript_auto_comb; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - initRS(); - - int loopDelayMillis = 1000; - Handler loopHandler = new Handler(); - loopHandler.postDelayed(new Runnable() { - @Override - public void run() { - runRS(); - loopHandler.postDelayed(this, loopDelayMillis); - } - }, loopDelayMillis); - } - - private float findMinUserTypeAutoComb( - RenderScript rs, ScriptC_reduce_auto_comb s, Allocation alloc) { - s.set_a_startval(mX); - s.set_b_startval(mY); - s.set_multiplier(mMultiplier); - - return s.reduce_find_min_user_type_auto_comb(alloc).get(); - } - - private float findMinUserType(RenderScript rs, ScriptC_reduce s, Allocation alloc) { - s.set_a_startval(mX); - s.set_b_startval(mY); - s.set_multiplier(mMultiplier); - - return s.reduce_find_min_user_type(alloc).get(); - } - - private float findMinUserType1DAutoComb(RenderScript rs, ScriptC_reduce_auto_comb s, int xCount) { - ScriptField_MinUserType minUserType = new ScriptField_MinUserType(rs, xCount); - for (int i = 0; i < xCount; i++) { - ScriptField_MinUserType.Item val = new ScriptField_MinUserType.Item(); - val.a = i + idxOffset; - val.b = i + idxOffset; - minUserType.set(val, i, true); - } - - Allocation alloc = minUserType.getAllocation(); - - return findMinUserTypeAutoComb(rs, s, alloc); - } - - private float findMinUserType1D(RenderScript rs, ScriptC_reduce s, int xCount) { - ScriptField_MinUserType minUserType = new ScriptField_MinUserType(rs, xCount); - for (int i = 0; i < xCount; i++) { - ScriptField_MinUserType.Item val = new ScriptField_MinUserType.Item(); - val.a = i + idxOffset; - val.b = i + idxOffset; - minUserType.set(val, i, true); - } - - Allocation alloc = minUserType.getAllocation(); - - return findMinUserType(rs, s, alloc); - } - - public void initRS() { - mRS = RenderScript.create(this, RenderScript.ContextType.NORMAL, - RenderScript.CREATE_FLAG_LOW_LATENCY | RenderScript.CREATE_FLAG_WAIT_FOR_ATTACH); - mScript = new ScriptC_reduce(mRS); - mScript_auto_comb = new ScriptC_reduce_auto_comb(mRS); - } - - public void runRS() { - findMinUserType1D(mRS, mScript, mX); - findMinUserType1DAutoComb(mRS, mScript_auto_comb, mX); - } - - public void onDestroy() { - mRS.finish(); - mRS.destroy(); - } -} diff --git a/tests/lldb/java/Reduction/src/com/android/rs/lldbreductiontest/reduce.rscript b/tests/lldb/java/Reduction/src/com/android/rs/lldbreductiontest/reduce.rscript deleted file mode 100644 index c8fb088a..00000000 --- a/tests/lldb/java/Reduction/src/com/android/rs/lldbreductiontest/reduce.rscript +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (C) 2016 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* This application is a simple scheduler for testing the lldb debugger - * implementation for general reduction kernels. - * - * It launches one of two simple reductions in a loop - */ - -#pragma rs java_package_name(com.android.rs.lldbreductiontest) -#pragma version(1) -#pragma rs reduce(find_min_user_type) initializer(find_min_user_type_init) \ - accumulator(find_min_user_type_accum) \ - outconverter(find_min_user_type_outc) \ - combiner(find_min_user_type_comb) - -#define RSTESTS_USER_COMBINER -#include "reduce_common.rsh" diff --git a/tests/lldb/java/Reduction/src/com/android/rs/lldbreductiontest/reduce_auto_comb.rscript b/tests/lldb/java/Reduction/src/com/android/rs/lldbreductiontest/reduce_auto_comb.rscript deleted file mode 100644 index 5a9de904..00000000 --- a/tests/lldb/java/Reduction/src/com/android/rs/lldbreductiontest/reduce_auto_comb.rscript +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2016 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* This application is a simple scheduler for testing the lldb debugger - * implementation for general reduction kernels. - * - * It launches one of two simple reductions in a loop - */ - -#pragma rs java_package_name(com.android.rs.lldbreductiontest) -#pragma version(1) -#pragma rs reduce(find_min_user_type_auto_comb) \ - initializer(find_min_user_type_init) accumulator(find_min_user_type_accum) \ - outconverter(find_min_user_type_outc) \ - -#include "reduce_common.rsh" diff --git a/tests/lldb/java/Reduction/src/com/android/rs/lldbreductiontest/reduce_common.rsh b/tests/lldb/java/Reduction/src/com/android/rs/lldbreductiontest/reduce_common.rsh deleted file mode 100644 index 846d5302..00000000 --- a/tests/lldb/java/Reduction/src/com/android/rs/lldbreductiontest/reduce_common.rsh +++ /dev/null @@ -1,59 +0,0 @@ -/* -* Copyright (C) 2016 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -int __attribute__((kernel)) my_foreach_kernel(int a) { - // This kernel is unused, but we want to make sure it is not listed as a - // reduction kernel by the debugger - return a + 1; -} - -typedef struct MinUserType { - int32_t a; - int32_t b; -} user_t; - -int32_t b_startval; -int32_t a_startval; -float multiplier; - -static void find_min_user_type_init(user_t *alloc) { - alloc->a = a_startval; - alloc->b = b_startval; -} - -static void find_min_user_type_accum(user_t *accum, const user_t val) { - if (val.a + val.b * multiplier < accum->a + accum->b * multiplier) { - accum->a = val.a; - accum->b = val.b; - } -} - -// Combiners are autogenerated if the user has not defined the combiner. -// We specialise the tests for lldb's handling of this behaviour as well, -// generating two test apps from the same source. -// This combiner is equivalent to the accumulator. -#if defined(RSTESTS_USER_COMBINER) -static void find_min_user_type_comb(user_t *accum, const user_t *val) { - if (val->a + val->b * multiplier < accum->a + accum->b * multiplier) { - accum->a = val->a; - accum->b = val->b; - } -} -#endif - -static void find_min_user_type_outc(float *output, const user_t *val) { - *output = val->a + val->b * multiplier; -} diff --git a/tests/lldb/java/ScriptGroup/Android.mk b/tests/lldb/java/ScriptGroup/Android.mk deleted file mode 100644 index 18a1cd5e..00000000 --- a/tests/lldb/java/ScriptGroup/Android.mk +++ /dev/null @@ -1,15 +0,0 @@ -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE_TAGS := tests - -LOCAL_SRC_FILES := $(call all-java-files-under, src) $(call all-renderscript-files-under, src) - -LOCAL_PACKAGE_NAME := ScriptGroup -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_PRIVATE_PLATFORM_APIS := true - -LOCAL_RENDERSCRIPT_FLAGS := -g -O0 -target-api 0 - -include $(BUILD_PACKAGE) diff --git a/tests/lldb/java/ScriptGroup/AndroidManifest.xml b/tests/lldb/java/ScriptGroup/AndroidManifest.xml deleted file mode 100644 index 5288c746..00000000 --- a/tests/lldb/java/ScriptGroup/AndroidManifest.xml +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.rs.scriptgroup"> - <uses-sdk android:minSdkVersion="21" /> - <application android:label="scriptgroup" - android:hardwareAccelerated="true"> - <activity android:name="MainActivity"> - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> - </intent-filter> - </activity> - </application> -</manifest> diff --git a/tests/lldb/java/ScriptGroup/res/layout/main_layout.xml b/tests/lldb/java/ScriptGroup/res/layout/main_layout.xml deleted file mode 100644 index 4ef172f3..00000000 --- a/tests/lldb/java/ScriptGroup/res/layout/main_layout.xml +++ /dev/null @@ -1,14 +0,0 @@ -<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:background="#0099cc" - tools:context=".MainActivity"> - - <ImageView - android:id="@+id/imageView" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:scaleType="fitCenter" /> - -</FrameLayout> diff --git a/tests/lldb/java/ScriptGroup/src/com/android/rs/scriptgroup/MainActivity.java b/tests/lldb/java/ScriptGroup/src/com/android/rs/scriptgroup/MainActivity.java deleted file mode 100644 index 01e8a13d..00000000 --- a/tests/lldb/java/ScriptGroup/src/com/android/rs/scriptgroup/MainActivity.java +++ /dev/null @@ -1,65 +0,0 @@ -/* -* Copyright (C) 2016 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -package com.android.rs.scriptgroup; - -import android.app.Activity; -import android.graphics.Bitmap; -import android.os.Bundle; -import android.widget.ImageView; -import android.renderscript.*; - -public class MainActivity extends Activity { - private static final int ARRAY_SIZE = 8; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.main_layout); - - // create renderscript context - RenderScript pRS = RenderScript.create(this, RenderScript.ContextType.NORMAL, - RenderScript.CREATE_FLAG_WAIT_FOR_ATTACH | RenderScript.CREATE_FLAG_LOW_LATENCY); - - ScriptC_scriptgroup script = new ScriptC_scriptgroup(pRS); - - // create and initalize a simple input allocation - int[] array = new int[ARRAY_SIZE]; - for (int i = 0; i < ARRAY_SIZE; i++) { - array[i] = i; - } - Allocation input = Allocation.createSized(pRS, Element.I32(pRS), ARRAY_SIZE); - input.copyFrom(array); - - ScriptGroup.Builder2 builder = new ScriptGroup.Builder2(pRS); - - ScriptGroup.Input unbound = builder.addInput(); - - ScriptGroup.Closure c0 = builder.addKernel( - script.getKernelID_foo(), Type.createX(pRS, Element.I32(pRS), ARRAY_SIZE), unbound); - - ScriptGroup.Closure c1 = builder.addKernel(script.getKernelID_goo(), - Type.createX(pRS, Element.I32(pRS), ARRAY_SIZE), c0.getReturn()); - - ScriptGroup group = builder.create("scriptgroup_test", c1.getReturn()); - - int[] a = new int[ARRAY_SIZE]; - ((Allocation) group.execute(input)[0]).copyTo(a); - - pRS.finish(); - pRS.destroy(); - } -} diff --git a/tests/lldb/java/ScriptGroup/src/rs/scriptgroup.rscript b/tests/lldb/java/ScriptGroup/src/rs/scriptgroup.rscript deleted file mode 100644 index 29089e10..00000000 --- a/tests/lldb/java/ScriptGroup/src/rs/scriptgroup.rscript +++ /dev/null @@ -1,27 +0,0 @@ -/* -* Copyright (C) 2016 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#pragma version(1) -#pragma rs java_package_name(com.android.rs.scriptgroup) -#pragma rs_fp_full - -int __attribute__((kernel)) foo(int a) { - return a * a; -} - -int __attribute__((kernel)) goo(int a) { - return a + a; -} diff --git a/tests/lldb/java/SingleSource/Android.mk b/tests/lldb/java/SingleSource/Android.mk deleted file mode 100644 index 202c2a79..00000000 --- a/tests/lldb/java/SingleSource/Android.mk +++ /dev/null @@ -1,15 +0,0 @@ -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE_TAGS := tests - -LOCAL_SRC_FILES := $(call all-java-files-under, src) $(call all-renderscript-files-under, src) - -LOCAL_PACKAGE_NAME := SingleSource -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_PRIVATE_PLATFORM_APIS := true - -LOCAL_RENDERSCRIPT_FLAGS := -g -O0 -target-api 0 - -include $(BUILD_PACKAGE) diff --git a/tests/lldb/java/SingleSource/AndroidManifest.xml b/tests/lldb/java/SingleSource/AndroidManifest.xml deleted file mode 100644 index 8820c93c..00000000 --- a/tests/lldb/java/SingleSource/AndroidManifest.xml +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.rs.singlesource"> - <uses-sdk android:minSdkVersion="21" /> - <application android:label="SingleSource" - android:hardwareAccelerated="true"> - <activity android:name="MainActivity"> - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> - </intent-filter> - </activity> - </application> -</manifest> - diff --git a/tests/lldb/java/SingleSource/res/layout/main_layout.xml b/tests/lldb/java/SingleSource/res/layout/main_layout.xml deleted file mode 100644 index 4ef172f3..00000000 --- a/tests/lldb/java/SingleSource/res/layout/main_layout.xml +++ /dev/null @@ -1,14 +0,0 @@ -<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:background="#0099cc" - tools:context=".MainActivity"> - - <ImageView - android:id="@+id/imageView" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:scaleType="fitCenter" /> - -</FrameLayout> diff --git a/tests/lldb/java/SingleSource/src/com/android/rs/singlesource/MainActivity.java b/tests/lldb/java/SingleSource/src/com/android/rs/singlesource/MainActivity.java deleted file mode 100644 index 83080432..00000000 --- a/tests/lldb/java/SingleSource/src/com/android/rs/singlesource/MainActivity.java +++ /dev/null @@ -1,77 +0,0 @@ -/* -* Copyright (C) 2016 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -package com.android.rs.singlesource; - -import android.app.Activity; -import android.graphics.Bitmap; -import android.os.Bundle; -import android.widget.ImageView; -import android.renderscript.*; - -public class MainActivity extends Activity { - - private RenderScript mRS; - private Allocation mAllocIn1; - private Allocation mAllocIn2; - private Allocation mAllocOut; - private ScriptC_rs_single_source mScript; - - @Override - protected void onCreate(Bundle savedInstanceState) { - - super.onCreate(savedInstanceState); - - setContentView(R.layout.main_layout); - - // create renderscript context - mRS = RenderScript.create( - this, - RenderScript.ContextType.NORMAL, - RenderScript.CREATE_FLAG_WAIT_FOR_ATTACH | - RenderScript.CREATE_FLAG_LOW_LATENCY); - - // create a new instance of the script - mScript = new ScriptC_rs_single_source(mRS); - - // create the first input allocation - mAllocIn1 = Allocation.createSized(mRS, Element.F32(mRS), 4); - float [] in1 = new float[]{ 1.f, 2.f, 3.f, 4.f }; - mAllocIn1.copyFrom(in1); - - // create second input allocation - mAllocIn2 = Allocation.createSized(mRS, Element.F32(mRS), 4); - float [] in2 = new float[]{ 5.f, 6.f, 7.f, 8.f }; - mAllocIn2.copyFrom(in2); - - // create output allocation - mAllocOut = Allocation.createSized(mRS, Element.F32(mRS), 4); - - // setup the global output allocation - mScript.set_global_alloc(Allocation.createSized(mRS, Element.F32(mRS), 4)); - - // invoke static function 1 - mScript.invoke_script_invoke_1(mAllocOut, mAllocIn1, mAllocIn2); - - // invoke static function 2 - mScript.invoke_script_invoke_2(); - - // invoke void kernel - Script.LaunchOptions options = new Script.LaunchOptions(); - options.setX(0, 4); - mScript.forEach_void_kernel_1(options); - } -} diff --git a/tests/lldb/java/SingleSource/src/rs/rs_single_source.rscript b/tests/lldb/java/SingleSource/src/rs/rs_single_source.rscript deleted file mode 100644 index 15c35ef2..00000000 --- a/tests/lldb/java/SingleSource/src/rs/rs_single_source.rscript +++ /dev/null @@ -1,72 +0,0 @@ -/* -* Copyright (C) 2016 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#pragma version(1) -#pragma rs java_package_name(com.android.rs.singlesource) -#pragma rs_fp_full - -// global allocation used for void kernel -rs_allocation global_alloc; - -static void check_in() -{ - // debugger check point - return; -} - -float __attribute__((kernel)) kernel_1(float a) -{ - // square - return a * a; -} - -float __attribute__((kernel)) kernel_2(float a, float b) -{ - // product - return a * b; -} - -void __attribute__((kernel)) void_kernel_1(uint32_t x) -{ - // allocation[x] = x - rsSetElementAt_float(global_alloc, (float)x, x); -} - -void script_invoke_1(rs_allocation out, rs_allocation in1, rs_allocation in2) -{ - // invoke kernel taking one argument - rsForEach(kernel_1, out, in1); - - check_in(); - - // invoke kernel taking two arguments - rsForEach(kernel_2, out, in1, in2); - - check_in(); -} - -void script_invoke_2() -{ - // invoke kernel that takes no arguments and no return type - rs_script_call_t options = { - .strategy=RS_FOR_EACH_STRATEGY_DONT_CARE, - .xStart=0, - .xEnd=4 - }; - rsForEachWithOptions(void_kernel_1, &options); - - check_in(); -} diff --git a/tests/lldb/jni/Allocations/Android.mk b/tests/lldb/jni/Allocations/Android.mk deleted file mode 100644 index 67ef2d9a..00000000 --- a/tests/lldb/jni/Allocations/Android.mk +++ /dev/null @@ -1,19 +0,0 @@ -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE_TAGS := tests - -LOCAL_SRC_FILES := $(call all-java-files-under, src) \ - $(call all-renderscript-files-under, src) - -LOCAL_PACKAGE_NAME := JNIAllocations -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_SDK_VERSION := current - -LOCAL_JNI_SHARED_LIBRARIES := libjniallocations - -LOCAL_RENDERSCRIPT_FLAGS := -g -O0 -target-api 0 - -include $(BUILD_PACKAGE) -include $(LOCAL_PATH)/jniallocations/Android.mk diff --git a/tests/lldb/jni/Allocations/AndroidManifest.xml b/tests/lldb/jni/Allocations/AndroidManifest.xml deleted file mode 100644 index e73799fc..00000000 --- a/tests/lldb/jni/Allocations/AndroidManifest.xml +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.rs.jniallocations"> - <uses-sdk android:minSdkVersion="21" /> - <application android:label="JNIAllocations" - android:hardwareAccelerated="true"> - <activity android:name="MainActivity"> - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> - </intent-filter> - </activity> - </application> -</manifest> - diff --git a/tests/lldb/jni/Allocations/jniallocations/Android.mk b/tests/lldb/jni/Allocations/jniallocations/Android.mk deleted file mode 100644 index e52e1a35..00000000 --- a/tests/lldb/jni/Allocations/jniallocations/Android.mk +++ /dev/null @@ -1,15 +0,0 @@ -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE := libjniallocations -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice - -LOCAL_SRC_FILES := jniallocations.cpp allocs.rscript - -LOCAL_RENDERSCRIPT_FLAGS := -g - -LOCAL_STATIC_LIBRARIES := libcompiler_rt - -include frameworks/rs/tests/lldb/jni/common.mk -include $(BUILD_SHARED_LIBRARY) diff --git a/tests/lldb/jni/Allocations/jniallocations/allocs.rscript b/tests/lldb/jni/Allocations/jniallocations/allocs.rscript deleted file mode 100644 index c5ebcbfc..00000000 --- a/tests/lldb/jni/Allocations/jniallocations/allocs.rscript +++ /dev/null @@ -1,47 +0,0 @@ -/* -* Copyright (C) 2016 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#pragma version(1) -#pragma rs java_package_name(com.android.rs.jniallocations) - -// Kernel performs basic vector swizzle -uchar4 __attribute__((kernel)) swizzle_kernel(uchar4 in) -{ - return in.wzyx; -} - -// Kernel squares every element in allocation -uint __attribute__((kernel)) square_kernel(ushort in) -{ - uint result = (uint)(in) * (uint)in; - return result; -} - -// Helper function adding 1/2 to passed in double -static double half_helper(double in) -{ - return (in + 0.5); -} - -// Kernel returns first 3 elements of a double4 plus 1/2 -double3 __attribute__((kernel)) add_half_kernel(double4 in) -{ - double3 result; - result.x = half_helper(in.x); - result.y = half_helper(in.y); - result.z = half_helper(in.z); - return result; -} diff --git a/tests/lldb/jni/Allocations/jniallocations/jniallocations.cpp b/tests/lldb/jni/Allocations/jniallocations/jniallocations.cpp deleted file mode 100644 index f86b64ce..00000000 --- a/tests/lldb/jni/Allocations/jniallocations/jniallocations.cpp +++ /dev/null @@ -1,424 +0,0 @@ -/* -* Copyright (C) 2016 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include <memory> - -#include <jni.h> -#include <RenderScript.h> - -#include "ScriptC_allocs.h" - -sp<RS> mRS; - -sp<Allocation> mBoolAllocation; // boolean - -sp<Allocation> mCharAllocation; // char -sp<Allocation> mChar2Allocation; // char2 -sp<Allocation> mChar3Allocation; // char3 -sp<Allocation> mChar4Allocation; // char4 - -sp<Allocation> mUCharAllocation; // uchar -sp<Allocation> mUChar2Allocation; // uchar2 -sp<Allocation> mUChar3Allocation; // uchar3 -sp<Allocation> mUChar4Allocation; // uchar4 - -sp<Allocation> mShortAllocation; // short -sp<Allocation> mShort2Allocation; // short2 -sp<Allocation> mShort3Allocation; // short3 -sp<Allocation> mShort4Allocation; // short4 - -sp<Allocation> mUShortAllocation; // ushort -sp<Allocation> mUShort2Allocation; // ushort2 -sp<Allocation> mUShort3Allocation; // ushort3 -sp<Allocation> mUShort4Allocation; // ushort4 - -sp<Allocation> mIntAllocation; // int -sp<Allocation> mInt2Allocation; // int2 -sp<Allocation> mInt3Allocation; // int3 -sp<Allocation> mInt4Allocation; // int4 - -sp<Allocation> mUIntAllocation; // uint -sp<Allocation> mUInt2Allocation; // uint2 -sp<Allocation> mUInt3Allocation; // uint3 -sp<Allocation> mUInt4Allocation; // uint4 - -sp<Allocation> mLongAllocation; // long -sp<Allocation> mLong2Allocation; // long2 -sp<Allocation> mLong3Allocation; // long3 -sp<Allocation> mLong4Allocation; // long4 - -sp<Allocation> mULongAllocation; // ulong -sp<Allocation> mULong2Allocation; // ulong2 -sp<Allocation> mULong3Allocation; // ulong3 -sp<Allocation> mULong4Allocation; // ulong4 - -sp<Allocation> mHalfAllocation; // half -sp<Allocation> mHalf2Allocation; // half2 -sp<Allocation> mHalf3Allocation; // half3 -sp<Allocation> mHalf4Allocation; // half4 - -sp<Allocation> mFloatAllocation; // float -sp<Allocation> mFloat2Allocation; // float2 -sp<Allocation> mFloat3Allocation; // float3 -sp<Allocation> mFloat4Allocation; // float4 - -sp<Allocation> mDoubleAllocation; // double -sp<Allocation> mDouble2Allocation; // double2 -sp<Allocation> mDouble3Allocation; // double3 -sp<Allocation> mDouble4Allocation; // double4 - -const int mAllocSize = 24; // Needs to be < CHAR_MAX and divisible by 4. -const int mBitmapSize = 64; - -void createSignedAllocations() { - Type::Builder typeI8Builder(mRS, Element::I8(mRS)); - typeI8Builder.setX(1); // One element here to test 16 byte memory alignment - typeI8Builder.setY(3); - typeI8Builder.setZ(8); - - mCharAllocation = Allocation::createTyped(mRS, typeI8Builder.create()); - mChar2Allocation = Allocation::createSized(mRS, Element::I8_2(mRS), mAllocSize / 2); - mChar3Allocation = Allocation::createSized(mRS, Element::I8_3(mRS), mAllocSize / 4); - mChar4Allocation = Allocation::createSized(mRS, Element::I8_4(mRS), mAllocSize / 4); - - Type::Builder typeI16_2Builder(mRS, Element::I16_2(mRS)); - typeI16_2Builder.setX(6); - typeI16_2Builder.setY(1); - typeI16_2Builder.setZ(2); - - mShortAllocation = Allocation::createSized(mRS, Element::I16(mRS), mAllocSize); - mShort2Allocation = Allocation::createTyped(mRS, typeI16_2Builder.create()); - mShort3Allocation = Allocation::createSized(mRS, Element::I16_3(mRS), mAllocSize / 4); - mShort4Allocation = Allocation::createSized(mRS, Element::I16_4(mRS), mAllocSize / 4); - - Type::Builder typeI32_3Builder(mRS, Element::I32_3(mRS)); - typeI32_3Builder.setX(3); - typeI32_3Builder.setY(2); - - mIntAllocation = Allocation::createSized(mRS, Element::I32(mRS), mAllocSize); - mInt2Allocation = Allocation::createSized(mRS, Element::I32_2(mRS), mAllocSize / 2); - mInt3Allocation = Allocation::createTyped(mRS, typeI32_3Builder.create()); - mInt4Allocation = Allocation::createSized(mRS, Element::I32_4(mRS), mAllocSize / 4); - - Type::Builder typeI64_4Builder(mRS, Element::I64_4(mRS)); - typeI64_4Builder.setX(1); - typeI64_4Builder.setY(6); - - mLongAllocation = Allocation::createSized(mRS, Element::I64(mRS), mAllocSize); - mLong2Allocation = Allocation::createSized(mRS, Element::I64_2(mRS), mAllocSize / 2); - mLong3Allocation = Allocation::createSized(mRS, Element::I64_3(mRS), mAllocSize / 4); - mLong4Allocation = Allocation::createTyped(mRS, typeI64_4Builder.create()); - - mBoolAllocation = Allocation::createSized(mRS, Element::BOOLEAN(mRS), mAllocSize); -} - -void initSignedAllocations() { - char *buffer_char = new char[mAllocSize]; - short *buffer_short = new short[mAllocSize]; - int *buffer_int = new int[mAllocSize]; - int64_t *buffer_long = new int64_t[mAllocSize]; - char *buffer_bool = new char[mAllocSize]; - - for(int i = 0; i < mAllocSize; ++i) { - buffer_char[i] = (char) i; - buffer_short[i] = (short) i; - buffer_int[i] = (int) i; - buffer_long[i] = (int64_t) i; - buffer_bool[i] = (char) (0x01 & i); - } - - mCharAllocation->copy3DRangeFrom(0, 0, 0, 1, 3, 8, buffer_char); - mChar2Allocation->copy1DRangeFrom(0, mAllocSize/2, buffer_char); - mChar3Allocation->copy1DRangeFrom(0, mAllocSize/4, buffer_char); - mChar4Allocation->copy1DRangeFrom(0, mAllocSize/4, buffer_char); - - delete [] buffer_char; - - mShortAllocation->copy1DRangeFrom(0, mAllocSize, buffer_short); - mShort2Allocation->copy3DRangeFrom(0, 0, 0, 6, 1, 2, buffer_short); - mShort3Allocation->copy1DRangeFrom(0, mAllocSize/4, buffer_short); - mShort4Allocation->copy1DRangeFrom(0, mAllocSize/4, buffer_short); - - delete [] buffer_short; - - mIntAllocation->copy1DRangeFrom(0, mAllocSize, buffer_int); - mInt2Allocation->copy1DRangeFrom(0, mAllocSize/2, buffer_int); - mInt3Allocation->copy2DRangeFrom(0, 0, 3, 2, buffer_int); - mInt4Allocation->copy1DRangeFrom(0, mAllocSize/4, buffer_int); - - delete [] buffer_int; - - mLongAllocation->copy1DRangeFrom(0, mAllocSize, buffer_long); - mLong2Allocation->copy1DRangeFrom(0, mAllocSize/2, buffer_long); - mLong3Allocation->copy1DRangeFrom(0, mAllocSize/4, buffer_long); - mLong4Allocation->copy2DRangeFrom(0, 0, 1, 6, buffer_long); - - delete [] buffer_long; - - mBoolAllocation->copy1DRangeFrom(0, mAllocSize, buffer_bool); - - delete [] buffer_bool; -} - -void createUnsignedAllocations() { - Type::Builder typeU8_2Builder(mRS, Element::U8_2(mRS)); - typeU8_2Builder.setX(2); - typeU8_2Builder.setY(6); - - mUCharAllocation = Allocation::createSized(mRS, Element::U8(mRS), mAllocSize); - mUChar2Allocation = Allocation::createTyped(mRS, typeU8_2Builder.create()); - mUChar3Allocation = Allocation::createSized(mRS, Element::U8_3(mRS), mAllocSize / 4); - mUChar4Allocation = Allocation::createSized(mRS, Element::U8_4(mRS), mAllocSize / 4); - - Type::Builder typeU16_3Builder(mRS, Element::U16_3(mRS)); - typeU16_3Builder.setX(1); - typeU16_3Builder.setY(6); - - mUShortAllocation = Allocation::createSized(mRS, Element::U16(mRS), mAllocSize); - mUShort2Allocation = Allocation::createSized(mRS, Element::U16_2(mRS), mAllocSize / 2); - mUShort3Allocation = Allocation::createTyped(mRS, typeU16_3Builder.create()); - mUShort4Allocation = Allocation::createSized(mRS, Element::U16_4(mRS), mAllocSize / 4); - - Type::Builder typeU32_4Builder(mRS, Element::U32_4(mRS)); - typeU32_4Builder.setX(1); - typeU32_4Builder.setY(1); - typeU32_4Builder.setZ(6); - - mUIntAllocation = Allocation::createSized(mRS, Element::U32(mRS), mAllocSize); - mUInt2Allocation = Allocation::createSized(mRS, Element::U32_2(mRS), mAllocSize / 2); - mUInt3Allocation = Allocation::createSized(mRS, Element::U32_3(mRS), mAllocSize / 4); - mUInt4Allocation = Allocation::createTyped(mRS, typeU32_4Builder.create()); - - Type::Builder typeU64Builder(mRS, Element::U64(mRS)); - typeU64Builder.setX(4); - typeU64Builder.setY(3); - typeU64Builder.setZ(2); - - mULongAllocation = Allocation::createTyped(mRS, typeU64Builder.create()); - mULong2Allocation = Allocation::createSized(mRS, Element::U64_2(mRS), mAllocSize / 2); - mULong3Allocation = Allocation::createSized(mRS, Element::U64_3(mRS), mAllocSize / 4); - mULong4Allocation = Allocation::createSized(mRS, Element::U64_4(mRS), mAllocSize / 4); -} - -void initUnsignedAllocations() { - char *buffer_char = new char[mAllocSize]; - short *buffer_short = new short[mAllocSize]; - int *buffer_int = new int[mAllocSize]; - uint64_t *buffer_long = new uint64_t[mAllocSize]; - - for(int i = 0; i < mAllocSize; ++i) { - buffer_char[i] = (char) i; - buffer_short[i] = (short) i; - buffer_int[i] = (int) i; - buffer_long[i] = (uint64_t) i; - } - - mUCharAllocation->copy1DRangeFrom(0, mAllocSize, buffer_char); - mUChar2Allocation->copy2DRangeFrom(0, 0, 2, 6, buffer_char); - mUChar3Allocation->copy1DRangeFrom(0, mAllocSize/4, buffer_char); - mUChar4Allocation->copy1DRangeFrom(0, mAllocSize/4, buffer_char); - - delete [] buffer_char; - - mUShortAllocation->copy1DRangeFrom(0, mAllocSize, buffer_short); - mUShort2Allocation->copy1DRangeFrom(0, mAllocSize/2, buffer_short); - mUShort3Allocation->copy2DRangeFrom(0, 0, 1, 6, buffer_short); - mUShort4Allocation->copy1DRangeFrom(0, mAllocSize/4, buffer_short); - - delete [] buffer_short; - - mUIntAllocation->copy1DRangeFrom(0, mAllocSize, buffer_int); - mUInt2Allocation->copy1DRangeFrom(0, mAllocSize/2, buffer_int); - mUInt3Allocation->copy1DRangeFrom(0, mAllocSize/4, buffer_int); - mUInt4Allocation->copy3DRangeFrom(0, 0, 0, 1, 1, 6, buffer_int); - - delete [] buffer_int; - - mULongAllocation->copy3DRangeFrom(0, 0, 0, 4, 3, 2, buffer_long); - mULong2Allocation->copy1DRangeFrom(0, mAllocSize/2, buffer_long); - mULong3Allocation->copy1DRangeFrom(0, mAllocSize/4, buffer_long); - mULong4Allocation->copy1DRangeFrom(0, mAllocSize/4, buffer_long); - - delete [] buffer_long; -} - -void createFloatAllocations() { - Type::Builder typeF16_3Builder(mRS, Element::F16_3(mRS)); - typeF16_3Builder.setX(1); - typeF16_3Builder.setY(6); - - mHalfAllocation = Allocation::createSized(mRS, Element::F16(mRS), mAllocSize); - mHalf2Allocation = Allocation::createSized(mRS, Element::F16_2(mRS), mAllocSize / 2); - mHalf3Allocation = Allocation::createTyped(mRS, typeF16_3Builder.create()); - mHalf4Allocation = Allocation::createSized(mRS, Element::F16_4(mRS), mAllocSize / 4); - - Type::Builder typeF32_4Builder(mRS, Element::F32_4(mRS)); - typeF32_4Builder.setX(3); - typeF32_4Builder.setY(2); - - mFloatAllocation = Allocation::createSized(mRS, Element::F32(mRS), mAllocSize); - mFloat2Allocation = Allocation::createSized(mRS, Element::F32_2(mRS), mAllocSize / 2); - mFloat3Allocation = Allocation::createSized(mRS, Element::F32_3(mRS), mAllocSize / 4); - mFloat4Allocation = Allocation::createTyped(mRS, typeF32_4Builder.create()); - - Type::Builder typeF64_2Builder(mRS, Element::F64_2(mRS)); - typeF64_2Builder.setX(4); - typeF64_2Builder.setY(1); - typeF64_2Builder.setZ(3); - - mDoubleAllocation = Allocation::createSized(mRS, Element::F64(mRS), mAllocSize); - mDouble2Allocation = Allocation::createTyped(mRS, typeF64_2Builder.create()); - - Type::Builder typeF64_3Builder(mRS, Element::F64_3(mRS)); - typeF64_3Builder.setX(1); - typeF64_3Builder.setY(2); - typeF64_3Builder.setZ(3); - - Type::Builder typeF64_4Builder(mRS, Element::F64_4(mRS)); - typeF64_4Builder.setX(1); - typeF64_4Builder.setY(2); - typeF64_4Builder.setZ(3); - - mDouble3Allocation = Allocation::createTyped(mRS, typeF64_3Builder.create()); - mDouble4Allocation = Allocation::createTyped(mRS, typeF64_4Builder.create()); -} - -void initFloatAllocations() { - __fp16 *buffer_half = new __fp16[mAllocSize]; - float *buffer_float = new float[mAllocSize]; - double *buffer_double = new double[mAllocSize]; - - for(int i = 0; i < mAllocSize; ++i) { - buffer_half[i] = (__fp16) 1 / i; - buffer_float[i] = (float) 1 / i; - buffer_double[i] = (double) 1 / i; - } - - mHalfAllocation->copy1DRangeFrom(0, mAllocSize, buffer_half); - mHalf2Allocation->copy1DRangeFrom(0, mAllocSize/2, buffer_half); - mHalf3Allocation->copy2DRangeFrom(0, 0, 1, 6, buffer_half); - mHalf4Allocation->copy1DRangeFrom(0, mAllocSize/4, buffer_half); - - delete [] buffer_half; - - mFloatAllocation->copy1DRangeFrom(0, mAllocSize, buffer_float); - mFloat2Allocation->copy1DRangeFrom(0, mAllocSize/2, buffer_float); - mFloat3Allocation->copy1DRangeFrom(0, mAllocSize/4, buffer_float); - mFloat4Allocation->copy2DRangeFrom(0, 0, 3, 2, buffer_float); - - delete [] buffer_float; - - mDoubleAllocation->copy1DRangeFrom(0, mAllocSize, buffer_double); - mDouble2Allocation->copy3DRangeFrom(0, 0, 0, 4, 1, 3, buffer_double); - mDouble3Allocation->copy3DRangeFrom(0, 0, 0, 1, 2, 3, buffer_double); - mDouble4Allocation->copy3DRangeFrom(0, 0, 0, 1, 2, 3, buffer_double); - - delete [] buffer_double; -} - -extern "C" void JNICALL -Java_com_android_rs_jniallocations_MainActivity_nativeRS( - JNIEnv * env, - jclass, - jstring pathObj) -{ - mRS = new RS(); - - const char * path = env->GetStringUTFChars(pathObj, nullptr); - mRS->init(path, RS_INIT_LOW_LATENCY | RS_INIT_WAIT_FOR_ATTACH); - env->ReleaseStringUTFChars(pathObj, path); - - sp<ScriptC_allocs> mScript = new ScriptC_allocs(mRS); - - Type::Builder typeRGBA_888Builder(mRS, Element::RGBA_8888(mRS)); - typeRGBA_888Builder.setX(mBitmapSize); - typeRGBA_888Builder.setY(mBitmapSize); - - sp<Allocation> mInAllocation = Allocation::createTyped(mRS, typeRGBA_888Builder.create()); - - const int image_area = mBitmapSize*mBitmapSize; - const int image_size = image_area*sizeof(int); - - char *zero_buffer = new char[image_size]; - memset(zero_buffer, 0, image_size); - mInAllocation->copy1DRangeFrom(0, image_area, zero_buffer); - delete [] zero_buffer; - - sp<Allocation> mOutAllocation = Allocation::createTyped(mRS, typeRGBA_888Builder.create()); - createSignedAllocations(); - initSignedAllocations(); - - mRS->finish(); - mScript->forEach_swizzle_kernel(mInAllocation, mOutAllocation); - mRS->finish(); - - mCharAllocation.clear(); - mChar2Allocation.clear(); - mChar3Allocation.clear(); - mChar4Allocation.clear(); - - mShort2Allocation.clear(); - mShort3Allocation.clear(); - mShort4Allocation.clear(); - - mIntAllocation.clear(); - mInt2Allocation.clear(); - mInt3Allocation.clear(); - mInt4Allocation.clear(); - - mLongAllocation.clear(); - mLong2Allocation.clear(); - mLong3Allocation.clear(); - mLong4Allocation.clear(); - - mBoolAllocation.clear(); - - createUnsignedAllocations(); - initUnsignedAllocations(); - - mInAllocation = mUShortAllocation; // Host side assignment - - mRS->finish(); - mScript->forEach_square_kernel(mInAllocation, mUIntAllocation); - mRS->finish(); - - mUCharAllocation.clear(); - mUChar2Allocation.clear(); - mUChar3Allocation.clear(); - mUChar4Allocation.clear(); - - mUShortAllocation.clear(); - mUShort2Allocation.clear(); - mUShort3Allocation.clear(); - mUShort4Allocation.clear(); - - mUInt2Allocation.clear(); - mUInt3Allocation.clear(); - mUInt4Allocation.clear(); - - mULongAllocation.clear(); - mULong2Allocation.clear(); - mULong3Allocation.clear(); - mULong4Allocation.clear(); - - createFloatAllocations(); - initFloatAllocations(); - - mRS->finish(); - mScript->forEach_add_half_kernel(mDouble4Allocation, mDouble3Allocation); - mRS->finish(); -} - diff --git a/tests/lldb/jni/Allocations/res/layout/main_layout.xml b/tests/lldb/jni/Allocations/res/layout/main_layout.xml deleted file mode 100644 index 131c3b57..00000000 --- a/tests/lldb/jni/Allocations/res/layout/main_layout.xml +++ /dev/null @@ -1,15 +0,0 @@ -<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:background="#0099cc" - tools:context=".MainActivity"> - - <ImageView - android:id="@+id/imageView" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:scaleType="fitCenter" /> - -</FrameLayout> - diff --git a/tests/lldb/jni/Allocations/src/com/android/rs/jniallocations/MainActivity.java b/tests/lldb/jni/Allocations/src/com/android/rs/jniallocations/MainActivity.java deleted file mode 100644 index f13682f2..00000000 --- a/tests/lldb/jni/Allocations/src/com/android/rs/jniallocations/MainActivity.java +++ /dev/null @@ -1,43 +0,0 @@ -/* -* Copyright (C) 2016 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -package com.android.rs.jniallocations; - -import android.app.Activity; -import android.os.Bundle; -import android.graphics.BitmapFactory; -import android.graphics.Bitmap; -import android.widget.ImageView; - -public class MainActivity extends Activity { - private Bitmap mBitmapIn; - private Bitmap mBitmapOut; - - static { - System.loadLibrary("RS"); - System.loadLibrary("jniallocations"); - } - - native void nativeRS(String cacheDir); - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.main_layout); - nativeRS(this.getCacheDir().toString()); - } -} - diff --git a/tests/lldb/jni/Android.mk b/tests/lldb/jni/Android.mk deleted file mode 100644 index 5053e7d6..00000000 --- a/tests/lldb/jni/Android.mk +++ /dev/null @@ -1 +0,0 @@ -include $(call all-subdir-makefiles) diff --git a/tests/lldb/jni/BranchingFunCalls/Android.mk b/tests/lldb/jni/BranchingFunCalls/Android.mk deleted file mode 100644 index a5ee3b42..00000000 --- a/tests/lldb/jni/BranchingFunCalls/Android.mk +++ /dev/null @@ -1,19 +0,0 @@ -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE_TAGS := tests - -LOCAL_SRC_FILES := $(call all-java-files-under, src) \ - $(call all-renderscript-files-under, src) - -LOCAL_PACKAGE_NAME := JNIBranchingFunCalls -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_SDK_VERSION := current - -LOCAL_JNI_SHARED_LIBRARIES := libjnibranchingfuncalls - -LOCAL_RENDERSCRIPT_FLAGS := -g -O0 -target-api 0 - -include $(BUILD_PACKAGE) -include $(LOCAL_PATH)/jnibranchingfuncalls/Android.mk diff --git a/tests/lldb/jni/BranchingFunCalls/AndroidManifest.xml b/tests/lldb/jni/BranchingFunCalls/AndroidManifest.xml deleted file mode 100644 index 3b616fa6..00000000 --- a/tests/lldb/jni/BranchingFunCalls/AndroidManifest.xml +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.rs.jnibranchingfuncalls"> - <uses-sdk android:minSdkVersion="21" /> - <application android:label="JNIBranchingFunCalls" - android:hardwareAccelerated="true"> - <activity android:name="MainActivity"> - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> - </intent-filter> - </activity> - </application> -</manifest> - diff --git a/tests/lldb/jni/BranchingFunCalls/jnibranchingfuncalls/Android.mk b/tests/lldb/jni/BranchingFunCalls/jnibranchingfuncalls/Android.mk deleted file mode 100644 index 69f9162c..00000000 --- a/tests/lldb/jni/BranchingFunCalls/jnibranchingfuncalls/Android.mk +++ /dev/null @@ -1,13 +0,0 @@ -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE := libjnibranchingfuncalls -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice - -LOCAL_SRC_FILES := jnibranchingfuncalls.cpp scalars.rscript - -LOCAL_RENDERSCRIPT_FLAGS := -g - -include frameworks/rs/tests/lldb/jni/common.mk -include $(BUILD_SHARED_LIBRARY) diff --git a/tests/lldb/jni/BranchingFunCalls/jnibranchingfuncalls/jnibranchingfuncalls.cpp b/tests/lldb/jni/BranchingFunCalls/jnibranchingfuncalls/jnibranchingfuncalls.cpp deleted file mode 100644 index 4e2c4cfb..00000000 --- a/tests/lldb/jni/BranchingFunCalls/jnibranchingfuncalls/jnibranchingfuncalls.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* -* Copyright (C) 2016 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include <memory> - -#include <jni.h> -#include <RenderScript.h> - -#include "ScriptC_scalars.h" - -extern "C" void JNICALL -Java_com_android_rs_jnibranchingfuncalls_MainActivity_nativeRS( - JNIEnv * env, - jclass, - jstring pathObj) -{ - static const int size = 64; - sp<RS> rs = new RS(); - - const char * path = env->GetStringUTFChars(pathObj, nullptr); - rs->init(path, RS_INIT_LOW_LATENCY | RS_INIT_WAIT_FOR_ATTACH); - env->ReleaseStringUTFChars(pathObj, path); - - auto e = Element::I32(rs); - Type::Builder tb(rs, e); - tb.setX(size); - tb.setY(size); - auto t = tb.create(); - - auto a = Allocation::createTyped(rs, t); - auto b = Allocation::createTyped(rs, t); - - int * input = new int[size*size]; - for(int i = 0; i < size*size; ++i) { - input[i] = i - (size*size / 2); - } - a->copy2DRangeFrom(0, 0, size, size, input); - delete [] input; - - // Script is executed once, then the data is copied back when finished - sp<ScriptC_scalars> s = new ScriptC_scalars(rs); - s->invoke_addToGlobal(234); - s->forEach_simple_kernel(a, b); - rs->finish(); - int32_t * output = new int32_t[size*size]; - b->copy2DRangeTo(0, 0, size, size, output); - delete [] output; -} - diff --git a/tests/lldb/jni/BranchingFunCalls/jnibranchingfuncalls/scalars.rscript b/tests/lldb/jni/BranchingFunCalls/jnibranchingfuncalls/scalars.rscript deleted file mode 100644 index b98df28b..00000000 --- a/tests/lldb/jni/BranchingFunCalls/jnibranchingfuncalls/scalars.rscript +++ /dev/null @@ -1,76 +0,0 @@ -/* -* Copyright (C) 2016 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#pragma version(1) -#pragma rs java_package_name(com.android.rs.jnibranchingfuncalls) - -static bool is_neg(int a) -{ - if(a < 0) - return true; - else - return false; -} - -static bool is_pos(int a) -{ - if(a > 0) - return true; - else - return false; -} - -static void set_i(int * a, int b) -{ - int tmp = b; - *a = tmp; -} - -static void modify_f(float * f) -{ - *f *= 0.5f; -} - -static void modify_i(int * i) -{ - int j = *i; - int cutoff = 2 << 6; - if(j > cutoff) - j = cutoff; - if(is_neg(j)) - set_i(i, 0); - else if(is_pos(j)) - set_i(i, j); - else - set_i(i, cutoff); -} - -int __attribute__((kernel)) simple_kernel(int in) -{ - int i = in; - float f = (float) i; - modify_f(&f); - modify_i(&i); - int ret = (int) f; - return in * ret; -} - -int glob = 123; - -void addToGlobal(int arg) -{ - glob += arg; -} diff --git a/tests/lldb/jni/BranchingFunCalls/res/layout/main_layout.xml b/tests/lldb/jni/BranchingFunCalls/res/layout/main_layout.xml deleted file mode 100644 index 131c3b57..00000000 --- a/tests/lldb/jni/BranchingFunCalls/res/layout/main_layout.xml +++ /dev/null @@ -1,15 +0,0 @@ -<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:background="#0099cc" - tools:context=".MainActivity"> - - <ImageView - android:id="@+id/imageView" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:scaleType="fitCenter" /> - -</FrameLayout> - diff --git a/tests/lldb/jni/BranchingFunCalls/src/com/android/rs/jnibranchingfuncalls/MainActivity.java b/tests/lldb/jni/BranchingFunCalls/src/com/android/rs/jnibranchingfuncalls/MainActivity.java deleted file mode 100644 index b0ac283d..00000000 --- a/tests/lldb/jni/BranchingFunCalls/src/com/android/rs/jnibranchingfuncalls/MainActivity.java +++ /dev/null @@ -1,43 +0,0 @@ -/* -* Copyright (C) 2016 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -package com.android.rs.jnibranchingfuncalls; - -import android.app.Activity; -import android.os.Bundle; -import android.graphics.BitmapFactory; -import android.graphics.Bitmap; -import android.widget.ImageView; - -public class MainActivity extends Activity { - private Bitmap mBitmapIn; - private Bitmap mBitmapOut; - - static { - System.loadLibrary("RS"); - System.loadLibrary("jnibranchingfuncalls"); - } - - native void nativeRS(String cacheDir); - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.main_layout); - nativeRS(this.getCacheDir().toString()); - } -} - diff --git a/tests/lldb/jni/DebugWaitAttach/Android.mk b/tests/lldb/jni/DebugWaitAttach/Android.mk deleted file mode 100644 index 14cf20d2..00000000 --- a/tests/lldb/jni/DebugWaitAttach/Android.mk +++ /dev/null @@ -1,19 +0,0 @@ -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE_TAGS := tests - -LOCAL_SRC_FILES := $(call all-java-files-under, src) \ - $(call all-renderscript-files-under, src) - -LOCAL_PACKAGE_NAME := JNIDebugWaitAttach -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_SDK_VERSION := current - -LOCAL_JNI_SHARED_LIBRARIES := libjnidebugwaitattach - -LOCAL_RENDERSCRIPT_FLAGS := -g -O0 -target-api 0 - -include $(BUILD_PACKAGE) -include $(LOCAL_PATH)/jnidebugwaitattach/Android.mk diff --git a/tests/lldb/jni/DebugWaitAttach/AndroidManifest.xml b/tests/lldb/jni/DebugWaitAttach/AndroidManifest.xml deleted file mode 100644 index 12e544b2..00000000 --- a/tests/lldb/jni/DebugWaitAttach/AndroidManifest.xml +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.rs.jnidebugwaitattach"> - <uses-sdk android:minSdkVersion="21" /> - <application android:label="JNIDebugWaitAttach" - android:hardwareAccelerated="true"> - - <activity android:name="MainActivity"> - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> - </intent-filter> - </activity> - </application> -</manifest> diff --git a/tests/lldb/jni/DebugWaitAttach/jnidebugwaitattach/Android.mk b/tests/lldb/jni/DebugWaitAttach/jnidebugwaitattach/Android.mk deleted file mode 100644 index af7d578a..00000000 --- a/tests/lldb/jni/DebugWaitAttach/jnidebugwaitattach/Android.mk +++ /dev/null @@ -1,13 +0,0 @@ -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE := libjnidebugwaitattach -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice - -LOCAL_SRC_FILES := jnidebugwaitattach.cpp simple.rscript - -LOCAL_RENDERSCRIPT_FLAGS := -g - -include frameworks/rs/tests/lldb/jni/common.mk -include $(BUILD_SHARED_LIBRARY) diff --git a/tests/lldb/jni/DebugWaitAttach/jnidebugwaitattach/jnidebugwaitattach.cpp b/tests/lldb/jni/DebugWaitAttach/jnidebugwaitattach/jnidebugwaitattach.cpp deleted file mode 100644 index f8151f4f..00000000 --- a/tests/lldb/jni/DebugWaitAttach/jnidebugwaitattach/jnidebugwaitattach.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* -* Copyright (C) 2016 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include <memory> - -#include <jni.h> -#include <RenderScript.h> - -#include "ScriptC_simple.h" - -extern "C" void JNICALL -Java_com_android_rs_jnidebugwaitattach_MainActivity_nativeRS( - JNIEnv * env, - jclass, - jstring pathObj) -{ - static const int size = 8; - sp<RS> rs = new RS(); - - const char * path = env->GetStringUTFChars(pathObj, nullptr); - rs->init(path, RS_INIT_LOW_LATENCY | RS_INIT_WAIT_FOR_ATTACH); - env->ReleaseStringUTFChars(pathObj, path); - - auto e = Element::RGBA_8888(rs); - Type::Builder tb(rs, e); - tb.setX(size); - tb.setY(size); - auto t = tb.create(); - - auto a = Allocation::createTyped(rs, t); - auto b = Allocation::createTyped(rs, t); - - // Script is executed once, then the data is copied back when finished - sp<ScriptC_simple> s = new ScriptC_simple(rs); - s->forEach_simple_kernel(a, b); - uint32_t * output = new uint32_t[size*size]; - b->copy2DRangeTo(0, 0, size, size, output); - delete [] output; - - s->forEach_other_kernel(a, b); - - rs->finish(); -} - diff --git a/tests/lldb/jni/DebugWaitAttach/jnidebugwaitattach/simple.rscript b/tests/lldb/jni/DebugWaitAttach/jnidebugwaitattach/simple.rscript deleted file mode 100644 index a89c1f21..00000000 --- a/tests/lldb/jni/DebugWaitAttach/jnidebugwaitattach/simple.rscript +++ /dev/null @@ -1,39 +0,0 @@ -/* -* Copyright (C) 2016 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#pragma version(1) -#pragma rs java_package_name(com.android.rs.jnidebugwaitattach) - -float4 gColor = {0.299f, 0.587f, 0.114f, 1.f}; - -/* RenderScript kernel that just sets the colour of the screen and does some - * simple operations so it is not completely empty - * (and can therefore be debugged). - */ -uchar4 __attribute__((kernel)) simple_kernel(uchar4 in) -{ - float4 temp = rsUnpackColor8888(in); - temp = gColor; - uchar4 result = rsPackColorTo8888(temp); - return result; -} - -// Extra kernel to test lldb setting breakpoints on all the RS kernels. -uchar4 __attribute__((kernel)) other_kernel(uchar4 in) -{ - uchar4 result = in.wzyx; - return result; -} diff --git a/tests/lldb/jni/DebugWaitAttach/res/layout/main_layout.xml b/tests/lldb/jni/DebugWaitAttach/res/layout/main_layout.xml deleted file mode 100644 index 131c3b57..00000000 --- a/tests/lldb/jni/DebugWaitAttach/res/layout/main_layout.xml +++ /dev/null @@ -1,15 +0,0 @@ -<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:background="#0099cc" - tools:context=".MainActivity"> - - <ImageView - android:id="@+id/imageView" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:scaleType="fitCenter" /> - -</FrameLayout> - diff --git a/tests/lldb/jni/DebugWaitAttach/src/com/android/rs/jniwaitattachdebug/MainActivity.java b/tests/lldb/jni/DebugWaitAttach/src/com/android/rs/jniwaitattachdebug/MainActivity.java deleted file mode 100644 index b858cf7d..00000000 --- a/tests/lldb/jni/DebugWaitAttach/src/com/android/rs/jniwaitattachdebug/MainActivity.java +++ /dev/null @@ -1,43 +0,0 @@ -/* -* Copyright (C) 2016 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -package com.android.rs.jnidebugwaitattach; - -import android.app.Activity; -import android.os.Bundle; -import android.graphics.BitmapFactory; -import android.graphics.Bitmap; -import android.widget.ImageView; - -public class MainActivity extends Activity { - private Bitmap mBitmapIn; - private Bitmap mBitmapOut; - - static { - System.loadLibrary("RS"); - System.loadLibrary("jnidebugwaitattach"); - } - - native void nativeRS(String cacheDir); - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.main_layout); - nativeRS(this.getCacheDir().toString()); - } -} - diff --git a/tests/lldb/jni/InfiniteLoop/Android.mk b/tests/lldb/jni/InfiniteLoop/Android.mk deleted file mode 100644 index 892e1e94..00000000 --- a/tests/lldb/jni/InfiniteLoop/Android.mk +++ /dev/null @@ -1,19 +0,0 @@ -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE_TAGS := tests - -LOCAL_SRC_FILES := $(call all-java-files-under, src) \ - $(call all-renderscript-files-under, src) - -LOCAL_PACKAGE_NAME := JNIInfiniteLoop -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_SDK_VERSION := current - -LOCAL_JNI_SHARED_LIBRARIES := libjniinfiniteloop - -LOCAL_RENDERSCRIPT_FLAGS := -g -O0 -target-api 0 - -include $(BUILD_PACKAGE) -include $(LOCAL_PATH)/jniinfiniteloop/Android.mk diff --git a/tests/lldb/jni/InfiniteLoop/AndroidManifest.xml b/tests/lldb/jni/InfiniteLoop/AndroidManifest.xml deleted file mode 100644 index 23031f0c..00000000 --- a/tests/lldb/jni/InfiniteLoop/AndroidManifest.xml +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.rs.jniinfiniteloop"> - <uses-sdk android:minSdkVersion="21" /> - <application android:label="JNIInfiniteLoop" - android:hardwareAccelerated="true"> - <activity android:name="MainActivity"> - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> - </intent-filter> - </activity> - </application> -</manifest> - diff --git a/tests/lldb/jni/InfiniteLoop/jniinfiniteloop/Android.mk b/tests/lldb/jni/InfiniteLoop/jniinfiniteloop/Android.mk deleted file mode 100644 index 21717224..00000000 --- a/tests/lldb/jni/InfiniteLoop/jniinfiniteloop/Android.mk +++ /dev/null @@ -1,13 +0,0 @@ -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE := libjniinfiniteloop -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice - -LOCAL_SRC_FILES := jniinfiniteloop.cpp infiniteloop.rscript - -LOCAL_RENDERSCRIPT_FLAGS := -g - -include frameworks/rs/tests/lldb/jni/common.mk -include $(BUILD_SHARED_LIBRARY) diff --git a/tests/lldb/jni/InfiniteLoop/jniinfiniteloop/infiniteloop.rscript b/tests/lldb/jni/InfiniteLoop/jniinfiniteloop/infiniteloop.rscript deleted file mode 100644 index 142b27ba..00000000 --- a/tests/lldb/jni/InfiniteLoop/jniinfiniteloop/infiniteloop.rscript +++ /dev/null @@ -1,49 +0,0 @@ -/* -* Copyright (C) 2016 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* - * Copyright (C) 2014 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma version(1) -#pragma rs java_package_name(com.android.rs.jniinfiniteloop) -#pragma rs_fp_relaxed - -float4 gColour = {0.299f, 0.587f, 0.114f, 1.f}; - -/* RenderScript kernel that just sets the colour of the screen and does some - * simple operations so it is not completely empty - * (and can therefore be debugged). - */ -uchar4 __attribute__((kernel)) simple_kernel(uchar4 in) -{ - float4 temp = rsUnpackColor8888(in); - temp = gColour; - uchar4 result = rsPackColorTo8888(temp); - return result; -} diff --git a/tests/lldb/jni/InfiniteLoop/jniinfiniteloop/jniinfiniteloop.cpp b/tests/lldb/jni/InfiniteLoop/jniinfiniteloop/jniinfiniteloop.cpp deleted file mode 100644 index 73d1cbba..00000000 --- a/tests/lldb/jni/InfiniteLoop/jniinfiniteloop/jniinfiniteloop.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* -* Copyright (C) 2016 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include <memory> -#include <unistd.h> - -#include <jni.h> -#include <RenderScript.h> - -#include "ScriptC_infiniteloop.h" - -extern "C" void JNICALL -Java_com_android_rs_jniinfiniteloop_MainActivity_nativeRS( - JNIEnv * env, - jclass, - jstring pathObj) -{ - static const int size = 64; - sp<RS> rs = new RS(); - - const char * path = env->GetStringUTFChars(pathObj, nullptr); - rs->init(path, RS_INIT_LOW_LATENCY); - env->ReleaseStringUTFChars(pathObj, path); - - auto e = Element::RGBA_8888(rs); - Type::Builder tb(rs, e); - tb.setX(size); - tb.setY(size); - auto t = tb.create(); - - auto a = Allocation::createTyped(rs, t); - auto b = Allocation::createTyped(rs, t); - - sp<ScriptC_infiniteloop> s = new ScriptC_infiniteloop(rs); - - // Test is designed to loop forever, waits for two seconds - // between each invocation of the kernel - bool forever = true; - while(forever) - { - s->forEach_simple_kernel(a, b); - sleep(2); - } - - uint32_t * output = new uint32_t[size*size]; - b->copy2DRangeTo(0, 0, size, size, output); - delete [] output; -} - diff --git a/tests/lldb/jni/InfiniteLoop/res/layout/main_layout.xml b/tests/lldb/jni/InfiniteLoop/res/layout/main_layout.xml deleted file mode 100644 index 131c3b57..00000000 --- a/tests/lldb/jni/InfiniteLoop/res/layout/main_layout.xml +++ /dev/null @@ -1,15 +0,0 @@ -<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:background="#0099cc" - tools:context=".MainActivity"> - - <ImageView - android:id="@+id/imageView" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:scaleType="fitCenter" /> - -</FrameLayout> - diff --git a/tests/lldb/jni/InfiniteLoop/src/com/android/rs/jniinfiniteloop/MainActivity.java b/tests/lldb/jni/InfiniteLoop/src/com/android/rs/jniinfiniteloop/MainActivity.java deleted file mode 100644 index a18c4200..00000000 --- a/tests/lldb/jni/InfiniteLoop/src/com/android/rs/jniinfiniteloop/MainActivity.java +++ /dev/null @@ -1,43 +0,0 @@ -/* -* Copyright (C) 2016 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -package com.android.rs.jniinfiniteloop; - -import android.app.Activity; -import android.os.Bundle; -import android.graphics.BitmapFactory; -import android.graphics.Bitmap; -import android.widget.ImageView; - -public class MainActivity extends Activity { - private Bitmap mBitmapIn; - private Bitmap mBitmapOut; - - static { - System.loadLibrary("RS"); - System.loadLibrary("jniinfiniteloop"); - } - - native void nativeRS(String cacheDir); - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.main_layout); - nativeRS(this.getCacheDir().toString()); - } -} - diff --git a/tests/lldb/jni/KernelVariables/Android.mk b/tests/lldb/jni/KernelVariables/Android.mk deleted file mode 100644 index 12017d5a..00000000 --- a/tests/lldb/jni/KernelVariables/Android.mk +++ /dev/null @@ -1,19 +0,0 @@ -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE_TAGS := tests - -LOCAL_SRC_FILES := $(call all-java-files-under, src) \ - $(call all-renderscript-files-under, src) - -LOCAL_PACKAGE_NAME := JNIKernelVariables -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_SDK_VERSION := current - -LOCAL_JNI_SHARED_LIBRARIES := libjnikernelvariables - -LOCAL_RENDERSCRIPT_FLAGS := -g -O0 -target-api 0 - -include $(BUILD_PACKAGE) -include $(LOCAL_PATH)/jnikernelvariables/Android.mk diff --git a/tests/lldb/jni/KernelVariables/AndroidManifest.xml b/tests/lldb/jni/KernelVariables/AndroidManifest.xml deleted file mode 100644 index b7198921..00000000 --- a/tests/lldb/jni/KernelVariables/AndroidManifest.xml +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.rs.jnikernelvariables"> - <uses-sdk android:minSdkVersion="21" /> - <application android:label="JNIKernelVariables" - android:hardwareAccelerated="true"> - <activity android:name="MainActivity"> - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> - </intent-filter> - </activity> - </application> -</manifest> - diff --git a/tests/lldb/jni/KernelVariables/jnikernelvariables/Android.mk b/tests/lldb/jni/KernelVariables/jnikernelvariables/Android.mk deleted file mode 100644 index 10afc4bf..00000000 --- a/tests/lldb/jni/KernelVariables/jnikernelvariables/Android.mk +++ /dev/null @@ -1,13 +0,0 @@ -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE := libjnikernelvariables -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice - -LOCAL_SRC_FILES := jnikernelvariables.cpp simple.rscript - -LOCAL_RENDERSCRIPT_FLAGS := -g - -include frameworks/rs/tests/lldb/jni/common.mk -include $(BUILD_SHARED_LIBRARY) diff --git a/tests/lldb/jni/KernelVariables/jnikernelvariables/jnikernelvariables.cpp b/tests/lldb/jni/KernelVariables/jnikernelvariables/jnikernelvariables.cpp deleted file mode 100644 index 94917bf2..00000000 --- a/tests/lldb/jni/KernelVariables/jnikernelvariables/jnikernelvariables.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* -* Copyright (C) 2016 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include <memory> - -#include <jni.h> -#include <RenderScript.h> - -#include "ScriptC_simple.h" - -extern "C" void JNICALL -Java_com_android_rs_jnikernelvariables_MainActivity_nativeRS( - JNIEnv * env, - jclass, - jstring pathObj) -{ - static const int size = 64; - sp<RS> rs = new RS(); - - const char * path = env->GetStringUTFChars(pathObj, nullptr); - rs->init(path, RS_INIT_LOW_LATENCY | RS_INIT_WAIT_FOR_ATTACH); - env->ReleaseStringUTFChars(pathObj, path); - - auto e = Element::RGBA_8888(rs); - Type::Builder tb(rs, e); - tb.setX(size); - tb.setY(size); - auto t = tb.create(); - - auto a = Allocation::createTyped(rs, t); - auto b = Allocation::createTyped(rs, t); - - sp<ScriptC_simple> s = new ScriptC_simple(rs); - - static const int buffer_int[] = {1, 2, 3, 4}; - sp<Allocation> int_allocation = Allocation::createSized(rs, Element::I32(rs), 4); - int_allocation->copy1DRangeFrom(0, 4, buffer_int); - s->set_allocation_1D_global(int_allocation); - - static const int buffer_int2[] = {5, 6, 7, 8}; - - Type::Builder typeI32Builder2D(rs, Element::I32(rs)); - typeI32Builder2D.setX(2); - typeI32Builder2D.setY(2); - - sp<Allocation> int_allocation2 = Allocation::createTyped(rs, typeI32Builder2D.create()); - int_allocation2->copy2DRangeFrom(0, 0, 2, 2, buffer_int2); - s->set_allocation_1D_global2(int_allocation2); - - s->set_allocation_2D_global(a); - s->set_allocation_2D_global2(b); - - static const int buffer_int3[] = {9, 10, 11, 12, 13, 14, 15, 16}; - - Type::Builder typeI32Builder3D(rs, Element::I32(rs)); - typeI32Builder3D.setX(2); - typeI32Builder3D.setY(2); - typeI32Builder3D.setZ(2); - - sp<Allocation> int_allocation3 = Allocation::createTyped(rs, typeI32Builder3D.create()); - int_allocation3->copy3DRangeFrom(0, 0, 0, 2, 2, 2, buffer_int3); - s->set_allocation_3D_global(int_allocation3); - - Type::Builder yuvTypeBuilder(rs, Element::YUV(rs)); - yuvTypeBuilder.setX(4); - yuvTypeBuilder.setY(4); - yuvTypeBuilder.setYuvFormat(RS_YUV_YV12); - - sp<Allocation> yuv_allocation = Allocation::createTyped(rs, yuvTypeBuilder.create()); - s->set_allocation_YUV_2D_global(yuv_allocation); - - s->set_sampler_global(Sampler::CLAMP_LINEAR(rs)); - - // Script is executed once, then the data is copied back when finished - s->forEach_kernel(a, b); - rs->finish(); - uint32_t * output = new uint32_t[size*size]; - b->copy2DRangeTo(0, 0, size, size, output); - delete [] output; -} - diff --git a/tests/lldb/jni/KernelVariables/jnikernelvariables/simple.rscript b/tests/lldb/jni/KernelVariables/jnikernelvariables/simple.rscript deleted file mode 100644 index 30feb005..00000000 --- a/tests/lldb/jni/KernelVariables/jnikernelvariables/simple.rscript +++ /dev/null @@ -1,197 +0,0 @@ -/* -* Copyright (C) 2016 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#pragma version(1) -#pragma rs java_package_name(com.android.rs.jnikernelvariables) - -char char_global = 12; -uchar uchar_global = 234; -short short_global = -321; -ushort ushort_global = 432; -int int_global = 1234; -uint uint_global = 2345; -float float_global = 4.5f; -long long_global = -77777; -ulong ulong_global = 8888; -double double_global = -456.5f; - -char2 char2_global = {11, -22}; -uchar2 uchar2_global = {33, 44}; -short2 short2_global = {-555, 666}; -ushort2 ushort2_global = {777, 888}; -int2 int2_global = {999, -1111}; -uint2 uint2_global = {2222, 3333}; -float2 float2_global = {4.5f, -5.0f}; -long2 long2_global = {-4444, 5555}; -ulong2 ulong2_global = {6666, 7777}; -double2 double2_global = {88.5f, -99.0f}; - -char3 char3_global = {11, -22, -33}; -uchar3 uchar3_global = {33, 44, 55}; -short3 short3_global = {-555, 666, 777}; -ushort3 ushort3_global = {777, 888, 999}; -int3 int3_global = {999, -1111, 2222}; -uint3 uint3_global = {2222, 3333, 4444}; -float3 float3_global = {4.5f, -5.0f, -6.5f}; -long3 long3_global = {-4444, 5555, 6666}; -ulong3 ulong3_global = {6666, 7777, 8888}; -double3 double3_global = {88.5f, -99.0f, 111.5f}; - -char4 char4_global = {55, 11, -22, -33}; -uchar4 uchar4_global = {222, 33, 44, 55}; -short4 short4_global = {-444, -555, 666, 777}; -ushort4 ushort4_global = {666, 777, 888, 999}; -int4 int4_global = {888, 999, -1111, 2222}; -uint4 uint4_global = {1111, 2222, 3333, 4444}; -float4 float4_global = {3.0f, 4.5f, -5.0f, -6.5f}; -long4 long4_global = {-3333, -4444, 5555, 6666}; -ulong4 ulong4_global = {5555, 6666, 7777, 8888}; -double4 double4_global = {-77.0f, 88.5f, -99.0f, 111.5f}; - -rs_matrix2x2 matrix2x2_global; -rs_matrix3x3 matrix3x3_global; -rs_matrix4x4 matrix4x4_global; - -rs_quaternion quaternion_global; - -rs_allocation allocation_1D_global; -rs_allocation allocation_1D_global2; -rs_allocation allocation_2D_global; -rs_allocation allocation_2D_global2; -rs_allocation allocation_3D_global; -rs_allocation allocation_YUV_2D_global; - -rs_allocation_cubemap_face cubemap_face_global; -rs_sampler sampler_global; - -uchar4 __attribute__((kernel)) kernel(uchar4 in) -{ - char char_local = 'a'; - uchar uchar_local = 'b'; - short short_local = -321; - ushort ushort_local = 432; - int int_local = 1234; - uint uint_local = 2345; - float float_local = 4.5f; - long long_local = -77777; - ulong ulong_local = 8888; - double double_local = -456.5f; - - char2 char2_local = {-11, -22}; - uchar2 uchar2_local = {33, 44}; - short2 short2_local = {-555, 666}; - ushort2 ushort2_local = {777, 888}; - int2 int2_local = {999, -1111}; - uint2 uint2_local = {2222, 3333}; - float2 float2_local = {4.5f, -5.0f}; - long2 long2_local = {-4444, 5555}; - ulong2 ulong2_local = {6666, 7777}; - double2 double2_local = {88.5f, -99.0f}; - - char3 char3_local = {11, -22, -33}; - uchar3 uchar3_local = {33, 44, 55}; - short3 short3_local = {-555, 666, 777}; - ushort3 ushort3_local = {777, 888, 999}; - int3 int3_local = {999, -1111, 2222}; - uint3 uint3_local = {2222, 3333, 4444}; - float3 float3_local = {4.5f, -5.0f, -6.5f}; - long3 long3_local = {-4444, 5555, 6666}; - ulong3 ulong3_local = {6666, 7777, 8888}; - double3 double3_local = {88.5f, -99.0f, 111.5f}; - - char4 char4_local = {55, 11, -22, -33}; - uchar4 uchar4_local = {22, 33, 44, 55}; - short4 short4_local = {-444, -555, 666, 777}; - ushort4 ushort4_local = {666, 777, 888, 999}; - int4 int4_local = {888, 999, -1111, 2222}; - uint4 uint4_local = {1111, 2222, 3333, 4444}; - float4 float4_local = {3.0f, 4.5f, -5.0f, -6.5f}; - long4 long4_local = {-3333, -4444, 5555, 6666}; - ulong4 ulong4_local = {5555, 6666, 7777, 8888}; - double4 double4_local = {-77.0f, 88.5f, -99.0f, 111.5f}; - - rs_matrix2x2 matrix2x2_local = {{1., 2.5, - 3., 4.5}}; - rs_matrix3x3 matrix3x3_local = {{5., 6.5, 7., - 8.5, 9., 1.5, - 2., 3.5, 4.}}; - rs_matrix4x4 matrix4x4_local = {{5.5, 6., 7.5, 8., - 9., 1.5, 2., 3.5, - 4.5, 5.5, 6.5, 7., - 8., 9.5, 1.5, 2.5}}; - - matrix2x2_global = matrix2x2_local; - matrix3x3_global = matrix3x3_local; - matrix4x4_global = matrix4x4_local; - - rsQuaternionSet(&quaternion_global, 3.0, 4.5, 5.5, 6.0); - - rs_quaternion quaternion_local; - rsQuaternionSet(&quaternion_local, 7.5, 8.0, 9.0, 0.5); - - char char_combined = char_local + (char)uchar_local + char2_local.x + - (char)uchar2_local.x + char3_local.x - (char)uchar3_local.x + - char4_local.x + (char)uchar4_local.x; - - short short_combined = short_local + (short)ushort_local + short2_local.x + - (short)ushort2_local.x + short3_local.x + (short)ushort3_local.x + - short4_local.x + (short)ushort4_local.x; - - int int_combined = int_local + (int)uint_local + int2_local.x + - (int)uint2_local.x + int3_local.x + (int)uint3_local.x + int4_local.x + - (int)uint4_local.x; - - float float_combined = float_local + float2_local.x + float3_local.x + - float4_local.x; - - long long_combined = long_local + (long)ulong_local + long2_local.x + - (long)ulong2_local.x + long3_local.x + (long)ulong3_local.x + - long4_local.x + (long)ulong4_local.x; - - double double_combined = double_local + double2_local.x + double3_local.x + - double4_local.x; - - char_global = char_combined; - short_global = short_combined; - int_global = int_combined; - float_global = float_combined; - long_global = long_combined; - double_global = double_combined; - - uchar4 result = {1,2,3,4}; - return result; -} - -float use_constants_global; - -void setup(void) -{ - use_constants_global = - M_1_PI + - M_2_PI + - M_2_PIl + - M_2_SQRTPI + - M_E + - M_LN10 + - M_LN2 + - M_LOG10E + - M_LOG2E + - M_PI + - M_PI_2 + - M_PI_4 + - M_SQRT1_2 + - M_SQRT2; -} diff --git a/tests/lldb/jni/KernelVariables/res/layout/main_layout.xml b/tests/lldb/jni/KernelVariables/res/layout/main_layout.xml deleted file mode 100644 index 131c3b57..00000000 --- a/tests/lldb/jni/KernelVariables/res/layout/main_layout.xml +++ /dev/null @@ -1,15 +0,0 @@ -<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:background="#0099cc" - tools:context=".MainActivity"> - - <ImageView - android:id="@+id/imageView" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:scaleType="fitCenter" /> - -</FrameLayout> - diff --git a/tests/lldb/jni/KernelVariables/src/com/android/rs/jnikernelvariables/MainActivity.java b/tests/lldb/jni/KernelVariables/src/com/android/rs/jnikernelvariables/MainActivity.java deleted file mode 100644 index 11e41f2c..00000000 --- a/tests/lldb/jni/KernelVariables/src/com/android/rs/jnikernelvariables/MainActivity.java +++ /dev/null @@ -1,42 +0,0 @@ -/* -* Copyright (C) 2016 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -package com.android.rs.jnikernelvariables; - -import android.app.Activity; -import android.os.Bundle; -import android.graphics.BitmapFactory; -import android.graphics.Bitmap; -import android.widget.ImageView; - -public class MainActivity extends Activity { - private Bitmap mBitmapIn; - private Bitmap mBitmapOut; - - static { - System.loadLibrary("RS"); - System.loadLibrary("jnikernelvariables"); - } - - native void nativeRS(String cacheDir); - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.main_layout); - nativeRS(this.getCacheDir().toString()); - } -} diff --git a/tests/lldb/jni/MultipleRSFiles/Android.mk b/tests/lldb/jni/MultipleRSFiles/Android.mk deleted file mode 100644 index ff24154d..00000000 --- a/tests/lldb/jni/MultipleRSFiles/Android.mk +++ /dev/null @@ -1,19 +0,0 @@ -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE_TAGS := tests - -LOCAL_SRC_FILES := $(call all-java-files-under, src) \ - $(call all-renderscript-files-under, src) - -LOCAL_PACKAGE_NAME := JNIMultipleRSFiles -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_SDK_VERSION := current - -LOCAL_JNI_SHARED_LIBRARIES := libjnimultiplersfiles - -LOCAL_RENDERSCRIPT_FLAGS := -g -O0 -target-api 0 - -include $(BUILD_PACKAGE) -include $(LOCAL_PATH)/jnimultiplersfiles/Android.mk diff --git a/tests/lldb/jni/MultipleRSFiles/AndroidManifest.xml b/tests/lldb/jni/MultipleRSFiles/AndroidManifest.xml deleted file mode 100644 index 19bb65c4..00000000 --- a/tests/lldb/jni/MultipleRSFiles/AndroidManifest.xml +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.rs.jnimultiplersfiles"> - <uses-sdk android:minSdkVersion="21" /> - <application android:label="JNIMultipleRSFiles" - android:hardwareAccelerated="true"> - - <activity android:name="MainActivity"> - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> - </intent-filter> - </activity> - </application> -</manifest> diff --git a/tests/lldb/jni/MultipleRSFiles/jnimultiplersfiles/Android.mk b/tests/lldb/jni/MultipleRSFiles/jnimultiplersfiles/Android.mk deleted file mode 100644 index b3c335fa..00000000 --- a/tests/lldb/jni/MultipleRSFiles/jnimultiplersfiles/Android.mk +++ /dev/null @@ -1,13 +0,0 @@ -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE := libjnimultiplersfiles -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice - -LOCAL_SRC_FILES := jnimultiplersfiles.cpp first.rscript second.rscript - -LOCAL_RENDERSCRIPT_FLAGS := -g - -include frameworks/rs/tests/lldb/jni/common.mk -include $(BUILD_SHARED_LIBRARY) diff --git a/tests/lldb/jni/MultipleRSFiles/jnimultiplersfiles/first.rscript b/tests/lldb/jni/MultipleRSFiles/jnimultiplersfiles/first.rscript deleted file mode 100644 index 7c4a8520..00000000 --- a/tests/lldb/jni/MultipleRSFiles/jnimultiplersfiles/first.rscript +++ /dev/null @@ -1,32 +0,0 @@ -/* -* Copyright (C) 2016 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#pragma version(1) -#pragma rs java_package_name(com.android.rs.jnimultiplersfiles) - -float4 gColor = {0.299f, 0.587f, 0.114f, 1.f}; - -/* RenderScript kernel that just sets the colour of the screen and does some - * simple operations so it is not completely empty - * (and can therefore be debugged). - */ -uchar4 __attribute__((kernel)) first_kernel(uchar4 in) -{ - float4 temp = rsUnpackColor8888(in); - temp = gColor; - uchar4 result = rsPackColorTo8888(temp); - return result; -} diff --git a/tests/lldb/jni/MultipleRSFiles/jnimultiplersfiles/jnimultiplersfiles.cpp b/tests/lldb/jni/MultipleRSFiles/jnimultiplersfiles/jnimultiplersfiles.cpp deleted file mode 100644 index 6d28a4b5..00000000 --- a/tests/lldb/jni/MultipleRSFiles/jnimultiplersfiles/jnimultiplersfiles.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* -* Copyright (C) 2016 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include <memory> - -#include <jni.h> -#include <RenderScript.h> - -#include "ScriptC_first.h" -#include "ScriptC_second.h" - -extern "C" void JNICALL -Java_com_android_rs_jnimultiplersfiles_MainActivity_nativeRS( - JNIEnv * env, - jclass, - jstring pathObj) -{ - static const int size = 64; - sp<RS> rs = new RS(); - - const char * path = env->GetStringUTFChars(pathObj, nullptr); - rs->init(path, RS_INIT_LOW_LATENCY | RS_INIT_WAIT_FOR_ATTACH); - env->ReleaseStringUTFChars(pathObj, path); - - auto e = Element::RGBA_8888(rs); - Type::Builder tb(rs, e); - tb.setX(size); - tb.setY(size); - auto t = tb.create(); - - auto a = Allocation::createTyped(rs, t); - auto b = Allocation::createTyped(rs, t); - - // Script is executed once, then the data is copied back when finished - sp<ScriptC_first> s1 = new ScriptC_first(rs); - sp<ScriptC_second> s2 = new ScriptC_second(rs); - - s1->forEach_first_kernel(a, b); - uint32_t * output = new uint32_t[size*size]; - b->copy2DRangeTo(0, 0, size, size, output); - delete [] output; - - s2->forEach_second_kernel(a, b); - - rs->finish(); -} - diff --git a/tests/lldb/jni/MultipleRSFiles/jnimultiplersfiles/second.rscript b/tests/lldb/jni/MultipleRSFiles/jnimultiplersfiles/second.rscript deleted file mode 100644 index ab898f90..00000000 --- a/tests/lldb/jni/MultipleRSFiles/jnimultiplersfiles/second.rscript +++ /dev/null @@ -1,25 +0,0 @@ -/* -* Copyright (C) 2016 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#pragma version(1) -#pragma rs java_package_name(com.android.rs.jnimultiplersfiles) - -/* RenderScript kernel that just returns the swizzled input. */ -uchar4 __attribute__((kernel)) second_kernel(uchar4 in) -{ - uchar4 result = in.wzyx; - return result; -} diff --git a/tests/lldb/jni/MultipleRSFiles/res/layout/main_layout.xml b/tests/lldb/jni/MultipleRSFiles/res/layout/main_layout.xml deleted file mode 100644 index 131c3b57..00000000 --- a/tests/lldb/jni/MultipleRSFiles/res/layout/main_layout.xml +++ /dev/null @@ -1,15 +0,0 @@ -<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:background="#0099cc" - tools:context=".MainActivity"> - - <ImageView - android:id="@+id/imageView" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:scaleType="fitCenter" /> - -</FrameLayout> - diff --git a/tests/lldb/jni/MultipleRSFiles/src/com/android/rs/jnimultiplersfiles/MainActivity.java b/tests/lldb/jni/MultipleRSFiles/src/com/android/rs/jnimultiplersfiles/MainActivity.java deleted file mode 100644 index ea743a62..00000000 --- a/tests/lldb/jni/MultipleRSFiles/src/com/android/rs/jnimultiplersfiles/MainActivity.java +++ /dev/null @@ -1,43 +0,0 @@ -/* -* Copyright (C) 2016 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -package com.android.rs.jnimultiplersfiles; - -import android.app.Activity; -import android.os.Bundle; -import android.graphics.BitmapFactory; -import android.graphics.Bitmap; -import android.widget.ImageView; - -public class MainActivity extends Activity { - private Bitmap mBitmapIn; - private Bitmap mBitmapOut; - - static { - System.loadLibrary("RS"); - System.loadLibrary("jnimultiplersfiles"); - } - - native void nativeRS(String cacheDir); - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.main_layout); - nativeRS(this.getCacheDir().toString()); - } -} - diff --git a/tests/lldb/jni/NoDebugWaitAttach/Android.mk b/tests/lldb/jni/NoDebugWaitAttach/Android.mk deleted file mode 100644 index 887b1996..00000000 --- a/tests/lldb/jni/NoDebugWaitAttach/Android.mk +++ /dev/null @@ -1,19 +0,0 @@ -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE_TAGS := tests - -LOCAL_SRC_FILES := $(call all-java-files-under, src) \ - $(call all-renderscript-files-under, src) - -LOCAL_PACKAGE_NAME := JNINoDebugWaitAttach -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_SDK_VERSION := current - -LOCAL_JNI_SHARED_LIBRARIES := libjninodebugwaitattach - -LOCAL_RENDERSCRIPT_FLAGS := -O0 -target-api 0 - -include $(BUILD_PACKAGE) -include $(LOCAL_PATH)/jninodebugwaitattach/Android.mk diff --git a/tests/lldb/jni/NoDebugWaitAttach/AndroidManifest.xml b/tests/lldb/jni/NoDebugWaitAttach/AndroidManifest.xml deleted file mode 100644 index 846eddd4..00000000 --- a/tests/lldb/jni/NoDebugWaitAttach/AndroidManifest.xml +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.rs.jninodebugwaitattach"> - <uses-sdk android:minSdkVersion="21" /> - <application android:label="JNINoDebugWaitAttach" - android:hardwareAccelerated="true"> - - <activity android:name="MainActivity"> - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> - </intent-filter> - </activity> - </application> -</manifest> diff --git a/tests/lldb/jni/NoDebugWaitAttach/jninodebugwaitattach/Android.mk b/tests/lldb/jni/NoDebugWaitAttach/jninodebugwaitattach/Android.mk deleted file mode 100644 index 19b08075..00000000 --- a/tests/lldb/jni/NoDebugWaitAttach/jninodebugwaitattach/Android.mk +++ /dev/null @@ -1,11 +0,0 @@ -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE := libjninodebugwaitattach -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice - -LOCAL_SRC_FILES := jninodebugwaitattach.cpp simple.rscript - -include frameworks/rs/tests/lldb/jni/common.mk -include $(BUILD_SHARED_LIBRARY) diff --git a/tests/lldb/jni/NoDebugWaitAttach/jninodebugwaitattach/jninodebugwaitattach.cpp b/tests/lldb/jni/NoDebugWaitAttach/jninodebugwaitattach/jninodebugwaitattach.cpp deleted file mode 100644 index 72ec36ec..00000000 --- a/tests/lldb/jni/NoDebugWaitAttach/jninodebugwaitattach/jninodebugwaitattach.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* -* Copyright (C) 2016 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include <memory> - -#include <jni.h> -#include <RenderScript.h> - -#include "ScriptC_simple.h" - -extern "C" void JNICALL -Java_com_android_rs_jninodebugwaitattach_MainActivity_nativeRS( - JNIEnv * env, - jclass, - jstring pathObj) -{ - static const int size = 8; - sp<RS> rs = new RS(); - - const char * path = env->GetStringUTFChars(pathObj, nullptr); - rs->init(path, RS_INIT_LOW_LATENCY | RS_INIT_WAIT_FOR_ATTACH); - env->ReleaseStringUTFChars(pathObj, path); - - auto e = Element::RGBA_8888(rs); - Type::Builder tb(rs, e); - tb.setX(size); - tb.setY(size); - auto t = tb.create(); - - auto a = Allocation::createTyped(rs, t); - auto b = Allocation::createTyped(rs, t); - - // Script is executed once, then the data is copied back when finished - sp<ScriptC_simple> s = new ScriptC_simple(rs); - s->forEach_simple_kernel(a, b); - uint32_t * output = new uint32_t[size*size]; - b->copy2DRangeTo(0, 0, size, size, output); - delete [] output; - - rs->finish(); -} - diff --git a/tests/lldb/jni/NoDebugWaitAttach/jninodebugwaitattach/simple.rscript b/tests/lldb/jni/NoDebugWaitAttach/jninodebugwaitattach/simple.rscript deleted file mode 100644 index c55e0b51..00000000 --- a/tests/lldb/jni/NoDebugWaitAttach/jninodebugwaitattach/simple.rscript +++ /dev/null @@ -1,32 +0,0 @@ -/* -* Copyright (C) 2016 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#pragma version(1) -#pragma rs java_package_name(com.android.rs.jninodebugwaitattach) - -float4 gColor = {0.299f, 0.587f, 0.114f, 1.f}; - -/* RenderScript kernel that just sets the colour of the screen and does some - * simple operations so it is not completely empty - * (and can therefore be debugged). - */ -uchar4 __attribute__((kernel)) simple_kernel(uchar4 in) -{ - float4 temp = rsUnpackColor8888(in); - temp = gColor; - uchar4 result = rsPackColorTo8888(temp); - return result; -}
\ No newline at end of file diff --git a/tests/lldb/jni/NoDebugWaitAttach/res/layout/main_layout.xml b/tests/lldb/jni/NoDebugWaitAttach/res/layout/main_layout.xml deleted file mode 100644 index 131c3b57..00000000 --- a/tests/lldb/jni/NoDebugWaitAttach/res/layout/main_layout.xml +++ /dev/null @@ -1,15 +0,0 @@ -<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:background="#0099cc" - tools:context=".MainActivity"> - - <ImageView - android:id="@+id/imageView" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:scaleType="fitCenter" /> - -</FrameLayout> - diff --git a/tests/lldb/jni/NoDebugWaitAttach/src/com/android/rs/jninodebugwaitattach/MainActivity.java b/tests/lldb/jni/NoDebugWaitAttach/src/com/android/rs/jninodebugwaitattach/MainActivity.java deleted file mode 100644 index 937e4d01..00000000 --- a/tests/lldb/jni/NoDebugWaitAttach/src/com/android/rs/jninodebugwaitattach/MainActivity.java +++ /dev/null @@ -1,43 +0,0 @@ -/* -* Copyright (C) 2016 The Android Open Source Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -package com.android.rs.jninodebugwaitattach; - -import android.app.Activity; -import android.os.Bundle; -import android.graphics.BitmapFactory; -import android.graphics.Bitmap; -import android.widget.ImageView; - -public class MainActivity extends Activity { - private Bitmap mBitmapIn; - private Bitmap mBitmapOut; - - static { - System.loadLibrary("RS"); - System.loadLibrary("jninodebugwaitattach"); - } - - native void nativeRS(String cacheDir); - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.main_layout); - nativeRS(this.getCacheDir().toString()); - } -} - diff --git a/tests/lldb/jni/common.mk b/tests/lldb/jni/common.mk deleted file mode 100644 index 74413077..00000000 --- a/tests/lldb/jni/common.mk +++ /dev/null @@ -1,13 +0,0 @@ -LOCAL_MODULE_TAGS := tests - -LOCAL_CPP_FEATURES += exceptions - -LOCAL_CFLAGS := -Werror -Wall -Wextra -std=c++11 -LOCAL_RENDERSCRIPT_FLAGS += -O0 -target-api 0 - -LOCAL_HEADER_LIBRARIES := jni_headers -LOCAL_SHARED_LIBRARIES += libdl liblog -LOCAL_STATIC_LIBRARIES += libRScpp_static - -LOCAL_SDK_VERSION := 23 -LOCAL_NDK_STL_VARIANT := c++_static diff --git a/tests/lldb/run_tests.py b/tests/lldb/run_tests.py deleted file mode 100755 index d1700bbd..00000000 --- a/tests/lldb/run_tests.py +++ /dev/null @@ -1,839 +0,0 @@ -#!/usr/bin/env python - -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -'''Main test suite execution script.''' -import argparse -import inspect -import logging -import os -import signal -import subprocess -import sys -import time -import collections -import xml.etree.ElementTree as ET - -from config import Config -from tests.harness import util_constants -from tests.harness.exception import TestSuiteException, FailFastException -from tests.harness import UtilAndroid -from tests.harness import UtilBundle -from tests.harness import util_log -from tests.harness.util_functions import load_py_module -from tests.harness.decorators import deprecated - -# For some reason pylint is not able to understand the class returned by -# from util_log.get_logger() and generates a lot of false warnings -#pylint: disable=maybe-no-member - -EMU_PROC = None - -def _parse_args(): - '''Parse the command line arguments. - - Returns: - A namespace object that contains the options specified to run_tests on - the command line. - ''' - - parser = argparse.ArgumentParser(description='Run the test suite.') - - parser.add_argument('--config', '-c', - metavar='path', - help='Path to a custom config file.') - parser.add_argument('--device', '-d', - help='Specify the device id of the device to test on.') - parser.add_argument('--test', '-t', - metavar='path', - help='Specify a specific test to run.') - group = parser.add_mutually_exclusive_group() - group.add_argument('--wimpy', '-w', - action='store_true', - default=None, - help='Test only a core subset of features.') - group.add_argument('--app-types', - default=['java', 'cpp', 'jni'], - nargs='*', - help='Specify a list of Android app types against which' - ' to run the tests', - dest='bundle_types') - parser.add_argument('--install-only', - action='store_true', - default=False, - help='It only runs the pre-run stage of the test suite.' - ' It installs the required APKs but does not ' - 'execute the tests.', - dest='install_only') - parser.add_argument('--no-install', '-n', - action='store_true', - default=False, - help='Stop the test suite installing apks to device.', - dest='noinstall') - parser.add_argument('--no-uninstall', - action='store_true', - default=False, - help='Stop the test suite uninstalling apks after ' - 'completion.', - dest='nouninstall') - parser.add_argument('--print-to-stdout', - action='store_true', - default=False, - help='Print all logging information to standard out.', - dest='print_to_stdout') - parser.add_argument('--verbose', '-v', - action='store_true', - default=None, - help='Store extra info in the log.') - parser.add_argument('--fail-fast', - action='store_true', - default=False, - help='Exit the test suite immediately on the first failure.') - parser.add_argument('--run-emu', - action='store_true', - default=None, - help='Spawn an emulator and run the test suite on that.' - ' Specify the emulator command line in the config' - ' file or with -emu-cmd.', - dest='run_emu') - - # Get the properties of the Config class and add a command line argument - # for each. - this_module = sys.modules[__name__] - for member_name, member_obj in inspect.getmembers(Config): - if (inspect.isdatadescriptor(member_obj) and - member_name not in ['__weakref__', 'device', 'verbose']): - - # List type properties can take one or more arguments - num_args = None - if (isinstance(member_obj, property) - and isinstance(member_obj.fget(Config), list)): - num_args = '+' - - opt_name = member_name.replace('_', '-') - - setattr(this_module, opt_name, '') - - parser.add_argument('--' + opt_name, - nargs=num_args, - help=member_obj.__doc__, - dest=member_name) - - return parser.parse_args() - - -def _choice(first_choice, second_choice): - '''Return first_choice if it is not None otherwise return second_choice. - - Args: - first_choice: The first choice value. - second_choice: The alternative value. - - Returns: - The first argument if it is not None, and the second otherwise. - ''' - return first_choice if first_choice else second_choice - - -class State(object): - '''This class manages all objects required by the test suite.''' - - # pylint: disable=too-many-instance-attributes - # Since this is a state class many attributes are expected. - - def __init__(self): - '''State constructor. - - Raises: - TestSuiteException: When unable to load config file. - - AssertionError: When assertions fail. - ''' - - # Parse the command line options - args = _parse_args() - - # create a config instance - if args.config: - # use the user supplied - config = State.load_user_configuration(args.config) - else: - # use the default configuration - config = Config() - - # save the test denylist - self.blocklist = _choice(args.blocklist, config.blocklist) - - # Allow any of the command line arguments to override the - # values in the config file. - self.adb_path = _choice(args.adb_path, config.adb_path) - - self.host_port = int(_choice(args.host_port, config.host_port)) - - self.device = _choice(args.device, config.device) - - self.user_specified_device = self.device - - self.device_port = int(_choice(args.device_port, config.device_port)) - - self.lldb_server_path_device = _choice(args.lldb_server_path_device, - config.lldb_server_path_device) - - self.lldb_server_path_host = _choice(args.lldb_server_path_host, - config.lldb_server_path_host) - - self.aosp_product_path = _choice(args.aosp_product_path, - config.aosp_product_path) - - self.log_file_path = _choice(args.log_file_path, config.log_file_path) - - self.results_file_path = _choice(args.results_file_path, - config.results_file_path) - - self.lldb_path = _choice(args.lldb_path, config.lldb_path) - self.print_to_stdout = args.print_to_stdout - self.verbose = _choice(args.verbose, config.verbose) - self.timeout = int(_choice(args.timeout, config.timeout)) - self.emu_cmd = _choice(args.emu_cmd, config.emu_cmd) - self.run_emu = args.run_emu - self.wimpy = args.wimpy - self.bundle_types = args.bundle_types if not self.wimpy else ['java'] - self.fail_fast = args.fail_fast - - # validate the param "verbose" - if not isinstance(self.verbose, bool): - raise TestSuiteException('The parameter "verbose" should be a ' - 'boolean: {0}'.format(self.verbose)) - - # create result array - self.results = dict() - self.single_test = args.test - - # initialise the logging facility - log_level = logging.INFO if not self.verbose else logging.DEBUG - util_log.initialise("driver", - print_to_stdout=self.print_to_stdout, - level=log_level, - file_mode='w', # open for write - file_path=self.log_file_path - ) - log = util_log.get_logger() - - if self.run_emu and not self.emu_cmd: - log.TestSuiteException('Need to specify --emu-cmd (or specify a' - ' value in the config file) if using --run-emu.') - - # create a results file - self.results_file = open(self.results_file_path, 'w') - - # create an android helper object - self.android = UtilAndroid(self.adb_path, - self.lldb_server_path_device, - self.device) - assert self.android - - # create a test bundle - self.bundle = UtilBundle(self.android, - self.aosp_product_path) - assert self.bundle - - # save the no pushing option - assert isinstance(args.noinstall, bool) - self.noinstall = args.noinstall - - assert isinstance(args.nouninstall, bool) - self.nouninstall = args.nouninstall - - # install only option - assert type(args.install_only) is bool - self.install_only = args.install_only - if self.install_only: - log.log_and_print('Option --install-only set. The test APKs will ' - 'be installed on the device but the tests will ' - 'not be executed.') - if self.noinstall: - raise TestSuiteException('Conflicting options given: ' - '--install-only and --no-install') - - # TCP port modifier which is used to increment the port number used for - # each test case to avoid collisions. - self.port_mod = 0 - - # total number of test files that have been executed - self.test_count = 0 - - def get_android(self): - '''Return the android ADB helper instance. - - Returns: - The android ADB helper, instance of UtilAndroid. - ''' - assert self.android - return self.android - - def get_bundle(self): - '''Return the test executable bundle. - - Returns: - The test exectable collection, instance of UtilBundle. - ''' - return self.bundle - - def add_result(self, name, app_type, result): - '''Add a test result to the collection. - - Args: - name: String name of the test that has executed. - app_type: type of app i.e. java, jni, or cpp - result: String result of the test, "pass", "fail", "error". - ''' - key = (name, app_type) - assert key not in self.results - self.results[key] = result - - def get_single_test(self): - '''Get the name of the single test to run. - - Returns: - A string that is the name of the python file containing the test to - be run. If all tests are to be run this returns None. - ''' - return self.single_test - - @staticmethod - def load_user_configuration(path): - '''Load the test suite config from the give path. - - Instantiate the Config class found in the module at the given path. - If no suitable class is available, it raises a TestSuiteException. - - Args: - path: String location of the module. - - Returns: - an instance of the Config class, defined in the module. - - Raises: - TestSuiteException: when unable to import the module or when a - subclass of Config is not found inside it. - ''' - - # load the module - config_module = load_py_module(path) - if not config_module: - raise TestSuiteException('Unable to import the module from "%s"' - % (path)) - - # look for a subclass of Config - for name, value in inspect.getmembers(config_module): - if (inspect.isclass(value) - and name != 'Config' - and issubclass(value, Config)): - # that's our candidate - return value() - - # otherwise there are no valid candidates - raise TestSuiteException('The provided user configuration is not ' - 'valid. The module must define a subclass ' - 'of Config') - - -def _kill_emulator(): - ''' Kill the emulator process. ''' - global EMU_PROC - if EMU_PROC: - try: - EMU_PROC.terminate() - except OSError: - # can't kill a dead proc - log = util_log.get_logger() - log.debug('Trying to kill an emulator but it is already dead.') - - -def _check_emulator_terminated(): - ''' Throw an exception if the emulator process has ended. - - Raises: - TestSuiteException: If the emulator process has ended. - ''' - global EMU_PROC - assert EMU_PROC - if EMU_PROC.poll(): - stdout, stderr = EMU_PROC.communicate() - raise TestSuiteException('The emulator terminated with output:' - '\nstderr: {0}\nstdout: {1}.'.format(stderr, stdout)) - - -@deprecated() -def _launch_emulator(state): - '''Launch the emulator and wait for it to boot. - - Args: - emu_cmd: The command line to run the emulator. - - Raises: - TestSuiteException: If an emulator already exists or the emulator - process terminated before we could connect to it, or - we failed to copy lldb-server to the emulator. - ''' - global EMU_PROC - android = state.android - if state.user_specified_device: - if android.device_with_substring_exists(state.user_specified_device): - raise TestSuiteException( - 'A device with name {0} already exists.', - state.user_specified_device) - else: - if android.device_with_substring_exists('emulator'): - raise TestSuiteException('An emulator already exists.') - - assert state.emu_cmd - EMU_PROC = subprocess.Popen(state.emu_cmd.split(), - stdout=None, - stderr=subprocess.STDOUT) - - log = util_log.get_logger() - log.info('Launching emulator with command line {0}'.format(state.emu_cmd)) - - tries_number = 180 - tries = tries_number - found_device = False - while not found_device: - try: - android.validate_device(False, 'emulator') - found_device = True - except TestSuiteException as ex: - tries -= 1 - if tries == 0: - # Avoid infinitely looping if the emulator won't boot - log.warning( - 'Giving up trying to validate device after {0} tries.' - .format(tries_number)) - raise ex - _check_emulator_terminated() - # wait a bit and try again, maybe it has now booted - time.sleep(10) - - tries = 500 - while not android.is_booted(): - tries -= 1 - if tries == 0: - # Avoid infinitely looping if the emulator won't boot - raise TestSuiteException('The emulator has failed to boot.') - _check_emulator_terminated() - time.sleep(5) - - # Need to be root before we can push lldb-server - android.adb_root() - android.wait_for_device() - - # Push the lldb-server executable to the device. - output = android.adb('push {0} {1}'.format(state.lldb_server_path_host, - state.lldb_server_path_device)) - - if 'failed to copy' in output or 'No such file or directory' in output: - raise TestSuiteException( - 'unable to push lldb-server to the emulator: {0}.' - .format(output)) - - output = android.shell('chmod a+x {0}' - .format(state.lldb_server_path_device)) - - if 'No such file or directory' in output: - raise TestSuiteException('Failed to copy lldb-server to the emulator.') - - -def _restart_emulator(state): - '''Kill the emulator and start a new instance. - - Args: - state: Test suite state collection, instance of State. - ''' - _kill_emulator() - _launch_emulator(state) - - -def _run_test(state, name, bundle_type): - '''Execute a single test case. - - Args: - state: Test suite state collection, instance of State. - name: String file name of the test to execute. - bundle_type: string for the installed app type (cpp|jni|java) - - Raises: - AssertionError: When assertion fails. - ''' - assert isinstance(name, str) - - try: - state.android.check_adb_alive() - except TestSuiteException as expt: - global EMU_PROC - if EMU_PROC: - _restart_emulator(state) - else: - raise expt - - log = util_log.get_logger() - sys.stdout.write('Running {0}\r'.format(name)) - sys.stdout.flush() - log.info('Running {0}'.format(name)) - - run_tests_dir = os.path.dirname(os.path.realpath(__file__)) - run_test_path = os.path.join(run_tests_dir, 'tests', 'run_test.py') - - # Forward port for lldb-server on the device to our host - hport = int(state.host_port) + state.port_mod - dport = int(state.device_port) + state.port_mod - state.android.forward_port(hport, dport) - state.port_mod += 1 - - log.debug('Giving up control to {0}...'.format(name)) - - params = map(str, [ - sys.executable, - run_test_path, - name, - state.log_file_path, - state.adb_path, - state.lldb_server_path_device, - state.aosp_product_path, - dport, - state.android.get_device_id(), - state.print_to_stdout, - state.verbose, - state.wimpy, - state.timeout, - bundle_type - ]) - - return_code = subprocess.call(params) - state.test_count += 1 - state.android.remove_port_forwarding() - log.seek_to_end() - - # report in sys.stdout the result - success = return_code == util_constants.RC_TEST_OK - status_handlers = collections.defaultdict(lambda: ('error', log.error), ( - (util_constants.RC_TEST_OK, ('pass', log.info)), - (util_constants.RC_TEST_TIMEOUT, ('timeout', log.error)), - (util_constants.RC_TEST_IGNORED, ('ignored', log.info)), - (util_constants.RC_TEST_FAIL, ('fail', log.critical)) - ) - ) - status_name, status_logger = status_handlers[return_code] - log.info('Running %s: %s', name, status_name.upper()) - status_logger("Test %r: %s", name, status_name) - - # Special case for ignored tests - just return now - if return_code == util_constants.RC_TEST_IGNORED: - return - - state.add_result(name, bundle_type, status_name) - - if state.fail_fast and not success: - raise FailFastException(name) - - # print a running total pass rate - passes = sum(1 for key, value in state.results.items() if value == 'pass') - log.info('Current pass rate: %s of %s executed.', passes, len(state.results)) - - -def _check_lldbserver_exists(state): - '''Check lldb-server exists on the target device and it is executable. - - Raises: - TestSuiteError: If lldb-server does not exist on the target. - ''' - assert state - - message = 'Unable to verify valid lldb-server on target' - - android = state.get_android() - assert android - - cmd = state.lldb_server_path_device - out = android.shell(cmd, False) - if not isinstance(out, str): - raise TestSuiteException(message) - if out.find('Usage:') < 0: - raise TestSuiteException(message) - - -def _suite_pre_run(state): - '''This function is executed before the test cases are run (setup). - - Args: - state: Test suite state collection, instance of State. - - Return: - True if the pre_run step completes without error. - Checks made: - - Validating that adb exists and runs. - - Validating that a device is attached. - - We have root access to the device. - - All test binaries were pushed to the device. - - The port for lldb-server was forwarded correctly. - - Raises: - AssertionError: When assertions fail. - ''' - assert state - log = util_log.get_logger() - - try: - android = state.get_android() - bundle = state.get_bundle() - assert android - assert bundle - - # validate ADB helper class - android.validate_adb() - log.log_and_print('Located ADB') - - if state.run_emu: - log.log_and_print('Launching emulator...') - _launch_emulator(state) - log.log_and_print('Started emulator ' + android.device) - else: - android.validate_device() - log.log_and_print('Located device ' + android.device) - - if state.noinstall and not state.single_test: - bundle.check_apps_installed(state.wimpy) - - # elevate to root user - android.adb_root() - android.wait_for_device() - # check that lldb-server exists on device - android.kill_servers() - _check_lldbserver_exists(state) - - if not state.noinstall: - # push all tests to the device - log.log_and_print('Pushing all tests...') - bundle.push_all() - log.log_and_print('Pushed all tests') - log.log_and_print('Pre run complete') - - except TestSuiteException as expt: - log.exception('Test suite pre run failure') - - # Even if we are logging the error, it may be helpful and more - # immediate to find out the error into the terminal - log.log_and_print('ERROR: Unable to set up the test suite: %s\n' - % expt.message, logging.ERROR) - - return False - return True - - -def _suite_post_run(state): - '''This function is executed after the test cases have run (teardown). - - Args: - state: Test suite state collection, instance of State. - Returns: - Number of failures - ''' - log = util_log.get_logger() - - if not state.noinstall and not state.nouninstall: - if state.wimpy: - state.bundle.uninstall_all_apk() - else: - state.bundle.uninstall_all() - log.log_and_print('Uninstalled/Deleted all tests') - - total = 0 - passes = 0 - failures = 0 - - results = ET.Element('testsuite') - results.attrib['name'] = 'LLDB RS Test Suite' - - for key, value in state.results.items(): - total += 1 - if value == 'pass': - passes += 1 - else: - failures += 1 - - # test case name, followed by pass, failure or error elements - testcase = ET.Element('testcase') - testcase.attrib['name'] = "%s:%s" % key - result_element = ET.Element(value) - result_element.text = "%s:%s" % key - testcase.append(result_element) - results.append(testcase) - - assert passes + failures == total, 'Invalid test results status' - if failures: - log.log_and_print( - 'The following failures occurred:\n%s\n' % - '\n'.join('failed: %s:%s' % test_spec - for test_spec, result in state.results.items() if result != 'pass' - )) - - log.log_and_print('{0} of {1} passed'.format(passes, total)) - if total: - log.log_and_print('{0}% rate'.format((passes*100)/total)) - - results.attrib['tests'] = str(total) - state.results_file.write(ET.tostring(results, encoding='iso-8859-1')) - - return failures - - -def _discover_tests(state): - '''Discover all tests in the tests directory. - - Returns: - List of strings, test file names from the 'tests' directory. - ''' - tests = [] - - single_test = state.get_single_test() - if single_test is None: - file_dir = os.path.dirname(os.path.realpath(__file__)) - tests_dir = os.path.join(file_dir, 'tests') - - for sub_dir in os.listdir(tests_dir): - current_test_dir = os.path.join(tests_dir, sub_dir) - if os.path.isdir(current_test_dir): - dir_name = os.path.basename(current_test_dir) - - if dir_name == 'harness': - continue - - for item in os.listdir(current_test_dir): - if (item.startswith('test') - and item.endswith('.py') - and not item in state.blocklist): - tests.append(item) - else: - if single_test.endswith('.py'): - tests.append(single_test) - else: - tests.append(single_test + '.py') - - return tests - - -def _deduce_python_path(state): - '''Try to deduce the PYTHONPATH environment variable via the LLDB binary. - - Args: - state: Test suite state collection, instance of State. - - Returns: - True if PYTHONPATH has been updated, False otherwise. - - Raises: - TestSuiteException: If lldb path provided in the config or command line - is incorrect. - AssertionError: If an assertion fails. - ''' - - lldb_path = state.lldb_path - if not lldb_path: - # lldb may not be provided in preference of a manual $PYTHONPATH - return False - - params = [lldb_path, '-P'] - - try: - proc = subprocess.Popen(params, stdout=subprocess.PIPE) - except OSError as err: - error_string = 'Could not run lldb at %s: %s' % (lldb_path, str(err)) - raise TestSuiteException(error_string) - - stdout = proc.communicate()[0] - if stdout: - os.environ['PYTHONPATH'] = stdout.strip() - return True - - return False - - -def main(): - '''The lldb-renderscript test suite entry point.''' - log = None - - try: - # parse the command line - state = State() - assert state - - # logging is initialised in State() - log = util_log.get_logger() - - # if we can, set PYTHONPATH for lldb bindings - if not _deduce_python_path(state): - log.log_and_print('Unable to deduce PYTHONPATH', logging.WARN) - - # pre run step - if not _suite_pre_run(state): - raise TestSuiteException('Test suite pre-run step failed') - # discover all tests and execute them - tests = _discover_tests(state) - log.log_and_print('Found {0} tests'.format(len(tests))) - if state.install_only: - log.log_and_print('Test applications installed. Terminating due to ' - '--install-only option') - else: - # run the tests - for bundle_type in state.bundle_types: - log.info("Running bundle type '%s'", bundle_type) - for item in tests: - _run_test(state, item, bundle_type) - # post run step - quit(0 if _suite_post_run(state) == 0 else 1) - - except AssertionError: - if log: - log.exception('Internal test suite error') - - print('Internal test suite error') - quit(1) - - except FailFastException: - log.exception('Early exit after first test failure') - quit(1) - - except TestSuiteException as error: - if log: - log.exception('Test suite exception') - - print('{0}'.format(str(error))) - quit(2) - - finally: - _kill_emulator() - logging.shutdown() - -def signal_handler(_, _unused): - '''Signal handler for SIGINT, caused by the user typing Ctrl-C.''' - # pylint: disable=unused-argument - # pylint: disable=protected-access - print('Ctrl+C!') - os._exit(1) - - -# execution trampoline -if __name__ == '__main__': - signal.signal(signal.SIGINT, signal_handler) - main() diff --git a/tests/lldb/tests/__init__.py b/tests/lldb/tests/__init__.py deleted file mode 100644 index d91549fa..00000000 --- a/tests/lldb/tests/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -'''This module contains a test runner, tests and utility code''' - - - -from . import harness diff --git a/tests/lldb/tests/harness/RS_funs.py b/tests/lldb/tests/harness/RS_funs.py deleted file mode 100644 index a5a0539c..00000000 --- a/tests/lldb/tests/harness/RS_funs.py +++ /dev/null @@ -1,1401 +0,0 @@ -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -'''A list of signatures for RS builtin functions and util functions for them. - -from __future__ import absolute_import - -Function signature syntax is usually C-like, however, fixed values can also be -specified for those functions where the input range is restricted. -Lines in the function table beginning with - are comments. -Also contains utility functions to build an LLDB expression from a single -function line. -''' - -import re - -# Remove blank and comment lines using a lambda. -FUNC_LIST = filter(lambda line: line.strip() - and not line.strip().startswith('-'), ''' -- math functions - -uchar abs(char v); -uchar2 abs(char2 v); -uchar3 abs(char3 v); -uchar4 abs(char4 v); -uint abs(int v); -uint2 abs(int2 v); -uint3 abs(int3 v); -uint4 abs(int4 v); -ushort abs(short v); -ushort2 abs(short2 v); -ushort3 abs(short3 v); -ushort4 abs(short4 v); - -float acos(float v); -float2 acos(float2 v); -float3 acos(float3 v); -float4 acos(float4 v); - -float acosh(float v); -float2 acosh(float2 v); -float3 acosh(float3 v); -float4 acosh(float4 v); - -float acospi(float v); -float2 acospi(float2 v); -float3 acospi(float3 v); -float4 acospi(float4 v); - -float asin(float v); -float2 asin(float2 v); -float3 asin(float3 v); -float4 asin(float4 v); - -float asinh(float v); -float2 asinh(float2 v); -float3 asinh(float3 v); -float4 asinh(float4 v); - -float asinpi(float v); -float2 asinpi(float2 v); -float3 asinpi(float3 v); -float4 asinpi(float4 v); - -float atan(float v); -float2 atan(float2 v); -float3 atan(float3 v); -float4 atan(float4 v); - -float atan2(float numerator, float denominator); -float2 atan2(float2 numerator, float2 denominator); -float3 atan2(float3 numerator, float3 denominator); -float4 atan2(float4 numerator, float4 denominator); - -float atan2pi(float numerator, float denominator); -float2 atan2pi(float2 numerator, float2 denominator); -float3 atan2pi(float3 numerator, float3 denominator); -float4 atan2pi(float4 numerator, float4 denominator); - -float atanh(float v); -float2 atanh(float2 v); -float3 atanh(float3 v); -float4 atanh(float4 v); - -float atanpi(float v); -float2 atanpi(float2 v); -float3 atanpi(float3 v); -float4 atanpi(float4 v); - -float cbrt(float v); -float2 cbrt(float2 v); -float3 cbrt(float3 v); -float4 cbrt(float4 v); - -float ceil(float v); -float2 ceil(float2 v); -float3 ceil(float3 v); -float4 ceil(float4 v); - -char clamp(char value, char min_value, char max_value); -char2 clamp(char2 value, char min_value, char max_value); -char2 clamp(char2 value, char2 min_value, char2 max_value); -char3 clamp(char3 value, char min_value, char max_value); -char3 clamp(char3 value, char3 min_value, char3 max_value); -char4 clamp(char4 value, char min_value, char max_value); -char4 clamp(char4 value, char4 min_value, char4 max_value); -float clamp(float value, float min_value, float max_value); -float2 clamp(float2 value, float min_value, float max_value); -float2 clamp(float2 value, float2 min_value, float2 max_value); -float3 clamp(float3 value, float min_value, float max_value); -float3 clamp(float3 value, float3 min_value, float3 max_value); -float4 clamp(float4 value, float min_value, float max_value); -float4 clamp(float4 value, float4 min_value, float4 max_value); -int clamp(int value, int min_value, int max_value); -int2 clamp(int2 value, int min_value, int max_value); -int2 clamp(int2 value, int2 min_value, int2 max_value); -int3 clamp(int3 value, int min_value, int max_value); -int3 clamp(int3 value, int3 min_value, int3 max_value); -int4 clamp(int4 value, int min_value, int max_value); -int4 clamp(int4 value, int4 min_value, int4 max_value); -long clamp(long value, long min_value, long max_value); -long2 clamp(long2 value, long min_value, long max_value); -long2 clamp(long2 value, long2 min_value, long2 max_value); -long3 clamp(long3 value, long min_value, long max_value); -long3 clamp(long3 value, long3 min_value, long3 max_value); -long4 clamp(long4 value, long min_value, long max_value); -long4 clamp(long4 value, long4 min_value, long4 max_value); -short clamp(short value, short min_value, short max_value); -short2 clamp(short2 value, short min_value, short max_value); -short2 clamp(short2 value, short2 min_value, short2 max_value); -short3 clamp(short3 value, short min_value, short max_value); -short3 clamp(short3 value, short3 min_value, short3 max_value); -short4 clamp(short4 value, short min_value, short max_value); -short4 clamp(short4 value, short4 min_value, short4 max_value); -uchar clamp(uchar value, uchar min_value, uchar max_value); -uchar2 clamp(uchar2 value, uchar min_value, uchar max_value); -uchar2 clamp(uchar2 value, uchar2 min_value, uchar2 max_value); -uchar3 clamp(uchar3 value, uchar min_value, uchar max_value); -uchar3 clamp(uchar3 value, uchar3 min_value, uchar3 max_value); -uchar4 clamp(uchar4 value, uchar min_value, uchar max_value); -uchar4 clamp(uchar4 value, uchar4 min_value, uchar4 max_value); -uint clamp(uint value, uint min_value, uint max_value); -uint2 clamp(uint2 value, uint min_value, uint max_value); -uint2 clamp(uint2 value, uint2 min_value, uint2 max_value); -uint3 clamp(uint3 value, uint min_value, uint max_value); -uint3 clamp(uint3 value, uint3 min_value, uint3 max_value); -uint4 clamp(uint4 value, uint min_value, uint max_value); -uint4 clamp(uint4 value, uint4 min_value, uint4 max_value); -ulong clamp(ulong value, ulong min_value, ulong max_value); -ulong2 clamp(ulong2 value, ulong min_value, ulong max_value); -ulong2 clamp(ulong2 value, ulong2 min_value, ulong2 max_value); -ulong3 clamp(ulong3 value, ulong min_value, ulong max_value); -ulong3 clamp(ulong3 value, ulong3 min_value, ulong3 max_value); -ulong4 clamp(ulong4 value, ulong min_value, ulong max_value); -ulong4 clamp(ulong4 value, ulong4 min_value, ulong4 max_value); -ushort clamp(ushort value, ushort min_value, ushort max_value); -ushort2 clamp(ushort2 value, ushort min_value, ushort max_value); -ushort2 clamp(ushort2 value, ushort2 min_value, ushort2 max_value); -ushort3 clamp(ushort3 value, ushort min_value, ushort max_value); -ushort3 clamp(ushort3 value, ushort3 min_value, ushort3 max_value); -ushort4 clamp(ushort4 value, ushort min_value, ushort max_value); -ushort4 clamp(ushort4 value, ushort4 min_value, ushort4 max_value); - -char clz(char value); -char2 clz(char2 value); -char3 clz(char3 value); -char4 clz(char4 value); -int clz(int value); -int2 clz(int2 value); -int3 clz(int3 value); -int4 clz(int4 value); -short clz(short value); -short2 clz(short2 value); -short3 clz(short3 value); -short4 clz(short4 value); -uchar clz(uchar value); -uchar2 clz(uchar2 value); -uchar3 clz(uchar3 value); -uchar4 clz(uchar4 value); -uint clz(uint value); -uint2 clz(uint2 value); -uint3 clz(uint3 value); -uint4 clz(uint4 value); -ushort clz(ushort value); -ushort2 clz(ushort2 value); -ushort3 clz(ushort3 value); -ushort4 clz(ushort4 value); - -float copysign(float magnitude_value, float sign_value); -float2 copysign(float2 magnitude_value, float2 sign_value); -float3 copysign(float3 magnitude_value, float3 sign_value); -float4 copysign(float4 magnitude_value, float4 sign_value); - -float cos(float v); -float2 cos(float2 v); -float3 cos(float3 v); -float4 cos(float4 v); - -float cosh(float v); -float2 cosh(float2 v); -float3 cosh(float3 v); -float4 cosh(float4 v); - -float cospi(float v); -float2 cospi(float2 v); -float3 cospi(float3 v); -float4 cospi(float4 v); - -float erf(float v); -float2 erf(float2 v); -float3 erf(float3 v); -float4 erf(float4 v); - -float erfc(float v); -float2 erfc(float2 v); -float3 erfc(float3 v); -float4 erfc(float4 v); - -float exp(float v); -float2 exp(float2 v); -float3 exp(float3 v); -float4 exp(float4 v); - -float exp10(float v); -float2 exp10(float2 v); -float3 exp10(float3 v); -float4 exp10(float4 v); - -float exp2(float v); -float2 exp2(float2 v); -float3 exp2(float3 v); -float4 exp2(float4 v); - -float expm1(float v); -float2 expm1(float2 v); -float3 expm1(float3 v); -float4 expm1(float4 v); - -float fabs(float v); -float2 fabs(float2 v); -float3 fabs(float3 v); -float4 fabs(float4 v); - -float fdim(float a, float b); -float2 fdim(float2 a, float2 b); -float3 fdim(float3 a, float3 b); -float4 fdim(float4 a, float4 b); - -float floor(float v); -float2 floor(float2 v); -float3 floor(float3 v); -float4 floor(float4 v); - -float fma(float multiplicand1, float multiplicand2, float offset); -float2 fma(float2 multiplicand1, float2 multiplicand2, float2 offset); -float3 fma(float3 multiplicand1, float3 multiplicand2, float3 offset); -float4 fma(float4 multiplicand1, float4 multiplicand2, float4 offset); - -float fmax(float a, float b); -float2 fmax(float2 a, float b); -float2 fmax(float2 a, float2 b); -float3 fmax(float3 a, float b); -float3 fmax(float3 a, float3 b); -float4 fmax(float4 a, float b); -float4 fmax(float4 a, float4 b); - -float fmin(float a, float b); -float2 fmin(float2 a, float b); -float2 fmin(float2 a, float2 b); -float3 fmin(float3 a, float b); -float3 fmin(float3 a, float3 b); -float4 fmin(float4 a, float b); -float4 fmin(float4 a, float4 b); - -float fmod(float numerator, float denominator); -float2 fmod(float2 numerator, float2 denominator); -float3 fmod(float3 numerator, float3 denominator); -float4 fmod(float4 numerator, float4 denominator); - -float fract(float v, float* floor); -float2 fract(float2 v, float2* floor); -float3 fract(float3 v, float3* floor); -float4 fract(float4 v, float4* floor); - -float frexp(float v, int* exponent); -float2 frexp(float2 v, int2* exponent); -float3 frexp(float3 v, int3* exponent); -float4 frexp(float4 v, int4* exponent); - -float half_recip(float v); -float2 half_recip(float2 v); -float3 half_recip(float3 v); -float4 half_recip(float4 v); - -float half_rsqrt(float v); -float2 half_rsqrt(float2 v); -float3 half_rsqrt(float3 v); -float4 half_rsqrt(float4 v); - -float half_sqrt(float v); -float2 half_sqrt(float2 v); -float3 half_sqrt(float3 v); -float4 half_sqrt(float4 v); - -float hypot(float a, float b); -float2 hypot(float2 a, float2 b); -float3 hypot(float3 a, float3 b); -float4 hypot(float4 a, float4 b); - -int ilogb(float v); -int2 ilogb(float2 v); -int3 ilogb(float3 v); -int4 ilogb(float4 v); - -float ldexp(float mantissa, int exponent); -float2 ldexp(float2 mantissa, int exponent); -float2 ldexp(float2 mantissa, int2 exponent); -float3 ldexp(float3 mantissa, int exponent); -float3 ldexp(float3 mantissa, int3 exponent); -float4 ldexp(float4 mantissa, int exponent); -float4 ldexp(float4 mantissa, int4 exponent); - -float lgamma(float v); -float lgamma(float v, int* sign_of_gamma); -float2 lgamma(float2 v); -float2 lgamma(float2 v, int2* sign_of_gamma); -float3 lgamma(float3 v); -float3 lgamma(float3 v, int3* sign_of_gamma); -float4 lgamma(float4 v); -float4 lgamma(float4 v, int4* sign_of_gamma); - -float log(float v); -float2 log(float2 v); -float3 log(float3 v); -float4 log(float4 v); - -float log10(float v); -float2 log10(float2 v); -float3 log10(float3 v); -float4 log10(float4 v); - -float log1p(float v); -float2 log1p(float2 v); -float3 log1p(float3 v); -float4 log1p(float4 v); - -float log2(float v); -float2 log2(float2 v); -float3 log2(float3 v); -float4 log2(float4 v); - -float logb(float v); -float2 logb(float2 v); -float3 logb(float3 v); -float4 logb(float4 v); - -float mad(float multiplicand1, float multiplicand2, float offset); -float2 mad(float2 multiplicand1, float2 multiplicand2, float2 offset); -float3 mad(float3 multiplicand1, float3 multiplicand2, float3 offset); -float4 mad(float4 multiplicand1, float4 multiplicand2, float4 offset); - -char max(char a, char b); -char2 max(char2 a, char2 b); -char3 max(char3 a, char3 b); -char4 max(char4 a, char4 b); -float max(float a, float b); -float2 max(float2 a, float2 b); -float3 max(float3 a, float3 b); -float4 max(float4 a, float4 b); -int max(int a, int b); -int2 max(int2 a, int2 b); -int3 max(int3 a, int3 b); -int4 max(int4 a, int4 b); -long max(long a, long b); -long2 max(long2 a, long2 b); -long3 max(long3 a, long3 b); -long4 max(long4 a, long4 b); -short max(short a, short b); -short2 max(short2 a, short2 b); -short3 max(short3 a, short3 b); -short4 max(short4 a, short4 b); -uchar max(uchar a, uchar b); -uchar2 max(uchar2 a, uchar2 b); -uchar3 max(uchar3 a, uchar3 b); -uchar4 max(uchar4 a, uchar4 b); -uint max(uint a, uint b); -uint2 max(uint2 a, uint2 b); -uint3 max(uint3 a, uint3 b); -uint4 max(uint4 a, uint4 b); -ulong max(ulong a, ulong b); -ulong2 max(ulong2 a, ulong2 b); -ulong3 max(ulong3 a, ulong3 b); -ulong4 max(ulong4 a, ulong4 b); -ushort max(ushort a, ushort b); -ushort2 max(ushort2 a, ushort2 b); -ushort3 max(ushort3 a, ushort3 b); -ushort4 max(ushort4 a, ushort4 b); - -char min(char a, char b); -char2 min(char2 a, char2 b); -char3 min(char3 a, char3 b); -char4 min(char4 a, char4 b); -float min(float a, float b); -float2 min(float2 a, float2 b); -float3 min(float3 a, float3 b); -float4 min(float4 a, float4 b); -int min(int a, int b); -int2 min(int2 a, int2 b); -int3 min(int3 a, int3 b); -int4 min(int4 a, int4 b); -long min(long a, long b); -long2 min(long2 a, long2 b); -long3 min(long3 a, long3 b); -long4 min(long4 a, long4 b); -short min(short a, short b); -short2 min(short2 a, short2 b); -short3 min(short3 a, short3 b); -short4 min(short4 a, short4 b); -uchar min(uchar a, uchar b); -uchar2 min(uchar2 a, uchar2 b); -uchar3 min(uchar3 a, uchar3 b); -uchar4 min(uchar4 a, uchar4 b); -uint min(uint a, uint b); -uint2 min(uint2 a, uint2 b); -uint3 min(uint3 a, uint3 b); -uint4 min(uint4 a, uint4 b); -ulong min(ulong a, ulong b); -ulong2 min(ulong2 a, ulong2 b); -ulong3 min(ulong3 a, ulong3 b); -ulong4 min(ulong4 a, ulong4 b); -ushort min(ushort a, ushort b); -ushort2 min(ushort2 a, ushort2 b); -ushort3 min(ushort3 a, ushort3 b); -ushort4 min(ushort4 a, ushort4 b); - -float mix(float start, float stop, float fraction); -float2 mix(float2 start, float2 stop, float fraction); -float2 mix(float2 start, float2 stop, float2 fraction); -float3 mix(float3 start, float3 stop, float fraction); -float3 mix(float3 start, float3 stop, float3 fraction); -float4 mix(float4 start, float4 stop, float fraction); -float4 mix(float4 start, float4 stop, float4 fraction); - -float modf(float v, float* integral_part); -float2 modf(float2 v, float2* integral_part); -float3 modf(float3 v, float3* integral_part); -float4 modf(float4 v, float4* integral_part); - -float nan(uint v); - -float native_acos(float v); -float2 native_acos(float2 v); -float3 native_acos(float3 v); -float4 native_acos(float4 v); - -float native_acosh(float v); -float2 native_acosh(float2 v); -float3 native_acosh(float3 v); -float4 native_acosh(float4 v); - -float native_acospi(float v); -float2 native_acospi(float2 v); -float3 native_acospi(float3 v); -float4 native_acospi(float4 v); - -float native_asin(float v); -float2 native_asin(float2 v); -float3 native_asin(float3 v); -float4 native_asin(float4 v); - -float native_asinh(float v); -float2 native_asinh(float2 v); -float3 native_asinh(float3 v); -float4 native_asinh(float4 v); - -float native_asinpi(float v); -float2 native_asinpi(float2 v); -float3 native_asinpi(float3 v); -float4 native_asinpi(float4 v); - -float native_atan(float v); -float2 native_atan(float2 v); -float3 native_atan(float3 v); -float4 native_atan(float4 v); - -float native_atan2(float numerator, float denominator); -float2 native_atan2(float2 numerator, float2 denominator); -float3 native_atan2(float3 numerator, float3 denominator); -float4 native_atan2(float4 numerator, float4 denominator); - -float native_atan2pi(float numerator, float denominator); -float2 native_atan2pi(float2 numerator, float2 denominator); -float3 native_atan2pi(float3 numerator, float3 denominator); -float4 native_atan2pi(float4 numerator, float4 denominator); - -float native_atanh(float v); -float2 native_atanh(float2 v); -float3 native_atanh(float3 v); -float4 native_atanh(float4 v); - -float native_atanpi(float v); -float2 native_atanpi(float2 v); -float3 native_atanpi(float3 v); -float4 native_atanpi(float4 v); - -float native_cbrt(float v); -float2 native_cbrt(float2 v); -float3 native_cbrt(float3 v); -float4 native_cbrt(float4 v); - -float native_cos(float v); -float2 native_cos(float2 v); -float3 native_cos(float3 v); -float4 native_cos(float4 v); - -float native_cosh(float v); -float2 native_cosh(float2 v); -float3 native_cosh(float3 v); -float4 native_cosh(float4 v); - -float native_cospi(float v); -float2 native_cospi(float2 v); -float3 native_cospi(float3 v); -float4 native_cospi(float4 v); - -float native_divide(float left_vector, float right_vector); -float2 native_divide(float2 left_vector, float2 right_vector); -float3 native_divide(float3 left_vector, float3 right_vector); -float4 native_divide(float4 left_vector, float4 right_vector); - -float native_exp(float v); -float2 native_exp(float2 v); -float3 native_exp(float3 v); -float4 native_exp(float4 v); - -float native_exp10(float v); -float2 native_exp10(float2 v); -float3 native_exp10(float3 v); -float4 native_exp10(float4 v); - -float native_exp2(float v); -float2 native_exp2(float2 v); -float3 native_exp2(float3 v); -float4 native_exp2(float4 v); - -float native_expm1(float v); -float2 native_expm1(float2 v); -float3 native_expm1(float3 v); -float4 native_expm1(float4 v); - -float native_hypot(float a, float b); -float2 native_hypot(float2 a, float2 b); -float3 native_hypot(float3 a, float3 b); -float4 native_hypot(float4 a, float4 b); - -float native_log(float v); -float2 native_log(float2 v); -float3 native_log(float3 v); -float4 native_log(float4 v); - -float native_log10(float v); -float2 native_log10(float2 v); -float3 native_log10(float3 v); -float4 native_log10(float4 v); - -float native_log1p(float v); -float2 native_log1p(float2 v); -float3 native_log1p(float3 v); -float4 native_log1p(float4 v); - -float native_log2(float v); -float2 native_log2(float2 v); -float3 native_log2(float3 v); -float4 native_log2(float4 v); - -float native_powr(float base, float exponent); -float2 native_powr(float2 base, float2 exponent); -float3 native_powr(float3 base, float3 exponent); -float4 native_powr(float4 base, float4 exponent); - -float native_recip(float v); -float2 native_recip(float2 v); -float3 native_recip(float3 v); -float4 native_recip(float4 v); - -float native_rootn(float v, int n); -float2 native_rootn(float2 v, int2 n); -float3 native_rootn(float3 v, int3 n); -float4 native_rootn(float4 v, int4 n); - -float native_rsqrt(float v); -float2 native_rsqrt(float2 v); -float3 native_rsqrt(float3 v); -float4 native_rsqrt(float4 v); - -float native_sin(float v); -float2 native_sin(float2 v); -float3 native_sin(float3 v); -float4 native_sin(float4 v); - -float native_sincos(float v, float* cos); -float2 native_sincos(float2 v, float2* cos); -float3 native_sincos(float3 v, float3* cos); -float4 native_sincos(float4 v, float4* cos); - -float native_sinh(float v); -float2 native_sinh(float2 v); -float3 native_sinh(float3 v); -float4 native_sinh(float4 v); - -float native_sinpi(float v); -float2 native_sinpi(float2 v); -float3 native_sinpi(float3 v); -float4 native_sinpi(float4 v); - -float native_sqrt(float v); -float2 native_sqrt(float2 v); -float3 native_sqrt(float3 v); -float4 native_sqrt(float4 v); - -float native_tan(float v); -float2 native_tan(float2 v); -float3 native_tan(float3 v); -float4 native_tan(float4 v); - -float native_tanh(float v); -float2 native_tanh(float2 v); -float3 native_tanh(float3 v); -float4 native_tanh(float4 v); - -float native_tanpi(float v); -float2 native_tanpi(float2 v); -float3 native_tanpi(float3 v); -float4 native_tanpi(float4 v); - -float nextafter(float v, float target); -float2 nextafter(float2 v, float2 target); -float3 nextafter(float3 v, float3 target); -float4 nextafter(float4 v, float4 target); - -float pow(float base, float exponent); -float2 pow(float2 base, float2 exponent); -float3 pow(float3 base, float3 exponent); -float4 pow(float4 base, float4 exponent); - -float pown(float base, int exponent); -float2 pown(float2 base, int2 exponent); -float3 pown(float3 base, int3 exponent); -float4 pown(float4 base, int4 exponent); - -float powr(float base, float exponent); -float2 powr(float2 base, float2 exponent); -float3 powr(float3 base, float3 exponent); -float4 powr(float4 base, float4 exponent); - -float radians(float v); -float2 radians(float2 v); -float3 radians(float3 v); -float4 radians(float4 v); - -float remainder(float numerator, float denominator); -float2 remainder(float2 numerator, float2 denominator); -float3 remainder(float3 numerator, float3 denominator); -float4 remainder(float4 numerator, float4 denominator); - -float remquo(float numerator, float denominator, int* quotient); -float2 remquo(float2 numerator, float2 denominator, int2* quotient); -float3 remquo(float3 numerator, float3 denominator, int3* quotient); -float4 remquo(float4 numerator, float4 denominator, int4* quotient); - -float rint(float v); -float2 rint(float2 v); -float3 rint(float3 v); -float4 rint(float4 v); - -float rootn(float v, int n); -float2 rootn(float2 v, int2 n); -float3 rootn(float3 v, int3 n); -float4 rootn(float4 v, int4 n); - -float round(float v); -float2 round(float2 v); -float3 round(float3 v); -float4 round(float4 v); - -char rsClamp(char amount, char low, char high); -int rsClamp(int amount, int low, int high); -short rsClamp(short amount, short low, short high); -uchar rsClamp(uchar amount, uchar low, uchar high); -uint rsClamp(uint amount, uint low, uint high); -ushort rsClamp(ushort amount, ushort low, ushort high); - -float rsFrac(float v); - -float rsRand(float max_value); -float rsRand(float min_value, float max_value); -int rsRand(int max_value); -int rsRand(int min_value, int max_value); - -float rsqrt(float v); -float2 rsqrt(float2 v); -float3 rsqrt(float3 v); -float4 rsqrt(float4 v); - -float sign(float v); -float2 sign(float2 v); -float3 sign(float3 v); -float4 sign(float4 v); - -float sin(float v); -float2 sin(float2 v); -float3 sin(float3 v); -float4 sin(float4 v); - -float sincos(float v, float* cos); -float2 sincos(float2 v, float2* cos); -float3 sincos(float3 v, float3* cos); -float4 sincos(float4 v, float4* cos); - -float sinh(float v); -float2 sinh(float2 v); -float3 sinh(float3 v); -float4 sinh(float4 v); - -float sinpi(float v); -float2 sinpi(float2 v); -float3 sinpi(float3 v); -float4 sinpi(float4 v); - -float sqrt(float v); -float2 sqrt(float2 v); -float3 sqrt(float3 v); -float4 sqrt(float4 v); - -float step(float edge, float v); -float2 step(float edge, float2 v); -float2 step(float2 edge, float v); -float2 step(float2 edge, float2 v); -float3 step(float edge, float3 v); -float3 step(float3 edge, float v); -float3 step(float3 edge, float3 v); -float4 step(float edge, float4 v); -float4 step(float4 edge, float v); -float4 step(float4 edge, float4 v); - -float tan(float v); -float2 tan(float2 v); -float3 tan(float3 v); -float4 tan(float4 v); - -float tanh(float v); -float2 tanh(float2 v); -float3 tanh(float3 v); -float4 tanh(float4 v); - -float tanpi(float v); -float2 tanpi(float2 v); -float3 tanpi(float3 v); -float4 tanpi(float4 v); - -float tgamma(float v); -float2 tgamma(float2 v); -float3 tgamma(float3 v); -float4 tgamma(float4 v); - -float trunc(float v); -float2 trunc(float2 v); -float3 trunc(float3 v); -float4 trunc(float4 v); - -uchar4 rsPackColorTo8888(float r, float g, float b); -uchar4 rsPackColorTo8888(float r, float g, float b, float a); -uchar4 rsPackColorTo8888(float3 color); -uchar4 rsPackColorTo8888(float4 color); -float4 rsUnpackColor8888(uchar4 c); - -float4 rsYuvToRGBA_float4(uchar y, uchar u, uchar v); -uchar4 rsYuvToRGBA_uchar4(uchar y, uchar u, uchar v); - -- vector functions - -float3 cross(float3 left_vector, float3 right_vector); -float4 cross(float4 left_vector, float4 right_vector); - -float distance(float left_vector, float right_vector); -float distance(float2 left_vector, float2 right_vector); -float distance(float3 left_vector, float3 right_vector); -float distance(float4 left_vector, float4 right_vector); - -float dot(float left_vector, float right_vector); -float dot(float2 left_vector, float2 right_vector); -float dot(float3 left_vector, float3 right_vector); -float dot(float4 left_vector, float4 right_vector); - -float fast_distance(float left_vector, float right_vector); -float fast_distance(float2 left_vector, float2 right_vector); -float fast_distance(float3 left_vector, float3 right_vector); -float fast_distance(float4 left_vector, float4 right_vector); - -float fast_length(float v); -float fast_length(float2 v); -float fast_length(float3 v); -float fast_length(float4 v); - -float fast_normalize(float v); -float2 fast_normalize(float2 v); -float3 fast_normalize(float3 v); -float4 fast_normalize(float4 v); - -float length(float v); -float length(float2 v); -float length(float3 v); -float length(float4 v); - -float native_distance(float left_vector, float right_vector); -float native_distance(float2 left_vector, float2 right_vector); -float native_distance(float3 left_vector, float3 right_vector); -float native_distance(float4 left_vector, float4 right_vector); - -float native_length(float v); -float native_length(float2 v); -float native_length(float3 v); -float native_length(float4 v); - -float native_normalize(float v); -float2 native_normalize(float2 v); -float3 native_normalize(float3 v); -float4 native_normalize(float4 v); - -float normalize(float v); -float2 normalize(float2 v); -float3 normalize(float3 v); -float4 normalize(float4 v); - -- conversion functions - -char2 convert_char2(char2 v); -char2 convert_char2(double2 v); -char2 convert_char2(float2 v); -char2 convert_char2(int2 v); -char2 convert_char2(long2 v); -char2 convert_char2(short2 v); -char2 convert_char2(uchar2 v); -char2 convert_char2(uint2 v); -char2 convert_char2(ulong2 v); -char2 convert_char2(ushort2 v); - -char3 convert_char3(char3 v); -char3 convert_char3(double3 v); -char3 convert_char3(float3 v); -char3 convert_char3(int3 v); -char3 convert_char3(long3 v); -char3 convert_char3(short3 v); -char3 convert_char3(uchar3 v); -char3 convert_char3(uint3 v); -char3 convert_char3(ulong3 v); -char3 convert_char3(ushort3 v); - -char4 convert_char4(char4 v); -char4 convert_char4(double4 v); -char4 convert_char4(float4 v); -char4 convert_char4(int4 v); -char4 convert_char4(long4 v); -char4 convert_char4(short4 v); -char4 convert_char4(uchar4 v); -char4 convert_char4(uint4 v); -char4 convert_char4(ulong4 v); -char4 convert_char4(ushort4 v); - -double2 convert_double2(char2 v); -double2 convert_double2(double2 v); -double2 convert_double2(float2 v); -double2 convert_double2(int2 v); -double2 convert_double2(long2 v); -double2 convert_double2(short2 v); -double2 convert_double2(uchar2 v); -double2 convert_double2(uint2 v); -double2 convert_double2(ulong2 v); -double2 convert_double2(ushort2 v); - -double3 convert_double3(char3 v); -double3 convert_double3(double3 v); -double3 convert_double3(float3 v); -double3 convert_double3(int3 v); -double3 convert_double3(long3 v); -double3 convert_double3(short3 v); -double3 convert_double3(uchar3 v); -double3 convert_double3(uint3 v); -double3 convert_double3(ulong3 v); -double3 convert_double3(ushort3 v); - -double4 convert_double4(char4 v); -double4 convert_double4(double4 v); -double4 convert_double4(float4 v); -double4 convert_double4(int4 v); -double4 convert_double4(long4 v); -double4 convert_double4(short4 v); -double4 convert_double4(uchar4 v); -double4 convert_double4(uint4 v); -double4 convert_double4(ulong4 v); -double4 convert_double4(ushort4 v); - -float2 convert_float2(char2 v); -float2 convert_float2(double2 v); -float2 convert_float2(float2 v); -float2 convert_float2(int2 v); -float2 convert_float2(long2 v); -float2 convert_float2(short2 v); -float2 convert_float2(uchar2 v); -float2 convert_float2(uint2 v); -float2 convert_float2(ulong2 v); -float2 convert_float2(ushort2 v); - -float3 convert_float3(char3 v); -float3 convert_float3(double3 v); -float3 convert_float3(float3 v); -float3 convert_float3(int3 v); -float3 convert_float3(long3 v); -float3 convert_float3(short3 v); -float3 convert_float3(uchar3 v); -float3 convert_float3(uint3 v); -float3 convert_float3(ulong3 v); -float3 convert_float3(ushort3 v); - -float4 convert_float4(char4 v); -float4 convert_float4(double4 v); -float4 convert_float4(float4 v); -float4 convert_float4(int4 v); -float4 convert_float4(long4 v); -float4 convert_float4(short4 v); -float4 convert_float4(uchar4 v); -float4 convert_float4(uint4 v); -float4 convert_float4(ulong4 v); -float4 convert_float4(ushort4 v); - -int2 convert_int2(char2 v); -int2 convert_int2(double2 v); -int2 convert_int2(float2 v); -int2 convert_int2(int2 v); -int2 convert_int2(long2 v); -int2 convert_int2(short2 v); -int2 convert_int2(uchar2 v); -int2 convert_int2(uint2 v); -int2 convert_int2(ulong2 v); -int2 convert_int2(ushort2 v); - -int3 convert_int3(char3 v); -int3 convert_int3(double3 v); -int3 convert_int3(float3 v); -int3 convert_int3(int3 v); -int3 convert_int3(long3 v); -int3 convert_int3(short3 v); -int3 convert_int3(uchar3 v); -int3 convert_int3(uint3 v); -int3 convert_int3(ulong3 v); -int3 convert_int3(ushort3 v); - -int4 convert_int4(char4 v); -int4 convert_int4(double4 v); -int4 convert_int4(float4 v); -int4 convert_int4(int4 v); -int4 convert_int4(long4 v); -int4 convert_int4(short4 v); -int4 convert_int4(uchar4 v); -int4 convert_int4(uint4 v); -int4 convert_int4(ulong4 v); -int4 convert_int4(ushort4 v); - -long2 convert_long2(char2 v); -long2 convert_long2(double2 v); -long2 convert_long2(float2 v); -long2 convert_long2(int2 v); -long2 convert_long2(long2 v); -long2 convert_long2(short2 v); -long2 convert_long2(uchar2 v); -long2 convert_long2(uint2 v); -long2 convert_long2(ulong2 v); -long2 convert_long2(ushort2 v); - -long3 convert_long3(char3 v); -long3 convert_long3(double3 v); -long3 convert_long3(float3 v); -long3 convert_long3(int3 v); -long3 convert_long3(long3 v); -long3 convert_long3(short3 v); -long3 convert_long3(uchar3 v); -long3 convert_long3(uint3 v); -long3 convert_long3(ulong3 v); -long3 convert_long3(ushort3 v); - -long4 convert_long4(char4 v); -long4 convert_long4(double4 v); -long4 convert_long4(float4 v); -long4 convert_long4(int4 v); -long4 convert_long4(long4 v); -long4 convert_long4(short4 v); -long4 convert_long4(uchar4 v); -long4 convert_long4(uint4 v); -long4 convert_long4(ulong4 v); -long4 convert_long4(ushort4 v); - -short2 convert_short2(char2 v); -short2 convert_short2(double2 v); -short2 convert_short2(float2 v); -short2 convert_short2(int2 v); -short2 convert_short2(long2 v); -short2 convert_short2(short2 v); -short2 convert_short2(uchar2 v); -short2 convert_short2(uint2 v); -short2 convert_short2(ulong2 v); -short2 convert_short2(ushort2 v); - -short3 convert_short3(char3 v); -short3 convert_short3(double3 v); -short3 convert_short3(float3 v); -short3 convert_short3(int3 v); -short3 convert_short3(long3 v); -short3 convert_short3(short3 v); -short3 convert_short3(uchar3 v); -short3 convert_short3(uint3 v); -short3 convert_short3(ulong3 v); -short3 convert_short3(ushort3 v); - -short4 convert_short4(char4 v); -short4 convert_short4(double4 v); -short4 convert_short4(float4 v); -short4 convert_short4(int4 v); -short4 convert_short4(long4 v); -short4 convert_short4(short4 v); -short4 convert_short4(uchar4 v); -short4 convert_short4(uint4 v); -short4 convert_short4(ulong4 v); -short4 convert_short4(ushort4 v); - -uchar2 convert_uchar2(char2 v); -uchar2 convert_uchar2(double2 v); -uchar2 convert_uchar2(float2 v); -uchar2 convert_uchar2(int2 v); -uchar2 convert_uchar2(long2 v); -uchar2 convert_uchar2(short2 v); -uchar2 convert_uchar2(uchar2 v); -uchar2 convert_uchar2(uint2 v); -uchar2 convert_uchar2(ulong2 v); -uchar2 convert_uchar2(ushort2 v); - -uchar3 convert_uchar3(char3 v); -uchar3 convert_uchar3(double3 v); -uchar3 convert_uchar3(float3 v); -uchar3 convert_uchar3(int3 v); -uchar3 convert_uchar3(long3 v); -uchar3 convert_uchar3(short3 v); -uchar3 convert_uchar3(uchar3 v); -uchar3 convert_uchar3(uint3 v); -uchar3 convert_uchar3(ulong3 v); -uchar3 convert_uchar3(ushort3 v); - -uchar4 convert_uchar4(char4 v); -uchar4 convert_uchar4(double4 v); -uchar4 convert_uchar4(float4 v); -uchar4 convert_uchar4(int4 v); -uchar4 convert_uchar4(long4 v); -uchar4 convert_uchar4(short4 v); -uchar4 convert_uchar4(uchar4 v); -uchar4 convert_uchar4(uint4 v); -uchar4 convert_uchar4(ulong4 v); -uchar4 convert_uchar4(ushort4 v); - -uint2 convert_uint2(char2 v); -uint2 convert_uint2(double2 v); -uint2 convert_uint2(float2 v); -uint2 convert_uint2(int2 v); -uint2 convert_uint2(long2 v); -uint2 convert_uint2(short2 v); -uint2 convert_uint2(uchar2 v); -uint2 convert_uint2(uint2 v); -uint2 convert_uint2(ulong2 v); -uint2 convert_uint2(ushort2 v); - -uint3 convert_uint3(char3 v); -uint3 convert_uint3(double3 v); -uint3 convert_uint3(float3 v); -uint3 convert_uint3(int3 v); -uint3 convert_uint3(long3 v); -uint3 convert_uint3(short3 v); -uint3 convert_uint3(uchar3 v); -uint3 convert_uint3(uint3 v); -uint3 convert_uint3(ulong3 v); -uint3 convert_uint3(ushort3 v); - -uint4 convert_uint4(char4 v); -uint4 convert_uint4(double4 v); -uint4 convert_uint4(float4 v); -uint4 convert_uint4(int4 v); -uint4 convert_uint4(long4 v); -uint4 convert_uint4(short4 v); -uint4 convert_uint4(uchar4 v); -uint4 convert_uint4(uint4 v); -uint4 convert_uint4(ulong4 v); -uint4 convert_uint4(ushort4 v); - -ulong2 convert_ulong2(char2 v); -ulong2 convert_ulong2(double2 v); -ulong2 convert_ulong2(float2 v); -ulong2 convert_ulong2(int2 v); -ulong2 convert_ulong2(long2 v); -ulong2 convert_ulong2(short2 v); -ulong2 convert_ulong2(uchar2 v); -ulong2 convert_ulong2(uint2 v); -ulong2 convert_ulong2(ulong2 v); -ulong2 convert_ulong2(ushort2 v); - -ulong3 convert_ulong3(char3 v); -ulong3 convert_ulong3(double3 v); -ulong3 convert_ulong3(float3 v); -ulong3 convert_ulong3(int3 v); -ulong3 convert_ulong3(long3 v); -ulong3 convert_ulong3(short3 v); -ulong3 convert_ulong3(uchar3 v); -ulong3 convert_ulong3(uint3 v); -ulong3 convert_ulong3(ulong3 v); -ulong3 convert_ulong3(ushort3 v); - -ulong4 convert_ulong4(char4 v); -ulong4 convert_ulong4(double4 v); -ulong4 convert_ulong4(float4 v); -ulong4 convert_ulong4(int4 v); -ulong4 convert_ulong4(long4 v); -ulong4 convert_ulong4(short4 v); -ulong4 convert_ulong4(uchar4 v); -ulong4 convert_ulong4(uint4 v); -ulong4 convert_ulong4(ulong4 v); -ulong4 convert_ulong4(ushort4 v); - -ushort2 convert_ushort2(char2 v); -ushort2 convert_ushort2(double2 v); -ushort2 convert_ushort2(float2 v); -ushort2 convert_ushort2(int2 v); -ushort2 convert_ushort2(long2 v); -ushort2 convert_ushort2(short2 v); -ushort2 convert_ushort2(uchar2 v); -ushort2 convert_ushort2(uint2 v); -ushort2 convert_ushort2(ulong2 v); -ushort2 convert_ushort2(ushort2 v); - -ushort3 convert_ushort3(char3 v); -ushort3 convert_ushort3(double3 v); -ushort3 convert_ushort3(float3 v); -ushort3 convert_ushort3(int3 v); -ushort3 convert_ushort3(long3 v); -ushort3 convert_ushort3(short3 v); -ushort3 convert_ushort3(uchar3 v); -ushort3 convert_ushort3(uint3 v); -ushort3 convert_ushort3(ulong3 v); -ushort3 convert_ushort3(ushort3 v); - -ushort4 convert_ushort4(char4 v); -ushort4 convert_ushort4(double4 v); -ushort4 convert_ushort4(float4 v); -ushort4 convert_ushort4(int4 v); -ushort4 convert_ushort4(long4 v); -ushort4 convert_ushort4(short4 v); -ushort4 convert_ushort4(uchar4 v); -ushort4 convert_ushort4(uint4 v); -ushort4 convert_ushort4(ulong4 v); -ushort4 convert_ushort4(ushort4 v); - -uchar4 rsPackColorTo8888(float r, float g, float b); -uchar4 rsPackColorTo8888(float r, float g, float b, float a); -uchar4 rsPackColorTo8888(float3 color); -uchar4 rsPackColorTo8888(float4 color); - -float4 rsUnpackColor8888(uchar4 c); - -float4 rsYuvToRGBA_float4(uchar y, uchar u, uchar v); - -uchar4 rsYuvToRGBA_uchar4(uchar y, uchar u, uchar v); - -- matrix functions, some of these are not supported yet - --bool rsMatrixInverse(rs_matrix4x4* m); - --bool rsMatrixInverseTranspose(rs_matrix4x4* m); - --void rsMatrixLoad(rs_matrix2x2* destination, float* array); --void rsMatrixLoad(rs_matrix2x2* destination, rs_matrix2x2* source); --void rsMatrixLoad(rs_matrix3x3* destination, float* array); --void rsMatrixLoad(rs_matrix3x3* destination, rs_matrix3x3* source); --void rsMatrixLoad(rs_matrix4x4* destination, float* array); --void rsMatrixLoad(rs_matrix4x4* destination, rs_matrix2x2* source); --void rsMatrixLoad(rs_matrix4x4* destination, rs_matrix3x3* source); --void rsMatrixLoad(rs_matrix4x4* destination, rs_matrix4x4* source); - --void rsMatrixLoadFrustum(rs_matrix4x4* m, float left, float right, float bottom, float top, float near, float far); - --void rsMatrixLoadIdentity(rs_matrix2x2* m); --void rsMatrixLoadIdentity(rs_matrix3x3* m); --void rsMatrixLoadIdentity(rs_matrix4x4* m); - --void rsMatrixLoadMultiply(rs_matrix2x2* m, rs_matrix2x2* lhs, rs_matrix2x2* rhs); --void rsMatrixLoadMultiply(rs_matrix3x3* m, rs_matrix3x3* lhs, rs_matrix3x3* rhs); --void rsMatrixLoadMultiply(rs_matrix4x4* m, rs_matrix4x4* lhs, rs_matrix4x4* rhs); - --void rsMatrixLoadOrtho(rs_matrix4x4* m, float left, float right, float bottom, float top, float near, float far); - --void rsMatrixLoadPerspective(rs_matrix4x4* m, float fovy, float aspect, float near, float far); - --void rsMatrixLoadRotate(rs_matrix4x4* m, float rot, float x, float y, float z); - --void rsMatrixLoadScale(rs_matrix4x4* m, float x, float y, float z); - --void rsMatrixLoadTranslate(rs_matrix4x4* m, float x, float y, float z); - -float2 rsMatrixMultiply(rs_matrix2x2* m, float2 in); -float3 rsMatrixMultiply(rs_matrix3x3* m, float2 in); -float3 rsMatrixMultiply(rs_matrix3x3* m, float3 in); -float4 rsMatrixMultiply(rs_matrix4x4* m, float2 in); -float4 rsMatrixMultiply(rs_matrix4x4* m, float3 in); -float4 rsMatrixMultiply(rs_matrix4x4* m, float4 in); -void rsMatrixMultiply(rs_matrix2x2* m, rs_matrix2x2* rhs); -void rsMatrixMultiply(rs_matrix3x3* m, rs_matrix3x3* rhs); -void rsMatrixMultiply(rs_matrix4x4* m, rs_matrix4x4* rhs); - --void rsMatrixRotate(rs_matrix4x4* m, float rot, float x, float y, float z); - --void rsMatrixScale(rs_matrix4x4* m, float x, float y, float z); - -void rsMatrixSet(rs_matrix2x2* m, 0, 1, float v); -void rsMatrixSet(rs_matrix3x3* m, 2, 0, float v); -void rsMatrixSet(rs_matrix4x4* m, 1, 3, float v); - --void rsMatrixTranslate(rs_matrix4x4* m, float x, float y, float z); - --void rsMatrixTranspose(rs_matrix2x2* m); --void rsMatrixTranspose(rs_matrix3x3* m); --void rsMatrixTranspose(rs_matrix4x4* m); - -- quaternion functions - -void rsQuaternionAdd(rs_quaternion* q, rs_quaternion* rhs); - -void rsQuaternionConjugate(rs_quaternion* q); - -float rsQuaternionDot(rs_quaternion* q0, rs_quaternion* q1); - -void rsQuaternionGetMatrixUnit(rs_matrix4x4* m, rs_quaternion* q); - -void rsQuaternionLoadRotate(rs_quaternion* q, float rot, float x, float y, float z); - -void rsQuaternionLoadRotateUnit(rs_quaternion* q, float rot, float x, float y, float z); - -void rsQuaternionMultiply(rs_quaternion* q, rs_quaternion* rhs); -void rsQuaternionMultiply(rs_quaternion* q, float scalar); - -void rsQuaternionNormalize(rs_quaternion* q); - -void rsQuaternionSet(rs_quaternion* q, rs_quaternion* rhs); -void rsQuaternionSet(rs_quaternion* q, float w, float x, float y, float z); - -void rsQuaternionSlerp(rs_quaternion* q, rs_quaternion* q0, rs_quaternion* q1, float t); - -- allocation data access functions, this is a subset, since we don't have all types of allocations - --void rsAllocationCopy1DRange(allocation_1D_global, uint dstOff, uint dstMip, uint count, allocation_1D_global2, uint srcOff, uint srcMip); - --void rsAllocationCopy2DRange(allocation_2D_global, uint dstXoff, uint dstYoff, uint dstMip, rs_allocation_cubemap_face dstFace, uint width, uint height, allocation_2D_global2, uint srcXoff, uint srcYoff, uint srcMip, rs_allocation_cubemap_face srcFace); - -int2 rsAllocationVLoadX_int2(allocation_1D_global, 0); -int2 rsAllocationVLoadX_int2(allocation_2D_global, 24, 25); -int2 rsAllocationVLoadX_int2(allocation_3D_global, 0, 1, 0); -int3 rsAllocationVLoadX_int3(allocation_1D_global, 1); -int3 rsAllocationVLoadX_int3(allocation_2D_global, 27, 28); -int3 rsAllocationVLoadX_int3(allocation_3D_global, 1, 0, 1); -int4 rsAllocationVLoadX_int4(allocation_1D_global, 0); -int4 rsAllocationVLoadX_int4(allocation_2D_global, 29, 30); -int4 rsAllocationVLoadX_int4(allocation_3D_global, 0, 1, 0); - -void rsAllocationVStoreX_int2(allocation_1D_global, int2 val, 2); -void rsAllocationVStoreX_int2(allocation_2D_global, int2 val, 6, 7); -void rsAllocationVStoreX_int2(allocation_3D_global, int2 val, 0, 1, 0); -void rsAllocationVStoreX_int3(allocation_1D_global, int3 val, 1); -void rsAllocationVStoreX_int3(allocation_2D_global, int3 val, 12, 13); -void rsAllocationVStoreX_int3(allocation_3D_global, int3 val, 1, 0, 1); -void rsAllocationVStoreX_int4(allocation_1D_global, int4 val, 0); -void rsAllocationVStoreX_int4(allocation_2D_global, int4 val, 18, 19); -void rsAllocationVStoreX_int4(allocation_3D_global, int4 val, 0, 1, 0); - -void* rsGetElementAt(allocation_1D_global, 0); -void* rsGetElementAt(allocation_2D_global, 20, 21); -void* rsGetElementAt(allocation_3D_global, 1, 0, 1); -int rsGetElementAt_int(allocation_1D_global, 1); -int rsGetElementAt_int(allocation_2D_global, 22, 23); -int rsGetElementAt_int(allocation_3D_global, 0, 1, 0); - -uchar rsGetElementAtYuv_uchar_U(allocation_YUV_2D_global, 0, 1); - -uchar rsGetElementAtYuv_uchar_V(allocation_YUV_2D_global, 2, 3); - -uchar rsGetElementAtYuv_uchar_Y(allocation_YUV_2D_global, 0, 1); - -float4 rsSample(allocation_1D_global, rs_sampler s, float location); -float4 rsSample(allocation_1D_global, rs_sampler s, float location, float lod); -float4 rsSample(allocation_1D_global, rs_sampler s, float2 location); -float4 rsSample(allocation_1D_global, rs_sampler s, float2 location, float lod); - -void rsSetElementAt(allocation_1D_global, int* ptr, 2); -void rsSetElementAt(allocation_2D_global, int* ptr, 24, 25); -void rsSetElementAt_int(allocation_1D_global, int val, 0); -void rsSetElementAt_int(allocation_2D_global, int val, 26, 27); -void rsSetElementAt_int(allocation_3D_global, int val, 1, 0, 1); -'''.splitlines()) - - -TYPE_MAP = { - 'void' : '', - 'char' : r'\((signed )?char\)', - 'uchar' : r'\(uchar\)', - 'short' : r'\(short\)', - 'ushort' : r'\(ushort\)', - 'int' : r'\(int\)', - 'uint' : r'\(uint\)', - 'long' : r'\((long )?long\)', - 'ulong' : r'\(ulong\)', - 'float' : r'\(float\)', - 'float2' : r'\(float2\)', - 'float3' : r'\(float3\)', - 'float4' : r'\(float4\)' - } - - -def _build_arg(token): - '''Given a C argument construct an lldb expression for the argument. - - Given a token, which represents a single argument of a C function - declaration, construct an lldb expression for the argument. - - Args: - token: A string representing a single argument to a function. This - can be either [type][name] (e.g. int arg) or [value] (e.g. 5). - - Returns: - The string that is the lldb expression for that argument, e.g. - int_global or 5. - ''' - if len(token.split()) == 1: - # This is a fixed constant. Just take that as output. - return token - - result = token.split()[0] - - # Remove the rs_ prefix, because our globals' names don't have them - if result[:3] == 'rs_': - result = result[3:] - - # If the function expects a pointer, take the address of the global - if result[-1] == '*': - result = '&' + result - result = result[:-1] - - result += '_global' - return result - - -def build_expr(line): - '''Build an lldb expression given a function prototype. - - Given a function declaration, this function will construct an lldb - expression to call it. - - Args: - line: A string representing a function declaration. - - Returns: - The string that is the lldb expression. - ''' - tokens = re.findall(r"[^(),;]+", line) - assert len(tokens) > 0 - ret_name = tokens[0].split() - ret = ret_name[0] - name = ret_name[1] - expr = 'expr {0}('.format(name) - - first = True - for tok in tokens[1:]: - if not first: - expr += ', ' - expr += _build_arg(tok) - first = False - - expr += ')' - return ret, expr diff --git a/tests/lldb/tests/harness/__init__.py b/tests/lldb/tests/harness/__init__.py deleted file mode 100644 index 863ac226..00000000 --- a/tests/lldb/tests/harness/__init__.py +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -'''This module contains utility code used by the test suite''' - -from __future__ import absolute_import - -from . import exception -from . import util_constants -from .exception import TestSuiteException -from .test_base import TestBase -from .util_android import UtilAndroid -from .util_bundle import UtilBundle -from . import RS_funs
\ No newline at end of file diff --git a/tests/lldb/tests/harness/assert_mixins.py b/tests/lldb/tests/harness/assert_mixins.py deleted file mode 100644 index 94a9e229..00000000 --- a/tests/lldb/tests/harness/assert_mixins.py +++ /dev/null @@ -1,102 +0,0 @@ -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -""" -Set of mixins for asserting common RenderScript lldb interactions -That should cut down boilerplate -To use these assertions simply inherit from them along with your -`TestBase`: - - >>> class MyLLDBRenderScriptTest(TestBaseRemote, CoordinateAssertionsMixin): - >>> pass - -This will give you access to the useful assertion methods related to Coordinates - -NOTE: These are strictly clean mixins for `TestBase`. All classes here should -strictly inherit only from `object` -""" - - -class CoordinateAssertionsMixin(object): - def assert_coord_bp_set( - self, breakpoint_expr, x, y=None, z=None, kernel_type='kernel' - ): - ''' - Assert that a breakpoint conditional on a given coordinate is confirmed - by the renderscript breakpoint resolver. - This does not assert test the breakpoint is hit, only registered. - breakpoint_expr: the expression (e.g. the name of a function, or a - file and line). - kernel_type: The breakpoint resolver to use: - (reduction|kernel|scriptgroup) - default='kernel' - x: x coordinate: required - y, z: optional y, and z coordinates - ''' - - y = 0 if z is not None and y is None else y - coord_text = ','.join(map(str, filter(lambda p: p is not None, (x, y, z)))) - self.try_command( - 'language renderscript %s breakpoint set %s -c %s' % ( - kernel_type, breakpoint_expr, coord_text - ), - [r'Breakpoint(s) created'], - expected_regex=[ - r'Conditional kernel breakpoint on coordinate.+%d,\s*%d,\s*%d' % ( - x or 0, y or 0, z or 0 - ) - ] - ) - - def assert_coord_stop( - self, soname, func_name, x, y=None, z=None, stopped=True - ): - '''Run lldb commands to check that coordinates match expected values. - - Args: - (x, y, z): The expected coordinates. - soname: The name of the renderscript script module e.g. 'allocs' - for librs.allocs.so - func_name: String that is the name of the kernel function - - Raises: - TestFail: One of the lldb commands did not provide the expected - output. - ''' - - if stopped: - self.try_command( - 'process continue', - expected_regex=[ - r'resuming', - r'Process \d+ stopped', - r'stop reason = breakpoint', - r'frame #0: (0x[0-9a-fA-F]+ )?librs.%s.so`%s' % ( - soname, func_name) - ] - ) - else: - self.try_command( - 'bt', - expected_regex=[ - 'stop reason = breakpoint', - 'frame #0:', - 'librs.*\.so`%s' % kernel - ] - ) - - self.try_command( - 'language renderscript kernel coordinate', - '(%d, %d, %d)' % (x, y or 0, z or 0) - ) diff --git a/tests/lldb/tests/harness/decorators.py b/tests/lldb/tests/harness/decorators.py deleted file mode 100644 index e4a49b3a..00000000 --- a/tests/lldb/tests/harness/decorators.py +++ /dev/null @@ -1,157 +0,0 @@ -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from __future__ import print_function, absolute_import - -import functools -import warnings -import inspect - - -class skip_conditional(object): - ''' - Test method decorator that marks a test method as ignorable if the given - arguments evaluate as Truthy. If the argument is callable, then it is called - and the return value is used as the predicate. - - >>> class MyTestClass(TestBase): - ... def test_something(self): - ... pass - ... - ... @skip_conditional(not sys.platform.startswith("linux")) - ... def test_some_linux_behaviour(self): - ... assert "vmlinuz" in open("/proc/cmdline").read() - ... - ... @skip_conditional(lambda : True): - ... def test_that_never_runs(self): - ... pass - ''' - def __init__(self, skip_condition, message="skipped"): - self._skip_condition = skip_condition - self._message = message - - def __call__(self, func): - @functools.wraps(func) - def inner(*args, **kwargs): - skip_condition = self._skip_condition - if callable(skip_condition): - # args[0] is ``self`` - skip_condition = skip_condition(args[0]) - - if skip_condition: - print("skipping %r - %s" % (func, self._message)) - return True - return func(args[0]) - - return inner - - -class skip_test(skip_conditional): - '''' - Unconditionally skip a test - ''' - def __init__(self, skip_condition, *args, **kwargs): - super(skip_test, self).__init__(True, *args, **kwargs) - - -java_only_test = lambda: skip_conditional(lambda self: not self.app_type == 'java') - -cpp_only_test = lambda: skip_conditional(lambda self: not self.app_type == 'cpp') - -jni_only_test = lambda: skip_conditional(lambda self: not self.app_type == 'jni') - - -def wimpy(func): - ''' - Mark a test as 'wimpy' that is - a function specifically known to be quick-running. - This implementation simply adds the `.wimpy` attribute to the decorated function - and returns it, otherwise unmodified - ''' - func.wimpy = True - - return func - - -class ordered_test(object): - '''Set the ordered attribute on function''' - def __init__(self, order): - self._order = order - - def __call__(self, func): - func.test_order = self._order - return func - - -class deprecated(object): - """ - method or function decorator used to warn of pending feature removal: - - >>> @deprecated() - ... def myfunc(): - ... return 'hello' - ... - >>> myfunc() - DeprecationWarning: `__main__.myfunc()` is deprecated and will be removed soon. - 'hello' - >>> class MyClass(object): - ... @deprecated(alternative_feature='print') - ... def myprint(self, *args, **kwargs): - ... print(*args, **kwargs) - ... - >>> obj = MyClass() - >>> obj.myprint("hello") - DeprecationWarning: `__main__.MyClass.myfunc()` is deprecated and will be removed soon. Use 'print' instead. - hello - """ - - def __init__( - self, - alternative_feature=None, - removal_date='soon', - exception=UserWarning - ): - self.alternative_feature_message = ( - alternative_feature and 'use %r instead' % alternative_feature or '' - ) - self.exception = exception - self.removal_date = removal_date - - def __call__(self, func): - class_name = '' - if getattr(func, 'im_class', None): - class_name = '%s.' % func.im_class.__name__ - - if getattr(func, 'im_func', None): - func_name = func.im_func.func_name - else: - func_name = func.func_name - - module_name = getattr(func, '__module__') - - warning = "`%s.%s%s()` is deprecated and will be removed %s. %s" % ( - module_name, - class_name, - func_name, - self.removal_date, - self.alternative_feature_message - ) - - @functools.wraps(func) - def inner(*args, **kwargs): - if not getattr(func, 'deprecation_warned', False): - warnings.warn(warning, self.exception, 2) - func.deprecation_warned = True - return func(*args, **kwargs) - - return inner diff --git a/tests/lldb/tests/harness/exception.py b/tests/lldb/tests/harness/exception.py deleted file mode 100644 index 2cfc99f9..00000000 --- a/tests/lldb/tests/harness/exception.py +++ /dev/null @@ -1,41 +0,0 @@ -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -'''Module that contains TestSuiteException.''' - -from __future__ import absolute_import - -class TestSuiteException(Exception): - '''Exception that is thrown whenever an internal error is encountered. - - Just contains a message. - ''' - pass - -class DisconnectedException(Exception): - '''Exception that is thrown if lldb-server unexpectedly disconnected. - - Just contains a message. - ''' - pass - - -class FailFastException(TestSuiteException): - '''Quick Bailout''' - pass - - -class TestIgnoredException(TestSuiteException): - '''Raised when a testcase is ignored.''' - pass diff --git a/tests/lldb/tests/harness/test_base.py b/tests/lldb/tests/harness/test_base.py deleted file mode 100644 index 99029898..00000000 --- a/tests/lldb/tests/harness/test_base.py +++ /dev/null @@ -1,332 +0,0 @@ -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -'''Module that contains TestBase, the base class of all tests.''' - -from __future__ import absolute_import - -import logging -import os -import re -import tempfile -import inspect -import traceback - -from .exception import DisconnectedException, TestSuiteException - -from . import util_log - - -class TestBase(object): - '''Base class for all tests. Provides some common functionality.''' - - bundle_target = {} - - class TestFail(Exception): - '''Exception that is thrown when a line in a test fails. - - This exception is thrown if a lldb command does not return the expected - string. - ''' - pass - - def __init__(self, device_port, device, timer, app_type, wimpy=False, **kwargs): - # Keep argument names for documentation purposes. This method is - # overwritten by test_base_remote. - # pylint: disable=unused-argument - self._lldb = None # handle to the lldb module - self._ci = None # instance of the lldb command interpreter for this test - self._timer = timer # timer instance, to check whether the test froze - self.app_type = app_type # The type of bundle that is being executed - self.wimpy = wimpy - - def setup(self, android): - '''Set up environment for the test. - - Override to specify commands to be run before the test APK launch. - Useful for setting Android properties or environment variables. See also - the teardown method. - - Args: - android: Handler to the android device, see the UtilAndroid class. - ''' - pass - - def teardown(self, android): - '''Clean up environment after test. - - Override this procedure to specify commands to be run after the test has - finished. This method is run regardless the outcome of the test. - - Args: - android: Handler to the android device, see the UtilAndroid class. - ''' - pass - - def run(self, dbg, remote_pid, lldb): - '''Execute the actual test suite. - - Args: - dbg: The instance of the SBDebugger that is used to test commands. - remote_pid: The integer that is the process id of the binary that - the debugger is attached to. - lldb: A handle to the lldb module. - - Returns: - A list of (test, failure) tuples. - ''' - log = util_log.get_logger() - - def predicate(obj): - '''check whether we're interested in the function''' - if not callable(obj): - return False - if self.wimpy and not getattr(obj, 'wimpy', False): - log.debug("skipping non-wimpy test in wimpy mode:%r", obj) - return False - return True - - test_methods = [ - method for name, method in inspect.getmembers(self, predicate) - if name.startswith('test_') - ] - log.debug("Found the following tests %r", test_methods) - test_errors = [] - - for test in sorted( - test_methods, - key=lambda item: getattr(item, 'test_order', float('Inf')) - ): - try: - log.info("running test %r", test.__name__) - result = test() - except (self.TestFail, TestSuiteException) as e: - test_errors.append((method, e)) - - return test_errors - - def post_run(self): - '''Clean up after test execution.''' - pass - - def assert_true(self, cond): - '''Check a given condition and raise TestFail if it is False. - - Args: - cond: The boolean condition to check. - - Raises: - TestFail: The condition was false. - ''' - if not cond: - raise self.TestFail() - - def assert_lang_renderscript(self): - '''Check that LLDB is stopped in a RenderScript frame - - Use the LLDB API to check that the language of the current frame - is RenderScript, fail otherwise. - - Raises: - TestFail: Detected language not RenderScript. - ''' - assert self._lldb - assert self._ci - - proc = self._ci.GetProcess() - frame = proc.GetSelectedThread().GetSelectedFrame() - lang = frame.GetCompileUnit().GetLanguage() - - if lang != self._lldb.eLanguageTypeExtRenderScript: - raise self.TestFail('Frame language not RenderScript, instead {0}' - .format(lang)) - - def do_command(self, cmd): - '''Run an lldb command and return the output. - - Args: - cmd: The string representing the lldb command to run. - - Raises: - TestFail: The lldb command failed. - ''' - assert self._lldb - assert self._ci - - log = util_log.get_logger() - res = self._lldb.SBCommandReturnObject() - - log.info('[Command] {0}'.format(cmd)) - - # before issuing the command, restart the current timer to check - # whether the command is going to freeze the test - if self._timer: - self._timer.reset() - - self._ci.HandleCommand(cmd, res) - - if not res.Succeeded(): - error = res.GetError() - error = error if error else res.GetOutput() - raise self.TestFail('The command "{0}" failed with the error: {1}' - .format(cmd, error if error else '<N/a>')) - - output = res.GetOutput() or '' - log.debug('[Output] {0}'.format(output.rstrip())) - - return output - - def try_command(self, cmd, expected=None, expected_regex=None): - '''Run an lldb command and match the expected response. - - Args: - cmd: The string representing the lldb command to run. - expected: A list of strings that should be present in lldb's - output. - expected_regex: A list of regular expressions that should - match lldb's output. - - Raises: - TestFail: One of the expected strings were not found in the lldb - output. - - Returns: - str: raw lldb command output. - ''' - assert self._lldb - assert self._ci - log = util_log.get_logger() - output = '' - try: - output = self.do_command(cmd) - - if 'lost connection' in output: - raise DisconnectedException('Lost connection to lldb-server.') - - # check the expected strings - if expected: - self._match_literals(output, expected) - - # check the regexp patterns - if expected_regex: - self._match_regexp_patterns(output, expected_regex) - - except self.TestFail as exception: - # if the command failed, ensure the output retrieved from the - # command is printed even in verbose mode - if log.getEffectiveLevel() > logging.DEBUG: - log.error('[Output] {0}'.format(output.rstrip() if output - else '<empty>')) - - # print the back trace, it should help to identify the error in - # the test - backtrace = ['[Back trace]'] - for (filename, line, function, text) in \ - traceback.extract_stack()[:-1]: - backtrace.append(' [{0} line: {2} fn: {1}] {3}'.format( - filename, function, line, text - ) - ) - log.error('\n'.join(backtrace)) - log.error('[TEST ERROR] {0}'.format(exception.message)) - raise # pass through - - return output - - def _match_literals(self, text, literals): - '''Checks the text against the array of literals. - - Raises a TestFail exception in case one of the literals is not contained - in the text. - - Args: - text: String, it represents the text to match. - literals: an array of string literals to match in the output. - - Throws: self.TestFail: if it cannot match one of the literals in - the output. - ''' - for string in literals: - if string not in text: - raise self.TestFail('Cannot find "{0}" in the output' - .format(string)) - - def _match_regexp_patterns(self, text, patterns): - '''Checks the text against the array of regular expression patterns. - - Raises a TestFail exception in case one of the patterns is not matched - in the given text. - - Args: - text: String, it represents the text to match. - patterns: an array of strings, each of them representing a regular - expression to match in text. - - Throws: self.TestFail: if it cannot match one of the literals in - the output. - ''' - log = util_log.get_logger() - - for regex in patterns: - match = re.search(regex, text) - if not match: - raise self.TestFail('Cannot match the regexp "{0}" in ' - 'the output'.format(regex)) - else: - msg = 'Found match to regex {0}: {1}'.format(regex, - match.group()) - log.debug(msg) - - @staticmethod - def get_tmp_file_path(): - '''Get the path of a temporary file that is then deleted. - - Returns: - A string that is the path to a temporary file. - ''' - file_desc, name = tempfile.mkstemp() - os.close(file_desc) - os.remove(name) - return name - - -class TestBaseNoTargetProcess(TestBase): - '''lldb target that doesn't require a binary to be running.''' - - def get_bundle_target(self): - '''Get bundle executable to run. - - Returns: None - ''' - return None - - @property - def bundle_target(self): - return self.get_bundle_target() - - def run(self, dbg, remote_pid, lldb): - '''Execute the test case. - - Args: - dbg: The instance of the SBDebugger that is used to test commands. - lldb: A handle to the lldb module. - - Returns: - True: test passed, False: test failed. - ''' - self._lldb = lldb - self._dbg = dbg - self._ci = dbg.GetCommandInterpreter() - assert self._ci.IsValid() - return super(TestBaseNoTargetProcess, self).run(self, dbg, remote_pid) diff --git a/tests/lldb/tests/harness/test_base_remote.py b/tests/lldb/tests/harness/test_base_remote.py deleted file mode 100644 index c430edff..00000000 --- a/tests/lldb/tests/harness/test_base_remote.py +++ /dev/null @@ -1,172 +0,0 @@ -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -'''Module that contains the base class TestBaseRemote''' - -from __future__ import absolute_import - -import os -import re - -from .test_base import TestBase -from . import util_log - - -class TestBaseRemote(TestBase): - '''Base class for all tests that connect to a remote device. - - Provides common functionality to set up the connection and tear it down. - ''' - - def __init__(self, device_port, device, timer, *args, **kwargs): - super(TestBaseRemote, self).__init__(device_port, device, timer, *args, **kwargs) - # port used by lldb-server on the device. - self._device_port = device_port - self._platform = None - # id of the device that adb will communicate with. - self._device = device - - def set_src_map(self, file_name, new_src_path): - '''Call lldb to set the source mapping of a given file. - - Set lldb's source mapping of a given file to a given path. This can be - used to make the test suite independent of where an APK was compiled. - - Args: - file_name: String, which is the name of the file whose mapping is - to be changed - new_src_path: String which is the new absolute path to the source - file. - ''' - line_table = self.do_command('target modules dump line-table ' - + file_name) - - lines = line_table.split('\n') - if 'Line table for' not in lines[0]: - raise self.TestFail('Could not determine source path of ' - + file_name) - - # Expecting output like: - # (lldb) target modules dump line-table scalars.rs - # Line table for /home/jenkins/workspace/grd-aosp-parameterised-build/ - # merge_151216/frameworks/rs/tests/lldb/java/BranchingFunCalls/src/rs/ - # frameworks/rs/tests/lldb/java/BranchingFunCalls/src/rs/scalars.rs in - # `librs.scalars.so - # 0xb30f2374: /home/jenkins/workspace/grd-aosp-parameterised-build/ - # merge_151216/frameworks/rs/tests/lldb/java/BranchingFunCalls/src/rs/ - # scalars.rs:46 - # ... - # For some reason the first line contains a mangled path? - old_path = re.findall(r"[^ :]+", lines[1])[1] - old_dir = os.path.dirname(old_path) - - self.try_command('settings set target.source-map %s %s' - % (old_dir, new_src_path), ['']) - - def post_run(self): - '''Clean up after execution.''' - if self._platform: - self._platform.DisconnectRemote() - - def _connect_to_platform(self, lldb_module, dbg, remote_pid): - '''Connect to an lldb platform that has been started elsewhere. - - Args: - lldb_module: A handle to the lldb module. - dbg: The instance of the SBDebugger that should connect to the - server. - remote_pid: The integer that is the process id of the binary that - the debugger should attach to. - - Returns: - True if the debugger successfully attached to the server and - process. - ''' - # pylint: disable=too-many-return-statements - remote_pid = str(remote_pid) - - log = util_log.get_logger() - - err1 = dbg.SetCurrentPlatform('remote-android') - if err1.Fail(): - log.fatal(err1.GetCString()) - return False - - self._platform = dbg.GetSelectedPlatform() - if not self._platform: - return False - - connect_string = \ - 'adb://{0}:{1}'.format(self._device, self._device_port) - opts = lldb_module.SBPlatformConnectOptions(connect_string) - - for _ in range(2): - err2 = self._platform.ConnectRemote(opts) - if err2.Fail(): - log.error(err2.GetCString()) - - if 'Connection refused' in err2.GetCString(): - log.warning('Connection to lldb server was refused. ' - 'Trying again.') - else: - # Unknown error. Don't try again. - return False - else: - # Success - break - else: - log.fatal('Not trying again, maximum retries exceeded.') - return False - - target = dbg.CreateTarget(None) - if not target: - return False - - dbg.SetSelectedTarget(target) - listener = lldb_module.SBListener() - err3 = lldb_module.SBError() - process = target.AttachToProcessWithID(listener, int(remote_pid), err3) - if err3.Fail() or not process: - log.fatal(err3.GetCString()) - return False - - return True - - def run(self, dbg, remote_pid, lldb): - '''Execute the actual testsuite. - - Args: - dbg: The instance of the SBDebugger that is used to test commands. - remote_pid: The integer that is the process id of the binary that - the debugger is attached to. - lldb: A handle to the lldb module. - - Returns: list of (test, failure) tuples. - - ''' - assert dbg - assert remote_pid - assert lldb - - self._lldb = lldb - - self.assert_true(self._connect_to_platform(lldb, dbg, remote_pid)) - self._ci = dbg.GetCommandInterpreter() - assert self._ci - - self.assert_true(self._ci.IsValid()) - self.assert_true(self._ci.HasCommands()) - - return super(TestBaseRemote, self).run(dbg, remote_pid, lldb) - diff --git a/tests/lldb/tests/harness/util_android.py b/tests/lldb/tests/harness/util_android.py deleted file mode 100644 index a0cf700b..00000000 --- a/tests/lldb/tests/harness/util_android.py +++ /dev/null @@ -1,736 +0,0 @@ -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -'''Module that contains the class UtilAndroid, providing utility method to -interface with Android ADB.''' - -from __future__ import absolute_import - -import logging -import re -import subprocess -import time -import collections -import multiprocessing -try: - # Python 3 - import queue -except ImportError: - import Queue as queue - -from .exception import TestSuiteException -from . import util_log - - -class UtilAndroid(object): - '''Provides some utility methods that interface with Android using adb.''' - # pylint: disable=too-many-public-methods - - def __init__(self, adb_path, lldb_server_path_device, device): - # The path to the adb binary on the local machine - self._path_adb = adb_path - # The path to the lldb server binary on the device - self._path_lldbserver = lldb_server_path_device - self._log = util_log.get_logger() - self.device = device - self._prop_stacks = collections.defaultdict(list) - return - - @staticmethod - def _validate_string(string): - '''Check that a string is valid and not empty. - - Args: - string: The string to be checked. - ''' - assert isinstance(string, str) - assert len(string) > 0 - - def adb(self, args, async=False, device=True, timeout=None): - '''Run an adb command (async optional). - - Args: - args: The command (including arguments) to run in adb. - async: Boolean to specify whether adb should run the command - asynchronously. - device: boolean to specify whether the serial id of the android - device should be inserted in the adb command. - timeout: it specifies the number of seconds to wait for - a synchronous invocation before aborting. If unspecified or - None it waits indefinitely for the command to complete. - - Raises: - ValueError: it can be caused by any of the following situations: - - when both the combination async=True and timeout are - given. - - when a timeout <= 0 is specified. - - Returns: - If adb was synchronously run and the command completed by the - specified timeout, a string which is the output (standard out and - error) from adb. Otherwise it returns None. - ''' - - # Form the command - if device: - cmd = '{0} -s {1} {2}'.format(self._path_adb, self.device, args) - else: - cmd = '{0} {1}'.format(self._path_adb, args) - - self._log.debug('Execute ADB: %s', cmd) - - if timeout is None: - # local invocation - return_code, output = UtilAndroid._execute_command_local(cmd, async) - - else: - # remote invocation - if async: - raise ValueError('Invalid combination: asynchronous invocation ' - 'with timeout specified') - - return_code, output = UtilAndroid._execute_command_remote(cmd, - timeout) - - if return_code is None: - self._log.warn('[ADB] The command timed out: %s', cmd) - - # log the output message - if output is not None: - self._adb_log_output(cmd, output, return_code) - - return output - - def adb_retry(self, args, max_num_attempts, timeout): - '''Attempt to execute the given adb command a certain number of times. - - The function executes the given command through adb, waiting for its - completion up to 'timeout' seconds. If the command completes then it - returns its output. Otherwise it aborts the execution of the adb - command and re-issues it anew with the same parameters. In case of - timeout this process is repeated up to 'max_num_attempts'. - - The purpose of this function is to handle the cases when, for some - reason, a command sent to 'adb' freezes, blocking the whole test suite - indefinitely. - - Args: - args: The command (including arguments) to run in adb. - max_num_attempts: the max number of attempts to repeat the command - in case of timeout. - timeout: it specifies the number of seconds to wait for the adb - command to complete. - - Raises: - ValueError: when the parameter timeout is invalid (None or <= 0). - - Returns: - If adb was synchronously run and the command completes by the - specified timeout, a string which is the output (standard out and - error) from adb. Otherwise it returns None. - ''' - if timeout is None or timeout <= 0: - raise ValueError('Invalid value for timeout') - - output = None - - for attempt in range(max_num_attempts): - self._log.debug('[ADB] Attempt #%d: %s', attempt + 1, args) - output = self.adb(args, False, True, timeout) - if output: - break - - return output - - def _adb_log_output(self, cmd, output, return_code): - '''Save in the log the command & output from `adb`. - - Internal function, helper to record in the log the issued adb command - together with its output and return code. - - Params: - cmd: string, the command issued to `adb`. - output: string, the output retrieved from `adb`. - return_code: int, the return code from `adb`. - ''' - - message = output.strip() - - # if return_code != 0, we wish to also record the command executed - # (which occurs if and only if we are in verbose mode) - is_warning = return_code != 0 - threshold = self._log.getEffectiveLevel() - if is_warning and threshold > logging.DEBUG: - self._log.warn("[ADB] Command executed: {0}".format(cmd)) - - level = logging.WARNING if is_warning else logging.DEBUG - if message: - # if message is composed by multiple lines, then print it after - # the log preamble - if re.search('\n', message): - message = '\n' + message - else: - message = '<empty>' - - self._log.log(level, 'RC: {0}, Output: {1}'.format(return_code, - message)) - - def check_adb_alive(self): - '''Ping the device and raise an exception in case of timeout. - - It sends a ping message through 'adb shell'. The emulator/device should - echo the same message back by one minute. If it does not, it raises - a TestSuiteException. - - Purpose of this method is to check whether 'adb' became frozen or - stuck. - - Raises: - TestSuiteException: in case the device/emulator does not reply by - one minute or the `ping' message is not echoed - back. - ''' - token = 'PING' - log = util_log.get_logger() - cmd = "echo {0}".format(token) - - tries = 10 - try_number = tries - while try_number > 0: - log.debug('Sending a ping through "adb shell" (try #%s)...', - try_number) - output = self.shell(cmd, False, 60) - - if output is None: - raise TestSuiteException( - 'Timeout when pinging the device/emulator through ' - '"adb shell". Is "adb" stuck or dead?') - elif token not in output: - log.debug('Ping failed. Cannot match the token "%s" in "adb ' - 'shell %s"', token, cmd) - else: - log.debug('Pong message received') - return - - try_number -= 1 - time.sleep(5) - - raise TestSuiteException('Cannot ping the device/emulator through ' - '"adb shell". Tried %s times. Is "adb" stuck ' - 'or dead?' % tries) - - def shell(self, cmd, async=False, timeout=None): - '''Run a command via the adb shell. - - Args: - cmd: The command (including arguments) to run in the adb shell. - async: Boolean to specify whether adb should run the command - asynchronously. - timeout: it specifies the number of seconds to wait for - a synchronous invocation before aborting. If unspecified or - None it waits indefinitely for the command to complete - - Returns: - If adb was synchronously run, a string which is the output (standard - out and error) from adb. Otherwise None. - ''' - return self.adb('shell "{0}"'.format(cmd), async, True, timeout) - - def find_app_pid(self, process_name): - '''Find the process ID of a process with a given name. - - If more than one instance of the process is running return the first pid - it finds. - - Args: - process_name: A string representing the name of the package or - binary for which the id should be found. I.e. the - string or part of the string that shows up in the "ps" - command. - - Returns: - An integer representing the id of the process, or None if it was not - found. - ''' - self._validate_string(process_name) - - pid_output = self.shell('pidof ' + process_name) - pid_output = re.sub(r'\*.+\*', '', pid_output) - pids = pid_output.split() - - if len(pids) < 1: - self._log.warn('Unable to find pid of: {0}'.format(process_name)) - return None - - if len(pids) > 1: - self._log.warn('Found multiple instances of {0} running: {1}' - .format(process_name, pids)) - - try: - pid = int(pids[0]) - self._log.info('App pid found: {0}'.format(pids[0])) - return pid - except ValueError: - return None - - def adb_root(self): - '''Set adb to be in root mode.''' - self.adb('root') - - def _adb_remount(self): - '''Remount the filesystem of the device.''' - self.adb('remount') - - def validate_adb(self): - '''Validate adb that it can be run. - - Raises: - TestSuiteException: Unable to validate that adb exists and runs - successfully. - ''' - out = self.adb('version', False, False) - if out and 'Android' in out and 'version' in out: - self._log.info('adb found: {0}'.format(out)) - return None - raise TestSuiteException('unable to validate adb') - - def is_booted(self): - ''' Check if the device/emulator has finished booting. - - Returns: True if the property sys.boot_completed is true, False - otherwise. - ''' - return self._get_prop('sys.boot_completed').strip() == '1' - - def validate_device(self, check_boot=True, device_substring=''): - '''Validate that there is at least one device. - - Args: - check_boot: Boolean to specify whether to check whether the device - has finished booting as well as being present. - device_substring: String that needs to be part of the name of the - device. - - Raises: - TestSuiteException: There was a failure to run adb to list the - devices or there is no device connected or - multiple devices connected without the user - having specified the device to use. - ''' - - out = self.adb('devices', False, False) - if not 'List of devices attached' in out: - raise TestSuiteException('Unable to list devices') - - lines = out.split('\n') - found_device = False # True if the specified device is found - devices = [] - - for line in lines[1:]: - if '\tdevice' in line and device_substring in line: - device = line.split()[0] - devices.append(device) - if self.device: - if self.device == device: - found_device = True - - if len(devices) == 0: - raise TestSuiteException('adb is unable to find a connected ' - 'device/emulator to test.') - - if not self.device: - if len(devices) == 1: - self.device = devices[0] - else: - raise TestSuiteException('Multiple devices connected,' - 'specify -d device id.') - else: - if not found_device: - raise TestSuiteException('Couldn\'t find the device {0} that ' - 'was specified, please check -d ' - 'argument'.format(self.device)) - - if check_boot and not self.is_booted(): - raise TestSuiteException( - 'The device {0} has not yet finished booting.' - .format(self.device)) - - def device_with_substring_exists(self, device_substring): - '''Check whether a device exists whose name contains a given string. - - Args: - device_substring: String that is part of the name of the device to - look for. - - Raises: - TestSuiteException: There was a failure to run adb to list the - devices. - ''' - out = self.adb('devices', False, False) - if not 'List of devices attached' in out: - raise TestSuiteException('Unable to list devices') - - lines = out.split('\n') - - for line in lines[1:]: - if '\tdevice' in line: - device = line.split()[0] - if device.find(device_substring) != -1: - return True - - return False - - def get_device_id(self): - '''Return ID of the device that will be used for running the tests on. - - Returns: - String representing device ID. - ''' - return self.device - - def _kill_pid(self, pid): - '''Kill a process identified by its pid by issuing a "kill" command. - - Args: - pid: The integer that is the process id of the process to be killed. - ''' - self.shell('kill -9 ' + str(pid)) - - def stop_app(self, package_name): - '''Terminate an app by calling am force-stop. - - Args: - package_name: The string representing the name of the package of the - app that is to be stopped. - ''' - self._validate_string(package_name) - self.shell('am force-stop ' + package_name) - - def kill_process(self, name): - '''Kill a process identified by its name (package name in case of apk). - - Issues the "kill" command. - - Args: - name: The string representing the name of the binary of the process - that is to be killed. - - Returns: - True if the kill command was executed, False if it could not be - found. - ''' - pid = self.find_app_pid(name) - if pid: - self._kill_pid(pid) - return True - return False - - def kill_all_processes(self, name): - '''Repeatedly try to call "kill" on a process to ensure it is gone. - - If the process is still there after 5 attempts reboot the device. - - Args: - name: The string representing the name of the binary of the process - that is to be killed. - - Raises: - TestSuiteException: If the process could not be killed after 5 - attempts and the device then failed to boot - after rebooting. - ''' - - # try 5 times to kill this process - for _ in range(1, 5): - if not self.kill_process(name): - return - # stalled process must reboot - self._reboot_device() - - def kill_servers(self): - '''Kill all gdbserver and lldb-server instances. - - Raises: - TestSuiteException: If gdbserver or lldb-server could not be killed - after 5 attempts and the device then failed to - boot after rebooting. - ''' - self.kill_all_processes('gdbserver') - self.kill_all_processes('lldb-server') - - def launch_elf(self, binary_name): - '''Launch a binary (compiled with the NDK). - - Args: - binary_name: The string representing the name of the binary that is - to be launched. - - Returns: - Boolean, failure if the app is not installed, success otherwise. - ''' - # Ensure the apk is actually installed. - output = self.shell('ls /data/ | grep ' + binary_name) - if binary_name not in output: - return False - - stdout = self.shell('exec /data/' + binary_name, True) - self._log.info(str(stdout)) - - return True - - def wait_for_device(self): - '''Ask ADB to wait for a device to become ready.''' - self.adb('wait-for-device') - - def _reboot_device(self): - '''Reboot the remote device. - - Raises: - TestSuiteException: If the device failed to boot after rebooting. - ''' - self.adb('reboot') - self.wait_for_device() - # Allow 20 mins boot time to give emulators such as MIPS enough time - sleeping_countdown = 60*20 - while not self.is_booted(): - time.sleep(1) - sleeping_countdown -= 1 - if sleeping_countdown == 0: - raise TestSuiteException('Failed to reboot. Terminating.') - - self.adb_root() - self.wait_for_device() - self._adb_remount() - self.wait_for_device() - - def launch_app(self, name, activity): - '''Launch a Renderscript application. - - Args: - name: The string representing the name of the app that is to be - launched. - activity: The string representing the activity of the app that is to - be started. - - Returns: - Boolean, failure if the apk is not installed, success otherwise. - ''' - assert name and activity - - # Ensure the apk is actually installed. - output = self.shell('pm list packages ' + name) - if not output: - return False - - cmd = 'am start -S -W {0}/{0}.{1}'.format(name, activity) - stdout = self.shell(cmd) - - self._log.info(str(stdout)) - - return True - - def launch_lldb_platform(self, port): - '''Launch lldb server and attach to target app. - - Args: - port: The integer that is the port on which lldb should listen. - ''' - cmd = "export LLDB_DEBUGSERVER_PATH='{0}';{0} p --listen *:{1}"\ - .format(self._path_lldbserver, port) - self.shell(cmd, True) - time.sleep(5) - - def forward_port(self, local, remote): - '''Use adb to forward a device port onto the local machine. - - Args: - local: The integer that is the local port to forward. - remote: The integer that is the remote port to which to forward. - ''' - cmd = 'forward tcp:%s tcp:%s' % (str(local), str(remote)) - self.adb(cmd) - - def remove_port_forwarding(self): - '''Remove all of the forward socket connections open in adb. - - Avoids a windows adb error where we can't bind to a listener - because too many files are open. - ''' - self.adb('forward --remove-all') - - def _get_prop(self, name): - '''Get the value of an Android system property. - - Args: - name: Name of the property of interest [string]. - - Returns: - Current value of the property [string]. - ''' - return self.shell('getprop %s' % str(name)) - - def _set_prop(self, name, value): - '''Set the value of an Android system property. - - Args: - name: Name of the property of interest [string]. - value: Desired new value for the property [string or integer]. - ''' - self.shell("setprop %s '%s'" % (str(name), str(value))) - - def push_prop(self, name, new_value): - '''Save the value of an Android system property and set a new value. - - Saves the old value onto a stack so it can be restored later. - - Args: - name: Name of the property of interest [string]. - new_value: Desired new value for the property [string or integer]. - ''' - old_value = self._get_prop(name) - self._set_prop(name, new_value) - self._prop_stacks[name].append(old_value.strip()) - - def pop_prop(self, name): - '''Restore the value of an Android system property previously set by - push_prop. - - Args: - name: Name of the property of interest [string]. - - Returns: - Current value of the property [string]. - ''' - old_value = self._prop_stacks[name].pop() - self._set_prop(name, old_value) - - def reset_all_props(self): - '''Restore all the android properties to the state before the first push - - This is equivalent to popping each property the number of times it has - been pushed. - ''' - for name in self._prop_stacks: - if self._prop_stacks[name] != []: - self._set_prop(name, self._prop_stacks[name][0]) - self._prop_stacks[name] = [] - - def make_device_writeable(self): - ''' Ensure the device is full writable, in particular the system folder. - - This disables verity and remounts. - ''' - output = self.adb('disable-verity') - - # if the remote is an emulator do not even try to reboot - # otherwise check whether a reboot is advised - if (self._get_prop('ro.boot.qemu') != '1' and output and - 'Now reboot your device for settings to take effect' in output): - self._reboot_device() - - self._adb_remount() - self.wait_for_device() - self.adb_root() - self.wait_for_device() - - @staticmethod - def _execute_command_local(command, async=False): - '''Execute the given shell command in the same process. - - Args: - command: String, the command to execute - async: Boolean to specify whether adb should run the command - asynchronously. - - Returns: - if async == False, it returns a tuple with the return code and - the output from the executed command. Otherwise the tuple - (None, None). - ''' - proc = subprocess.Popen(command, - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, - shell=True) - if async: - return None, None - - # read the whole output from the command - with proc.stdout as file_proc: - output = ''.join(line for line in file_proc) - - # release the process state - proc.terminate() - return_code = proc.wait() - - return return_code, output - - @staticmethod - def _execute_command_remote(command, timeout): - '''Execute the given shell command remotely, in a separate process. - - It spawns an ad hoc process to execute the given command. It waits up - to timeout for the command to complete, otherwise it aborts the - execution and returns None. - - Args: - command: String, the command to execute. - timeout: the number of seconds to wait for the command to complete. - - Returns: - a pair with the return code and the output from the command, if it - completed by the specified 'timeout' seconds. Otherwise the tuple - (None, None). - ''' - - channel = multiprocessing.Queue() - proc = multiprocessing.Process( - target=_handle_remote_request, - name="Executor of `{0}'".format(command), - args=(command, channel) - ) - - # execute the command - proc.start() - return_code = None - output = None - - # wait for the result - try: - return_code, output = channel.get(True, timeout) - except queue.Empty: - # timeout hit, the remote process has not fulfilled our request by - # the given time. We are going to return <None, None>, nothing to - # do here as it already holds return_code = output = None. - pass - - # terminate the helper process - proc.terminate() - - return return_code, output - - -def _handle_remote_request(command, channel): - '''Entry point for the remote process. - - It executes the given command and reports the result into the channel. - This function is supposed to be only called by - UtilAndroid._execute_command_remote to handle the inter-process - communication. - - Args: - command: the command to execute. - channel: the channel to communicate with the caller process. - ''' - channel.put(UtilAndroid._execute_command_local(command)) - diff --git a/tests/lldb/tests/harness/util_bundle.py b/tests/lldb/tests/harness/util_bundle.py deleted file mode 100644 index 68954cb2..00000000 --- a/tests/lldb/tests/harness/util_bundle.py +++ /dev/null @@ -1,369 +0,0 @@ -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -'''Module that contains the class UtilBundle, representing a collection of RS -binaries.''' - -from __future__ import absolute_import - -import os -import time -from . import util_constants -from . import util_log -from .exception import TestSuiteException - - -class UtilBundle(object): - '''Represents the collection of RS binaries that are debugged.''' - - # Map of binary name to package name of all Java apps debugged - _tests_apk = { - 'JavaInfiniteLoop': 'com.android.rs.infiniteloop', - 'JavaDebugWaitAttach': 'com.android.rs.waitattachdebug', - 'JavaNoDebugWaitAttach': 'com.android.rs.waitattachnodebug', - 'BranchingFunCalls': 'com.android.rs.branchingfuncalls', - 'KernelVariables': 'com.android.rs.kernelvariables', - 'Allocations': 'com.android.rs.allocations', - 'MultipleRSFiles': 'com.android.rs.multiplersfiles', - 'SingleSource': 'com.android.rs.singlesource', - 'ScriptGroup': 'com.android.rs.scriptgroup', - 'Reduction': 'com.android.rs.lldbreductiontest', - } - - _tests_jni = { - 'JNIInfiniteLoop': 'com.android.rs.jniinfiniteloop', - 'JNIDebugWaitAttach': 'com.android.rs.jnidebugwaitattach', - 'JNINoDebugWaitAttach': 'com.android.rs.jninodebugwaitattach', - 'JNIBranchingFunCalls': 'com.android.rs.jnibranchingfuncalls', - 'JNIKernelVariables': 'com.android.rs.jnikernelvariables', - 'JNIAllocations': 'com.android.rs.jniallocations', - 'JNIMultipleRSFiles': 'com.android.rs.jnimultiplersfiles' - } - - _tests_ndk = {'CppInfiniteLoop', 'CppNoDebugWaitAttach', - 'CppDebugWaitAttach', 'CppBranchingFunCalls', - 'CppKernelVariables', 'CppAllocations', 'CppMultipleRSFiles'} - - _missing_path_msg = ( - 'No product path has been provided. If using `lunch` ensure ' - 'the `ANDROID_PRODUCT_OUT` environment variable has been set correctly. ' - 'Alternatively, include it in the config file or specify it explicitly ' - 'on the command line (`--aosp-product-path`)' - ) - - def __init__(self, android, aosp_product_path): - assert android - self._android = android # Link to the android module - self._aosp_product_path = aosp_product_path - self._log = util_log.get_logger() - - def is_apk(self, name): - '''Checks if a binary of a given name is an apk. - - Checks whether the name of the apk is in the dictionary of apks. - - Args: - name: The string that is the name of the binary to check. - - Returns: - True if the binary is an apk, False if it is not. - - Raises: - TestSuiteException: The string does not match any item in the list - of APK or NDK binaries. - ''' - if name in self._tests_apk: - return True - if name not in self._tests_ndk and name not in self._tests_jni: - raise TestSuiteException('test not apk or ndk') - return False - - def uninstall_all(self): - '''Uninstall/Delete all the testsuite's apks and binaries on the device. - - Raises: - TestSuiteException: One or more apks could not be uninstalled. - ''' - self.uninstall_all_apk() - self._delete_all_ndk() - self._uninstall_all_jni() - - def uninstall_all_apk(self): - '''Uninstall all apks used by the test suite from the device. - - Raises: - TestSuiteException: An apk could not be uninstalled. - ''' - max_num_attempts = 3 - timeout = 180 - - for app, package in self._tests_apk.items(): - self._log.info('Uninstalling the application: %s', app) - output = self._android.adb_retry('uninstall ' + package, - max_num_attempts, timeout) - - if output is None: - raise TestSuiteException('Repeated timeouts when uninstalling ' - 'the application: ' + app) - elif 'Success' not in output: - outmsg = '\n' + output.rstrip() if output else '<empty>' - self._log.error('Cannot match the string "Success" in the ' - 'output: %s', outmsg) - raise TestSuiteException('Unable to uninstall app ' + app) - else: - self._log.debug('Application uninstalled: %r', app) - - if 'Success' not in output: - self._log.warning('unable to uninstall app ' + app) - - def _uninstall_all_jni(self): - '''Uninstall all apks used by the test suite from the device. - - Raises: - TestSuiteException: An apk could not be uninstalled. - ''' - for app, package in self._tests_jni.items(): - output = self._android.adb('uninstall ' + package) - - if 'Success' not in output: - raise TestSuiteException('unable to uninstall app ' + app) - - def _delete_all_ndk(self): - '''Delete all ndk binaries that were pushed to the device. - - Raises: - TestSuiteException: A binary could not be deleted from the device. - ''' - for app in self._tests_ndk: - output = self._android.shell('rm /data/' + app) - if 'No such file or directory' in output: - self._log.warning('unable to uninstall app ' + app) - - - def push_all(self): - '''Push all apk and ndk binaries required by the testsuite to the device - - Raises: - TestSuiteException: One or more apks could not be installed or - previously running processes thereof could not - be killed. - ''' - self._push_all_java() - self._push_all_ndk() - self._push_all_jni() - - def _install_apk(self, app, package): - '''Push an apk files to the device. - - This involves uninstalling any old installation and installing again. - - Args: - app: A string that is the name of the apk. - package: A string that is the name of the package of the apk. - - Raises: - TestSuiteException: The apk could not be installed. - ''' - self._log.info('pushing {0}'.format(app)) - - self._android.stop_app(package) - - self._android.adb('uninstall ' + package) - # Ignore the output of uninstall. - # The app may not have been installed in the first place. That's ok. - - flags = '' - - product_folder = self._aosp_product_path - if not product_folder: - raise TestSuiteException(self._missing_path_msg) - - app_folder = os.path.join(product_folder, 'data/app') - - cmd = 'install {0} {1}/{2}/{2}.apk'.format(flags, app_folder, app) - output = self._android.adb(cmd, False, True, - util_constants.PUSH_TIMEOUT) - if ('Success' not in output) or ("can't find" in output): - raise TestSuiteException('unable to install app {}: {}'.format( - app, output)) - - def _push_all_java(self): - '''Push all apk files to the device. - - This involves uninstalling any old installations and installing again. - - Raises: - TestSuiteException: An apk could not be installed. - ''' - for app, package in self._tests_apk.items(): - self._install_apk(app, package) - - def _push_all_ndk(self): - '''Push all ndk binaries to the device. - - Raises: - TestSuiteException: A binary could not be pushed to the device or - a previous process could not be killed. - ''' - product_folder = self._aosp_product_path - if not product_folder: - raise TestSuiteException(self._missing_path_msg) - - bin_folder = os.path.join(product_folder, 'system/bin') - - for app in self._tests_ndk: - self._log.info('pushing {0}'.format(app)) - - self._android.kill_all_processes(app) - - cmd = 'push %s/%s /data' % (bin_folder, app) - output = self._android.adb(cmd, False, True, - util_constants.PUSH_TIMEOUT) - if ('failed to copy' in output or - 'No such file or directory' in output): - raise TestSuiteException('unable to push binary ' + app) - - # be sure to set the execute bit for NDK binaries - self._android.shell('chmod 777 /data/{0}'.format(app)) - - def _push_all_jni(self): - '''Push all JNI apk files to the device. - - This involves uninstalling any old installations and installing again. - - Raises: - TestSuiteException: An apk could not be installed. - ''' - product_folder = self._aosp_product_path - if not product_folder: - raise TestSuiteException(self._missing_path_msg) - - app_folder = os.path.join(product_folder, 'system/lib') - - # Ensure the system/lib directory is writable - self._android.make_device_writeable() - - for app, package in self._tests_jni.items(): - self._install_apk(app, package) - - def delete_ndk_cache(self): - '''Deletes NDK cached scripts from the device. - - The NDK caches compiled scripts as shared libraries in - the folder specified when calling `rs->init()`. - - For all out tests this is set to '/data/rscache'. - ''' - self._android.shell('rm -r /data/rscache') - - def get_package(self, app_name): - '''From a given apk name get the name of its package. - - Args: - app_name: The string that is the name of the apk. - - Returns: - A string representing the name of the package of the app. - - Raises: - TestSuiteException: The app name is not in the list of apks. - ''' - if app_name in self._tests_apk: - return self._tests_apk[app_name] - elif app_name in self._tests_jni: - return self._tests_jni[app_name] - else: - msg = ('unknown app %s. (Do you need to add an ' - 'entry to bundle.py :: test_apps_?)' % app_name) - raise TestSuiteException(msg) - return self._tests_apk[app_name] - - def launch(self, app_name): - '''Launch an apk/ndk app on a remote device. - - Args: - app_name: The string that is the name of the APK or NDK executable. - - Returns: - The Process ID of the launched executable, otherwise None - - Raises: - TestSuiteException: Previous processes of this apk could not be - killed. - ''' - process_name = '' - success = False - if app_name in self._tests_apk: - process_name = self._tests_apk[app_name] - - self._android.kill_all_processes(process_name) - - success = self._android.launch_app(process_name, 'MainActivity') - elif app_name in self._tests_ndk: - process_name = app_name - self._android.kill_all_processes(process_name) - success = self._android.launch_elf(process_name) - elif app_name in self._tests_jni: - package = self._tests_jni[app_name] - - self._android.kill_process(package) - - success = self._android.launch_app(package, 'MainActivity') - if not success: - self._log.log_and_print(app_name + - ' is not installed. Try removing the --no-install option?') - return None - - return self._android.find_app_pid(package) - else: - self._log.error('Executable {0} neither Java nor NDK.' - .format(app_name)) - - self._log.fatal('Failed to launch test executable {0}' - .format(app_name)) - return None - - if not success: - self._log.log_and_print(app_name + - ' is not installed. Try removing the --no-install option?') - return None - - return self._android.find_app_pid(process_name) - - def check_apps_installed(self, java_only): - ''' Check whether all Java/JNI/NDK apps are installed on the device. - - Args: - java_only: Boolean to specify whether only the Java apks should be - checked (in case of --wimpy mode for example). - - Raises: - TestSuiteException: Not all apps are installed. - ''' - java_and_jni_apks = self._tests_apk.copy() - - if not java_only: - java_and_jni_apks.update(self._tests_jni) - - installed = self._android.shell('pm list packages -f') - - for app, package in java_and_jni_apks.items(): - if package not in installed: - raise TestSuiteException('apk %s is not installed.' % app) - - if not java_only: - ls_data = self._android.shell('ls /data') - for app in self._tests_ndk: - if app not in ls_data: - raise TestSuiteException('app %s is not installed.' % app) diff --git a/tests/lldb/tests/harness/util_constants.py b/tests/lldb/tests/harness/util_constants.py deleted file mode 100644 index 9c7b18c4..00000000 --- a/tests/lldb/tests/harness/util_constants.py +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -'''This file contains constants shared between the test suite runner and the -individual test runner.''' - -from __future__ import absolute_import - -RC_TEST_OK = 0 -RC_TEST_TIMEOUT = 64 -RC_TEST_FAIL = 65 -RC_TEST_FATAL = 66 -RC_TEST_IGNORED = 67 -PUSH_TIMEOUT = 60*5 - diff --git a/tests/lldb/tests/harness/util_functions.py b/tests/lldb/tests/harness/util_functions.py deleted file mode 100644 index 32dca1c4..00000000 --- a/tests/lldb/tests/harness/util_functions.py +++ /dev/null @@ -1,52 +0,0 @@ -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -'''This file contains utility functions used by both the test suite and the -single test executor.''' - -from __future__ import absolute_import - -import os -import importlib -import sys - - -def load_py_module(path): - '''Load a python file from disk. - - Args: - path: String path to python file. - - Returns: - python module if success, None otherwise. - ''' - assert isinstance(path, str) - try: - if not os.path.exists(path): - print('Path does not exist: ' + path) - return None - path = os.path.abspath(path) - module_dir, module_file = os.path.split(path) - module_name, _ = os.path.splitext(module_file) - # adjust sys.path, runtime counterpart of PYTHONPATH, to temporarily - # include the folder containing the user configuration module - sys.path.append(module_dir) - module_obj = importlib.import_module(module_name) - sys.path.pop(0) - return module_obj - except ImportError as err: - print(str(err)) - print("Looking in directory ") - print(module_dir) - return None diff --git a/tests/lldb/tests/harness/util_lldb.py b/tests/lldb/tests/harness/util_lldb.py deleted file mode 100644 index 2d1adcac..00000000 --- a/tests/lldb/tests/harness/util_lldb.py +++ /dev/null @@ -1,87 +0,0 @@ -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -'''Module that contains the class UtilLLDB, which provides lldb utility -methods.''' - -from __future__ import absolute_import - -from . import util_constants - -try: - import lldb -except ImportError: - print('unable to import lldb') - print('please run "lldb -P" and add to $PYTHONPATH') - quit(util_constants.RC_TEST_FATAL) - - -class UtilLLDB(object): - '''Provides utility methods to interface with lldb's python bindings.''' - - @staticmethod - def start(): - '''Initialise the lldb debugger framework.''' - lldb.SBDebugger_Initialize() - - @staticmethod - def stop(): - '''Terminate the lldb debugger framework. - - Raises: - AssertionError: If an assertion fails. - ''' - assert lldb - lldb.SBDebugger_Terminate() - - @staticmethod - def create_debugger(): - '''Create an lldb debugger instance. - - Returns: - The SBDebugger instance that was created. - - Raises: - AssertionError: If an assertion fails. - ''' - assert lldb - inst = lldb.SBDebugger_Create() - inst.SetAsync(False) - return inst - - @staticmethod - def destroy_debugger(dbg): - '''Destroy the lldb debugger instance. - - Args: - dbg: Instance of SBDebugger that is to be destroyed. - - Raises: - AssertionError: If an assertion fails. - ''' - assert lldb - lldb.SBDebugger_Destroy(dbg) - - @staticmethod - def get_module(): - '''Get the lldb module. - - Returns: - The lldb module. - - Raises: - AssertionError: If an assertion fails. - ''' - assert lldb - return lldb diff --git a/tests/lldb/tests/harness/util_log.py b/tests/lldb/tests/harness/util_log.py deleted file mode 100644 index fec07036..00000000 --- a/tests/lldb/tests/harness/util_log.py +++ /dev/null @@ -1,141 +0,0 @@ -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -'''Initialise the Python logging facility for the test suite. - -from __future__ import absolute_import - -It provides the function to initialise the logging facility and retrieve an -instance of the logger class. It also contains the definition of the internal -logger class. -''' -from __future__ import print_function - -import io -import sys -import logging - - -INITIALISED = False -NAMESPACE = 'RS_LLDB_TESTSUITE' - -def initialise(identifier, level=logging.INFO, print_to_stdout=False, - file_path=None, file_mode='a'): - '''Initialise the logging facility for the test suite. - - This function should be invoked only once, at the start of the program, and - before emitting any log. - - Args: - identifier: String, a label that will be part of each record. It is - usually the test case name. - level: Integer, all messages above this log level will be discarded. - Valid values are those recognised by the python logging module: - https://docs.python.org/2/library/logging.html#levels . - print_to_stdout: Boolean, whether the logs should be redirected to - sys.stdout (true) or stored into a text file (false). - file_path: String, path to the text file in which to store the logs. - This option is only meaningful when print_to_stdout = False. - file_mode: String, the mode to open the text file. Valid modes are - those recognised by the standard Python `open' function. - This option is only meaningful when print_to_stdout = False. - - Raises: - RuntimeError: If the logging has already been initialised - ValueError: If the argument "file_path" has not been provided when - print_to_stdout=False - ''' - # pylint: disable=global-statement - global INITIALISED - if INITIALISED: - raise RuntimeError('Already initialised') - - # set the logging class - old_logger_class = logging.getLoggerClass() - logging.setLoggerClass(RsLogger) - - # initialise the Logger - log = logging.getLogger(NAMESPACE) - log.setLevel(level) # reject all logs below - - # don't propagate the log records to the logging root - log.propagate = False - - # restore the previous class - logging.setLoggerClass(old_logger_class) - - # handler - if print_to_stdout: - handler_default = logging.StreamHandler(sys.stdout) - else: - if file_path is None: - raise ValueError('Missing mandatory argument "file_path"') - - handler_default = logging.FileHandler(file_path, file_mode) - - # Do not filter records in the handler because of the level - handler_default.setLevel(logging.NOTSET) - - # format the message - handler_default.setFormatter( - logging.Formatter( - '%(asctime)s [{0}] [%(levelname)s] %(message)s' - .format(identifier) - )) - - log.addHandler(handler_default) - - INITIALISED = True - - -class RsLogger(logging.getLoggerClass()): - '''Internal logging class. - - This is an internal class to enhance the logging facility with the methods - "log_and_print" and "seek_to_end". - ''' - # pylint: disable=too-many-public-methods - - def log_and_print(self, msg, level=logging.INFO): - '''Print "msg" to stdout and emit a log record. - - Args: - msg: The message to emit. - level: The level to use. By default it is logging.INFO. - ''' - print(msg) - self.log(level, msg) - - def seek_to_end(self): - '''Reset the cursor position to the end for all handlers that are - Text File managers.''' - for hndlr in self.handlers: - if isinstance(hndlr, logging.FileHandler): - hndlr.stream.seek(0, io.SEEK_END) - - -def get_logger(): - '''Retrieves the Logger instance related to the testsuite. - - Throws: - RuntimeError: If the logging facility has not been initialised with - "initialise" beforehand. - - Returns: - An instance of logging.Logger to write the logs. - ''' - if not INITIALISED: - raise RuntimeError('Logging facility not initialised') - - return logging.getLogger(NAMESPACE) diff --git a/tests/lldb/tests/harness/util_timer.py b/tests/lldb/tests/harness/util_timer.py deleted file mode 100644 index b83a76f1..00000000 --- a/tests/lldb/tests/harness/util_timer.py +++ /dev/null @@ -1,92 +0,0 @@ -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -'''Timer utility''' - -from __future__ import absolute_import - -import threading - - -class Timer(object): - '''A Timer utility to execute a callback after a certain interval.''' - - def __init__(self, interval, callback): - '''Initialise the Timer without starting it. - - Args: - interval: int or float, interval in seconds to count, before - invoking the callback - callback: function, it handles the function to call once - the timeout expires. - ''' - - # validate input parameters - if not isinstance(interval, (int, float)): - raise TypeError('Argument "interval" is not a number: ' - '{0}'.format(type(interval))) - if not callable(callback): - raise TypeError('Argument "callback" is not a function: ' - '{0}'.format(type(callback))) - - self._timer = None - self._callback = callback - self._interval = interval - - def _is_running(self): - '''Checks whether the timer is executing. - - Returns: - boolean, true if the timer is currently running, false otherwise - ''' - return self._timer is not None - - def start(self): - '''Starts the timer. - - Returns: - self, the Timer instance - - Throws: - RuntimeError: if the timer is already running - ''' - if self._is_running(): - raise RuntimeError('Timer already running') - - self._timer = threading.Timer(self._interval, self._callback) - self._timer.start() - return self # so that we can perform Timer(...).start() - - def stop(self): - '''Stops the timer if it's executing. - - Returns: - self, the Timer instance - ''' - - if self._is_running(): - self._timer.cancel() - self._timer = None - return self - - def reset(self): - '''Restart the timer. - - Returns: - self, the Timer instance - ''' - - self.stop() - self.start() - return self diff --git a/tests/lldb/tests/harness/util_warnings.py b/tests/lldb/tests/harness/util_warnings.py deleted file mode 100644 index dd527404..00000000 --- a/tests/lldb/tests/harness/util_warnings.py +++ /dev/null @@ -1,60 +0,0 @@ -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -'''Redirect the Python warnings into the log.''' - -from __future__ import absolute_import - -import warnings - -from . import util_log - -_OLD_WARNINGS_HANDLER = None - - -def redirect_warnings(): - '''Redirect all warnings issued by warnings::warn to the log. - - By default all python warnings are printed into sys.stderr. This method - will force to redirect them into the test suite logger. - ''' - - # pylint: disable=global-statement - global _OLD_WARNINGS_HANDLER - - # Already redirecting? - if _OLD_WARNINGS_HANDLER: - return None - - _OLD_WARNINGS_HANDLER = warnings.showwarning - - log = util_log.get_logger() - - def _redirect_warnings_to_log(*args): - '''Redirect the warnings to the Logger.''' - log.warn(warnings.formatwarning(*args).rstrip()) - - warnings.showwarning = _redirect_warnings_to_log - - -def restore_warnings(): - '''Restore the reporting of warnings::warn as before.''' - - # pylint: disable=global-statement - global _OLD_WARNINGS_HANDLER - - if _OLD_WARNINGS_HANDLER: - warnings.showwarning = _OLD_WARNINGS_HANDLER - _OLD_WARNINGS_HANDLER = None - diff --git a/tests/lldb/tests/run_test.py b/tests/lldb/tests/run_test.py deleted file mode 100644 index 50a0530b..00000000 --- a/tests/lldb/tests/run_test.py +++ /dev/null @@ -1,422 +0,0 @@ -#!/usr/bin/env python - -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -'''This script will run one specific test.''' -from __future__ import print_function, absolute_import - -import os -import sys -import atexit -import inspect -import logging -import argparse -import warnings - -import harness -from harness import util_constants -from harness import util_log -from harness import util_warnings -from harness.util_functions import load_py_module -from harness.util_lldb import UtilLLDB -from harness.exception import DisconnectedException -from harness.exception import TestSuiteException, TestIgnoredException -from harness.util_timer import Timer - - -class TestState(object): - '''Simple mutable mapping (like namedtuple)''' - def __init__(self, **kwargs): - for key, val in kwargs.items(): - setattr(self, key, val) - - -def _test_pre_run(state): - '''This function is called before a test is executed (setup). - - Args: - state: Test suite state collection, instance of TestState. - - Returns: - True if the pre_run step completed without error. Currently the pre-run - will launch the target test binary on the device and attach an - lldb-server to it in platform mode. - - Raises: - AssertionError: If an assertion fails. - TestSuiteException: Previous processes of this apk required for this - test could not be killed. - ''' - assert state.test - assert state.bundle - - log = util_log.get_logger() - log.info('running: {0}'.format(state.name)) - - # Remove any cached NDK scripts between tests - state.bundle.delete_ndk_cache() - - # query our test case for the remote target app it needs - # First try the legacy behaviour - try: - target_name = state.test.get_bundle_target() - warnings.warn("get_bundle_target() is deprecated and will be removed soon" - " - use the `bundle_target` dictionary attribute instead") - except AttributeError: - try: - target_name = state.test.bundle_target[state.bundle_type] - except KeyError: - raise TestIgnoredException() - - if target_name is None: - # test case doesn't require a remote process to debug - return True - else: - # find the pid of our remote test process - state.pid = state.bundle.launch(target_name) - if not state.pid: - log.error('unable to get pid of target') - return False - state.android.kill_servers() - # spawn lldb platform on the target device - state.android.launch_lldb_platform(state.device_port) - return True - - -def _test_post_run(state): - '''This function is called after a test is executed (cleanup). - - Args: - state: Test suite state collection, instance of TestState. - - Raises: - AssertionError: If an assertion fails. - ''' - assert state.test - assert state.bundle - - try: - target_name = state.test.get_bundle_target() - warnings.warn("get_bundle_target() is deprecated and will be removed soon" - " - use the `bundle_target` dictionary attribute instead") - except AttributeError: - try: - target_name = state.test.bundle_target[state.bundle_type] - except KeyError: - raise TestIgnoredException() - - - if target_name: - if state.bundle.is_apk(target_name): - state.android.stop_app(state.bundle.get_package(target_name)) - else: - state.android.kill_process(target_name) - - -def _test_run(state): - '''Execute a single test suite. - - Args: - state: test suite state collection, instance of TestState. - - Returns: - True: if the test case ran successfully and passed. - False: if the test case failed or suffered an error. - - Raises: - AssertionError: If an assertion fails. - ''' - assert state.lldb - assert state.lldb_module - assert state.test - - test_failures = state.test.run(state.lldb, state.pid, state.lldb_module) - - if test_failures: - log = util_log.get_logger() - for test, err in test_failures: - log.error('test %s:%s failed: %r' % (state.name, test, err)) - - return False - - return True - - -def _initialise_timer(android, interval): - '''Start a 'timeout' timer, to catch stalled execution. - - This function will start a timer that will act as a timeout killing this - test session if a test becomes un-responsive. - - Args: - android: current instance of harness.UtilAndroid - interval: the interval for the timeout, in seconds - - Returns: - The instance of the Timer class that was created. - ''' - - def on_timeout(): - '''This is a callback function that will fire if a test takes longer - then a threshold time to complete.''' - # Clean up the android properties - android.reset_all_props() - # pylint: disable=protected-access - sys.stdout.flush() - # hard exit to force kill all threads that may block our exit - os._exit(util_constants.RC_TEST_TIMEOUT) - - timer = Timer(interval, on_timeout) - timer.start() - atexit.register(Timer.stop, timer) - return timer - - -def _quit_test(num, timer): - '''This function will exit making sure the timeout thread is killed. - - Args: - num: An integer specifying the exit status, 0 meaning "successful - termination". - timer: The current Timer instance. - ''' - if timer: - timer.stop() - sys.stdout.flush() - sys.exit(num) - - -def _execute_test(state): - '''Execute a test suite. - - Args: - state: The current TestState object. - ''' - log = util_log.get_logger() - - state.test.setup(state.android) - try: - if not _test_pre_run(state): - raise TestSuiteException('test_pre_run() failed') - if not _test_run(state): - raise TestSuiteException('test_run() failed') - _test_post_run(state) - log.info('Test passed') - - finally: - state.test.post_run() - state.test.teardown(state.android) - - -def _get_test_case_class(module): - '''Inspect a test case module and return the test case class. - - Args: - module: A loaded test case module. - ''' - # We consider only subclasses of TestCase that have `test_` methods` - log = util_log.get_logger() - log.debug("loading test suites from %r", module) - for name, klass in inspect.getmembers(module, inspect.isclass): - for attr in dir(klass): - if attr.startswith('test_'): - log.info("Found test class %r", name) - return klass - else: - log.debug("class %r has no test_ methods", name) - return None - - -def get_test_dir(test_name): - ''' Get the directory that contains a test with a given name. - - Returns: - A string that is the directory containing the test. - - Raises: - TestSuiteException: If a test with this name does not exist. - ''' - tests_dir = os.path.dirname(os.path.realpath(__file__)) - for sub_dir in os.listdir(tests_dir): - current_test_dir = os.path.join(tests_dir, sub_dir) - if (os.path.isdir(current_test_dir) and - test_name in os.listdir(current_test_dir)): - return current_test_dir - - raise TestSuiteException( - 'unable to find test: {0}'.format(test_name)) - - -def main(): - '''Test runner entry point.''' - - # re-open stdout with no buffering - sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0) - - android = None - timer = None - log = None - - # parse the command line (positional arguments only) - truthy = lambda x: x.lower() in ('true', '1') - parser = argparse.ArgumentParser("Run a single RenderScript TestSuite against lldb") - for name, formatter in ( - ('test_name', str), - ('log_file_path', str), - ('adb_path', str), - ('lldb_server_path_device', str), - ('aosp_product_path', str), - ('device_port', int), - ('device', str), - ('print_to_stdout', truthy), - ('verbose', truthy), - ('wimpy', truthy), - ('timeout', int), - ('bundle_type', str), - ): - parser.add_argument(name, type=formatter) - - args = parser.parse_args() - - try: - # create utility classes - harness.util_log.initialise( - '%s(%s)' % (args.test_name, args.bundle_type), - print_to_stdout=args.print_to_stdout, - level=logging.INFO if not args.verbose else logging.DEBUG, - file_path=args.log_file_path, - file_mode='a' - ) - log = util_log.get_logger() - log.debug('Logger initialised') - - android = harness.UtilAndroid(args.adb_path, - args.lldb_server_path_device, - args.device) - - # start the timeout counter - timer = _initialise_timer(android, args.timeout) - - # startup lldb and register teardown handler - atexit.register(UtilLLDB.stop) - UtilLLDB.start() - - current_test_dir = get_test_dir(args.test_name) - - # load a test case module - test_module = load_py_module(os.path.join(current_test_dir, - args.test_name)) - - - # inspect the test module and locate our test case class - test_class = _get_test_case_class(test_module) - - # if our test inherits from TestBaseRemote, check we have a valid device - if (hasattr(test_module, "TestBaseRemote") and - issubclass(test_class, test_module.TestBaseRemote)): - android.validate_device() - - # create an instance of our test case - test_inst = test_class( - args.device_port, - args.device, - timer, - args.bundle_type, - wimpy=args.wimpy - ) - - # instantiate a test target bundle - bundle = harness.UtilBundle(android, args.aosp_product_path) - - # execute the test case - try: - for _ in range(2): - try: - # create an lldb instance - lldb = UtilLLDB.create_debugger() - - # create state object to encapsulate instances - - state = TestState( - android=android, - bundle=bundle, - lldb=lldb, - lldb_module=UtilLLDB.get_module(), - test=test_inst, - pid=None, - name=args.test_name, - device_port=args.device_port, - bundle_type=args.bundle_type - ) - - util_warnings.redirect_warnings() - - _execute_test(state) - - # tear down the lldb instance - UtilLLDB.destroy_debugger(lldb) - break - except DisconnectedException as error: - log.warning(error) - log.warning('Trying again.') - else: - log.fatal('Not trying again, maximum retries exceeded.') - raise TestSuiteException('Lost connection to lldb-server') - - finally: - util_warnings.restore_warnings() - - _quit_test(util_constants.RC_TEST_OK, timer) - - except AssertionError: - if log: - log.critical('Internal test suite error', exc_info=1) - print('Internal test suite error', file=sys.stderr) - _quit_test(util_constants.RC_TEST_FATAL, timer) - - except TestIgnoredException: - if log: - log.warn("test ignored") - _quit_test(util_constants.RC_TEST_IGNORED, timer) - - except TestSuiteException as error: - if log: - log.exception(str(error)) - else: - print(error, file=sys.stderr) - _quit_test(util_constants.RC_TEST_FAIL, timer) - - # use a global exception handler to be sure that we will - # exit safely and correctly - except Exception: - if log: - log.exception('INTERNAL ERROR') - else: - import traceback - print('Exception {0}'.format(traceback.format_exc()), - file=sys.stderr) - _quit_test(util_constants.RC_TEST_FATAL, timer) - - finally: - if android: - android.reset_all_props() - if timer: - timer.stop() - - -# execution trampoline -if __name__ == '__main__': - print(' '.join(sys.argv)) - main() diff --git a/tests/lldb/tests/testcases/reduce_common.py b/tests/lldb/tests/testcases/reduce_common.py deleted file mode 100644 index 462d0b39..00000000 --- a/tests/lldb/tests/testcases/reduce_common.py +++ /dev/null @@ -1,102 +0,0 @@ -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import re - -REDUCE_ITERATIONS = 128 # This is in MainActivity.java -REDUCE_STARTVAL = 10 # This is in MainActivity.java -REDUCE_AUTO_COMB_SCRIPT = "reduce_common.rsh" -REDUCE_SCRIPT = "reduce_common.rsh" -X_TESTS = 100 -Y_TESTS = 2 -Z_TESTS = 2 - - -class ReductionMixin(object): - def _test_func_role_combinations(self, func_role_combinations): - """ - Assert that when a reduction breakpoint is conditional on a function - role, that breakpoints are only set on the the given functions. - We do this by setting breakpoints on all possible pairs of functions - and check that the resolved breakpoints are on functions that are part - of the given pair - """ - for combination in func_role_combinations: - self._delete_breakpoints() - self.try_command( - 'language renderscript reduction breakpoint set ' - 'find_min_user_type --function-role %s' % ( - ','.join(combination) - ), - [r'Breakpoint(s) created'] - ) - func_suffixes = [combination[0][:4], combination[1][:4]] - # just match the first 4 chars of the roles prefix - funcs_match = 'find_min_user_type_((%s|%s))' % tuple(func_suffixes) - # now check we stop on both functions for each coordinate in the - # allocation - for x in range(REDUCE_ITERATIONS): - output = self.try_command( - 'process continue', - expected_regex=[ - r'resuming', - r'Process \d+ stopped', - r'frame #0: (0x[0-9a-fA-F]+ )?librs.reduce.so`%s' % funcs_match - ] - ) - for line in output.splitlines(): - match = re.search(funcs_match, line) - if match: - try: - func_suffixes.remove(match.group(1)) - except ValueError: - # The outconverter may only be called in the final - # step but the accumulator will be called for every - # input index - continue - break - if len(func_suffixes) == 0: - # We've popped the functions we're interested in off the list - break - else: - raise self.TestFail( - "unable to match function roles for " + repr(combination)) - - def _reduction_breakpoint_set_single_type( - self, script_soname, script_basename, reduce_name, funcname_types): - """ - Assert - for each function role - that the correct symbol is resolved - and trapped by the debugger. - """ - for func, typename in funcname_types: - self._delete_breakpoints() - breakpoint_match = r'Breakpoint \d+: where = librs.%s.so`%s' - # Autogenerated combiners don't have a filename in the debugger - if not func.endswith(".combiner"): - breakpoint_match = r'%s (\+ \d+ )?at %s' % ( - breakpoint_match, script_basename) - self.try_command( - 'language renderscript reduction breakpoint set %s' - ' --function-role %s' % (reduce_name, typename), - expected_regex=[breakpoint_match % (script_soname, func)] - ) - self.try_command( - 'process continue', - expected_regex=[ - r'resuming', - r'Process \d+ stopped', - r'frame #0: (0x[0-9a-fA-F]+ )?librs.%s.so`%s' % ( - script_soname, func) - ] - ) diff --git a/tests/lldb/tests/testcases/test_allocation_dump_1.py b/tests/lldb/tests/testcases/test_allocation_dump_1.py deleted file mode 100644 index 53e77fc2..00000000 --- a/tests/lldb/tests/testcases/test_allocation_dump_1.py +++ /dev/null @@ -1,348 +0,0 @@ -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -'''Module that contains the test TestAllocationDump1.''' -from __future__ import absolute_import - -import os - -from harness.test_base_remote import TestBaseRemote -from harness.decorators import ( - ordered_test, - wimpy, - cpp_only_test, -) - - -class TestAllocationDump1(TestBaseRemote): - '''Tests printing the contents of allocations.''' - - bundle_target = { - 'java': 'Allocations', - 'jni': 'JNIAllocations', - 'cpp': 'CppAllocations' - } - - @wimpy - @ordered_test(0) - def test_setup(self): - self.try_command('language renderscript kernel breakpoint all enable', - ['Breakpoints will be set on all kernels']) - - self.try_command('process continue', - ['resuming', - 'stopped', - 'stop reason = breakpoint']) - - @wimpy - def test_dump_to_file1(self): - # Test dumping large allocations to file - output_file_1 = self.get_tmp_file_path() - - self.try_command('language renderscript allocation dump 1 -f ' + - output_file_1, - ["Results written to '%s'" % output_file_1]) - - # Check the file was created - self.assert_true(os.path.isfile(output_file_1)) - os.remove(output_file_1) - - def test_dump_to_file2(self): - output_file_2 = self.get_tmp_file_path() - - self.try_command('language renderscript allocation dump 2 -f ' + - output_file_2, - ["Results written to '%s'" % output_file_2]) - - self.assert_true(os.path.isfile(output_file_2)) - os.remove(output_file_2) - - @wimpy - def test_dump_char(self): - self.try_command('language renderscript allocation dump 3', - ['(0, 0, 0) = 0', - '(0, 1, 0) = 1', - '(0, 2, 0) = 2', - '(0, 0, 1) = 3', - '(0, 1, 1) = 4', - '(0, 2, 1) = 5', - '(0, 0, 2) = 6', - '(0, 1, 2) = 7', - '(0, 2, 2) = 8', - '(0, 0, 3) = 9', - '(0, 1, 3) = 10', - '(0, 2, 3) = 11', - '(0, 0, 4) = 12', - '(0, 1, 4) = 13', - '(0, 2, 4) = 14', - '(0, 0, 5) = 15', - '(0, 1, 5) = 16', - '(0, 2, 5) = 17', - '(0, 0, 6) = 18', - '(0, 1, 6) = 19', - '(0, 2, 6) = 20', - '(0, 0, 7) = 21', - '(0, 1, 7) = 22', - '(0, 2, 7) = 23']) - - def test_dump_char2(self): - self.try_command('language renderscript allocation dump 4', - ['(0, 0, 0) = {0 1}', - '(1, 0, 0) = {2 3}', - '(2, 0, 0) = {4 5}', - '(3, 0, 0) = {6 7}', - '(4, 0, 0) = {8 9}', - '(5, 0, 0) = {10 11}', - '(6, 0, 0) = {12 13}', - '(7, 0, 0) = {14 15}', - '(8, 0, 0) = {16 17}', - '(9, 0, 0) = {18 19}', - '(10, 0, 0) = {20 21}', - '(11, 0, 0) = {22 23}']) - - def test_dump_char3(self): - self.try_command('language renderscript allocation dump 5', - ['(0, 0, 0) = {0 1 2}', - '(1, 0, 0) = {4 5 6}', - '(2, 0, 0) = {8 9 10}', - '(3, 0, 0) = {12 13 14}', - '(4, 0, 0) = {16 17 18}', - '(5, 0, 0) = {20 21 22}']) - - def test_dump_char4(self): - self.try_command('language renderscript allocation dump 6', - ['(0, 0, 0) = {0 1 2 3}', - '(1, 0, 0) = {4 5 6 7}', - '(2, 0, 0) = {8 9 10 11}', - '(3, 0, 0) = {12 13 14 15}', - '(4, 0, 0) = {16 17 18 19}', - '(5, 0, 0) = {20 21 22 23}']) - - def test_dump_short(self): - self.try_command('language renderscript allocation dump 7', - ['(0, 0, 0) = 0', - '(1, 0, 0) = 1', - '(2, 0, 0) = 2', - '(3, 0, 0) = 3', - '(4, 0, 0) = 4', - '(5, 0, 0) = 5', - '(6, 0, 0) = 6', - '(7, 0, 0) = 7', - '(8, 0, 0) = 8', - '(9, 0, 0) = 9', - '(10, 0, 0) = 10', - '(11, 0, 0) = 11', - '(12, 0, 0) = 12', - '(13, 0, 0) = 13', - '(14, 0, 0) = 14', - '(15, 0, 0) = 15', - '(16, 0, 0) = 16', - '(17, 0, 0) = 17', - '(18, 0, 0) = 18', - '(19, 0, 0) = 19', - '(20, 0, 0) = 20', - '(21, 0, 0) = 21', - '(22, 0, 0) = 22', - '(23, 0, 0) = 23']) - - def test_dump_short2(self): - self.try_command('language renderscript allocation dump 8', - ['(0, 0, 0) = {0 1}', - '(1, 0, 0) = {2 3}', - '(2, 0, 0) = {4 5}', - '(3, 0, 0) = {6 7}', - '(4, 0, 0) = {8 9}', - '(5, 0, 0) = {10 11}', - '(0, 0, 1) = {12 13}', - '(1, 0, 1) = {14 15}', - '(2, 0, 1) = {16 17}', - '(3, 0, 1) = {18 19}', - '(4, 0, 1) = {20 21}', - '(5, 0, 1) = {22 23}']) - - def test_dump_short3(self): - self.try_command('language renderscript allocation dump 9', - ['(0, 0, 0) = {0 1 2}', - '(1, 0, 0) = {4 5 6}', - '(2, 0, 0) = {8 9 10}', - '(3, 0, 0) = {12 13 14}', - '(4, 0, 0) = {16 17 18}', - '(5, 0, 0) = {20 21 22}']) - - def test_dump_short4(self): - self.try_command('language renderscript allocation dump 10', - ['(0, 0, 0) = {0 1 2 3}', - '(1, 0, 0) = {4 5 6 7}', - '(2, 0, 0) = {8 9 10 11}', - '(3, 0, 0) = {12 13 14 15}', - '(4, 0, 0) = {16 17 18 19}', - '(5, 0, 0) = {20 21 22 23}']) - - def test_dump_int(self): - self.try_command('language renderscript allocation dump 11', - ['(0, 0, 0) = 0', - '(1, 0, 0) = 1', - '(2, 0, 0) = 2', - '(3, 0, 0) = 3', - '(4, 0, 0) = 4', - '(5, 0, 0) = 5', - '(6, 0, 0) = 6', - '(7, 0, 0) = 7', - '(8, 0, 0) = 8', - '(9, 0, 0) = 9', - '(10, 0, 0) = 10', - '(11, 0, 0) = 11', - '(12, 0, 0) = 12', - '(13, 0, 0) = 13', - '(14, 0, 0) = 14', - '(15, 0, 0) = 15', - '(16, 0, 0) = 16', - '(17, 0, 0) = 17', - '(18, 0, 0) = 18', - '(19, 0, 0) = 19', - '(20, 0, 0) = 20', - '(21, 0, 0) = 21', - '(22, 0, 0) = 22', - '(23, 0, 0) = 23']) - - def test_dump_int2(self): - self.try_command('language renderscript allocation dump 12', - ['(0, 0, 0) = {0 1}', - '(1, 0, 0) = {2 3}', - '(2, 0, 0) = {4 5}', - '(3, 0, 0) = {6 7}', - '(4, 0, 0) = {8 9}', - '(5, 0, 0) = {10 11}', - '(6, 0, 0) = {12 13}', - '(7, 0, 0) = {14 15}', - '(8, 0, 0) = {16 17}', - '(9, 0, 0) = {18 19}', - '(10, 0, 0) = {20 21}', - '(11, 0, 0) = {22 23}']) - - def test_dump_int3(self): - self.try_command('language renderscript allocation dump 13', - ['(0, 0, 0) = {0 1 2}', - '(1, 0, 0) = {4 5 6}', - '(2, 0, 0) = {8 9 10}', - '(0, 1, 0) = {12 13 14}', - '(1, 1, 0) = {16 17 18}', - '(2, 1, 0) = {20 21 22}']) - - def test_dump_int4(self): - self.try_command('language renderscript allocation dump 14', - ['(0, 0, 0) = {0 1 2 3}', - '(1, 0, 0) = {4 5 6 7}', - '(2, 0, 0) = {8 9 10 11}', - '(3, 0, 0) = {12 13 14 15}', - '(4, 0, 0) = {16 17 18 19}', - '(5, 0, 0) = {20 21 22 23}']) - - def test_dump_int5(self): - self.try_command('language renderscript allocation dump 15', - ['(0, 0, 0) = 0', - '(1, 0, 0) = 1', - '(2, 0, 0) = 2', - '(3, 0, 0) = 3', - '(4, 0, 0) = 4', - '(5, 0, 0) = 5', - '(6, 0, 0) = 6', - '(7, 0, 0) = 7', - '(8, 0, 0) = 8', - '(9, 0, 0) = 9', - '(10, 0, 0) = 10', - '(11, 0, 0) = 11', - '(12, 0, 0) = 12', - '(13, 0, 0) = 13', - '(14, 0, 0) = 14', - '(15, 0, 0) = 15', - '(16, 0, 0) = 16', - '(17, 0, 0) = 17', - '(18, 0, 0) = 18', - '(19, 0, 0) = 19', - '(20, 0, 0) = 20', - '(21, 0, 0) = 21', - '(22, 0, 0) = 22', - '(23, 0, 0) = 23']) - - def test_dump_long2(self): - self.try_command('language renderscript allocation dump 16', - ['(0, 0, 0) = {0 1}', - '(1, 0, 0) = {2 3}', - '(2, 0, 0) = {4 5}', - '(3, 0, 0) = {6 7}', - '(4, 0, 0) = {8 9}', - '(5, 0, 0) = {10 11}', - '(6, 0, 0) = {12 13}', - '(7, 0, 0) = {14 15}', - '(8, 0, 0) = {16 17}', - '(9, 0, 0) = {18 19}', - '(10, 0, 0) = {20 21}', - '(11, 0, 0) = {22 23}']) - - def test_dump_long3(self): - self.try_command('language renderscript allocation dump 17', - ['(0, 0, 0) = {0 1 2}', - '(1, 0, 0) = {4 5 6}', - '(2, 0, 0) = {8 9 10}', - '(3, 0, 0) = {12 13 14}', - '(4, 0, 0) = {16 17 18}', - '(5, 0, 0) = {20 21 22}']) - - def test_dump_long4(self): - self.try_command('language renderscript allocation dump 18', - ['(0, 0, 0) = {0 1 2 3}', - '(0, 1, 0) = {4 5 6 7}', - '(0, 2, 0) = {8 9 10 11}', - '(0, 3, 0) = {12 13 14 15}', - '(0, 4, 0) = {16 17 18 19}', - '(0, 5, 0) = {20 21 22 23}']) - - def test_dump_bool(self): - self.try_command('language renderscript allocation dump 19', - ['(0, 0, 0) = false', - '(1, 0, 0) = true', - '(2, 0, 0) = false', - '(3, 0, 0) = true', - '(4, 0, 0) = false', - '(5, 0, 0) = true', - '(6, 0, 0) = false', - '(7, 0, 0) = true', - '(8, 0, 0) = false', - '(9, 0, 0) = true', - '(10, 0, 0) = false', - '(11, 0, 0) = true', - '(12, 0, 0) = false', - '(13, 0, 0) = true', - '(14, 0, 0) = false', - '(15, 0, 0) = true', - '(16, 0, 0) = false', - '(17, 0, 0) = true', - '(18, 0, 0) = false', - '(19, 0, 0) = true', - '(20, 0, 0) = false', - '(21, 0, 0) = true', - '(22, 0, 0) = false', - '(23, 0, 0) = true']) - - @ordered_test('last') - @cpp_only_test() - def test_cpp_cleanup_breakpoints(self): - self.try_command('breakpoint delete 1', ['1 breakpoints deleted']) - - self.try_command('breakpoint delete 2', ['1 breakpoints deleted']) - - self.try_command('breakpoint delete 3', ['1 breakpoints deleted']) - - self.try_command('process continue', ['exited with status = 0']) diff --git a/tests/lldb/tests/testcases/test_allocation_dump_2.py b/tests/lldb/tests/testcases/test_allocation_dump_2.py deleted file mode 100644 index 13123ec1..00000000 --- a/tests/lldb/tests/testcases/test_allocation_dump_2.py +++ /dev/null @@ -1,604 +0,0 @@ -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -'''Module that contains the test TestAllocationDump2''' - -from __future__ import absolute_import - -from harness.test_base_remote import TestBaseRemote -from harness.decorators import ( - wimpy, - ordered_test -) - - -class TestAllocationDump2(TestBaseRemote): - '''Tests printing the contents of allocations.''' - - bundle_target = { - 'java': 'Allocations' - } - - @wimpy - @ordered_test(0) - def test_allocation_dump1(self): - # pylint: disable=line-too-long - self.try_command('language renderscript kernel breakpoint all enable', - ['Breakpoints will be set on all kernels']) - - self.try_command('process continue', - ['resuming', - 'stopped', - 'stop reason = breakpoint']) - - self.try_command('breakpoint del 1', - ['1 breakpoints deleted']) - - # Hit second kernel - self.try_command('process continue', - ['resuming', - 'stopped', - 'stop reason = breakpoint']) - - # uchar - self.try_command('language renderscript allocation dump 20', - ['(0, 0, 0) = 0', - '(1, 0, 0) = 1', - '(2, 0, 0) = 2', - '(3, 0, 0) = 3', - '(4, 0, 0) = 4', - '(5, 0, 0) = 5', - '(6, 0, 0) = 6', - '(7, 0, 0) = 7', - '(8, 0, 0) = 8', - '(9, 0, 0) = 9', - '(10, 0, 0) = 10', - '(11, 0, 0) = 11', - '(12, 0, 0) = 12', - '(13, 0, 0) = 13', - '(14, 0, 0) = 14', - '(15, 0, 0) = 15', - '(16, 0, 0) = 16', - '(17, 0, 0) = 17', - '(18, 0, 0) = 18', - '(19, 0, 0) = 19', - '(20, 0, 0) = 20', - '(21, 0, 0) = 21', - '(22, 0, 0) = 22', - '(23, 0, 0) = 23']) - - @ordered_test(1) - def test_allocation_dump_unsigned_types(self): - # uchar2 - self.try_command('language renderscript allocation dump 21', - ['(0, 0, 0) = {0x00 0x01}', - '(1, 0, 0) = {0x02 0x03}', - '(0, 1, 0) = {0x04 0x05}', - '(1, 1, 0) = {0x06 0x07}', - '(0, 2, 0) = {0x08 0x09}', - '(1, 2, 0) = {0x0a 0x0b}', - '(0, 3, 0) = {0x0c 0x0d}', - '(1, 3, 0) = {0x0e 0x0f}', - '(0, 4, 0) = {0x10 0x11}', - '(1, 4, 0) = {0x12 0x13}', - '(0, 5, 0) = {0x14 0x15}', - '(1, 5, 0) = {0x16 0x17}']) - - # uchar3 - self.try_command('language renderscript allocation dump 22', - ['(0, 0, 0) = {0x00 0x01 0x02}', - '(1, 0, 0) = {0x04 0x05 0x06}', - '(2, 0, 0) = {0x08 0x09 0x0a}', - '(3, 0, 0) = {0x0c 0x0d 0x0e}', - '(4, 0, 0) = {0x10 0x11 0x12}', - '(5, 0, 0) = {0x14 0x15 0x16}']) - - # uchar4 - self.try_command('language renderscript allocation dump 23', - ['(0, 0, 0) = {0x00 0x01 0x02 0x03}', - '(1, 0, 0) = {0x04 0x05 0x06 0x07}', - '(2, 0, 0) = {0x08 0x09 0x0a 0x0b}', - '(3, 0, 0) = {0x0c 0x0d 0x0e 0x0f}', - '(4, 0, 0) = {0x10 0x11 0x12 0x13}', - '(5, 0, 0) = {0x14 0x15 0x16 0x17}']) - - # ushort - self.try_command('language renderscript allocation dump 24', - ['(0, 0, 0) = 0', - '(1, 0, 0) = 1', - '(2, 0, 0) = 2', - '(3, 0, 0) = 3', - '(4, 0, 0) = 4', - '(5, 0, 0) = 5', - '(6, 0, 0) = 6', - '(7, 0, 0) = 7', - '(8, 0, 0) = 8', - '(9, 0, 0) = 9', - '(10, 0, 0) = 10', - '(11, 0, 0) = 11', - '(12, 0, 0) = 12', - '(13, 0, 0) = 13', - '(14, 0, 0) = 14', - '(15, 0, 0) = 15', - '(16, 0, 0) = 16', - '(17, 0, 0) = 17', - '(18, 0, 0) = 18', - '(19, 0, 0) = 19', - '(20, 0, 0) = 20', - '(21, 0, 0) = 21', - '(22, 0, 0) = 22', - '(23, 0, 0) = 23']) - - # ushort2 - self.try_command('language renderscript allocation dump 25', - ['(0, 0, 0) = {0x0000 0x0001}', - '(1, 0, 0) = {0x0002 0x0003}', - '(2, 0, 0) = {0x0004 0x0005}', - '(3, 0, 0) = {0x0006 0x0007}', - '(4, 0, 0) = {0x0008 0x0009}', - '(5, 0, 0) = {0x000a 0x000b}', - '(6, 0, 0) = {0x000c 0x000d}', - '(7, 0, 0) = {0x000e 0x000f}', - '(8, 0, 0) = {0x0010 0x0011}', - '(9, 0, 0) = {0x0012 0x0013}', - '(10, 0, 0) = {0x0014 0x0015}', - '(11, 0, 0) = {0x0016 0x0017}']) - - # ushort3 - self.try_command('language renderscript allocation dump 26', - ['(0, 0, 0) = {0x0000 0x0001 0x0002}', - '(0, 1, 0) = {0x0004 0x0005 0x0006}', - '(0, 2, 0) = {0x0008 0x0009 0x000a}', - '(0, 3, 0) = {0x000c 0x000d 0x000e}', - '(0, 4, 0) = {0x0010 0x0011 0x0012}', - '(0, 5, 0) = {0x0014 0x0015 0x0016}']) - - # ushort4 - self.try_command('language renderscript allocation dump 27', - ['(0, 0, 0) = {0x0000 0x0001 0x0002 0x0003}', - '(1, 0, 0) = {0x0004 0x0005 0x0006 0x0007}', - '(2, 0, 0) = {0x0008 0x0009 0x000a 0x000b}', - '(3, 0, 0) = {0x000c 0x000d 0x000e 0x000f}', - '(4, 0, 0) = {0x0010 0x0011 0x0012 0x0013}', - '(5, 0, 0) = {0x0014 0x0015 0x0016 0x0017}']) - - # uint - self.try_command('language renderscript allocation dump 28', - ['(0, 0, 0) = 0', - '(1, 0, 0) = 1', - '(2, 0, 0) = 2', - '(3, 0, 0) = 3', - '(4, 0, 0) = 4', - '(5, 0, 0) = 5', - '(6, 0, 0) = 6', - '(7, 0, 0) = 7', - '(8, 0, 0) = 8', - '(9, 0, 0) = 9', - '(10, 0, 0) = 10', - '(11, 0, 0) = 11', - '(12, 0, 0) = 12', - '(13, 0, 0) = 13', - '(14, 0, 0) = 14', - '(15, 0, 0) = 15', - '(16, 0, 0) = 16', - '(17, 0, 0) = 17', - '(18, 0, 0) = 18', - '(19, 0, 0) = 19', - '(20, 0, 0) = 20', - '(21, 0, 0) = 21', - '(22, 0, 0) = 22', - '(23, 0, 0) = 23']) - - # uint2 - self.try_command('language renderscript allocation dump 29', - ['(0, 0, 0) = {0x00000000 0x00000001}', - '(1, 0, 0) = {0x00000002 0x00000003}', - '(2, 0, 0) = {0x00000004 0x00000005}', - '(3, 0, 0) = {0x00000006 0x00000007}', - '(4, 0, 0) = {0x00000008 0x00000009}', - '(5, 0, 0) = {0x0000000a 0x0000000b}', - '(6, 0, 0) = {0x0000000c 0x0000000d}', - '(7, 0, 0) = {0x0000000e 0x0000000f}', - '(8, 0, 0) = {0x00000010 0x00000011}', - '(9, 0, 0) = {0x00000012 0x00000013}', - '(10, 0, 0) = {0x00000014 0x00000015}', - '(11, 0, 0) = {0x00000016 0x00000017}']) - - # uint3 - self.try_command('language renderscript allocation dump 30', - ['(0, 0, 0) = {0x00000000 0x00000001 0x00000002}', - '(1, 0, 0) = {0x00000004 0x00000005 0x00000006}', - '(2, 0, 0) = {0x00000008 0x00000009 0x0000000a}', - '(3, 0, 0) = {0x0000000c 0x0000000d 0x0000000e}', - '(4, 0, 0) = {0x00000010 0x00000011 0x00000012}', - '(5, 0, 0) = {0x00000014 0x00000015 0x00000016}']) - - # uint4 - self.try_command('language renderscript allocation dump 31', - ['(0, 0, 0) = {0x00000000 0x00000001 0x00000002 0x00000003}', - '(0, 0, 1) = {0x00000004 0x00000005 0x00000006 0x00000007}', - '(0, 0, 2) = {0x00000008 0x00000009 0x0000000a 0x0000000b}', - '(0, 0, 3) = {0x0000000c 0x0000000d 0x0000000e 0x0000000f}', - '(0, 0, 4) = {0x00000010 0x00000011 0x00000012 0x00000013}', - '(0, 0, 5) = {0x00000014 0x00000015 0x00000016 0x00000017}']) - - # ulong - self.try_command('language renderscript allocation dump 32', - ['(0, 0, 0) = 0', - '(1, 0, 0) = 1', - '(2, 0, 0) = 2', - '(3, 0, 0) = 3', - '(0, 1, 0) = 4', - '(1, 1, 0) = 5', - '(2, 1, 0) = 6', - '(3, 1, 0) = 7', - '(0, 2, 0) = 8', - '(1, 2, 0) = 9', - '(2, 2, 0) = 10', - '(3, 2, 0) = 11', - '(0, 0, 1) = 12', - '(1, 0, 1) = 13', - '(2, 0, 1) = 14', - '(3, 0, 1) = 15', - '(0, 1, 1) = 16', - '(1, 1, 1) = 17', - '(2, 1, 1) = 18', - '(3, 1, 1) = 19', - '(0, 2, 1) = 20', - '(1, 2, 1) = 21', - '(2, 2, 1) = 22', - '(3, 2, 1) = 23']) - - # ulong2 - self.try_command('language renderscript allocation dump 33', - ['(0, 0, 0) = {0x0000000000000000 0x0000000000000001}', - '(1, 0, 0) = {0x0000000000000002 0x0000000000000003}', - '(2, 0, 0) = {0x0000000000000004 0x0000000000000005}', - '(3, 0, 0) = {0x0000000000000006 0x0000000000000007}', - '(4, 0, 0) = {0x0000000000000008 0x0000000000000009}', - '(5, 0, 0) = {0x000000000000000a 0x000000000000000b}', - '(6, 0, 0) = {0x000000000000000c 0x000000000000000d}', - '(7, 0, 0) = {0x000000000000000e 0x000000000000000f}', - '(8, 0, 0) = {0x0000000000000010 0x0000000000000011}', - '(9, 0, 0) = {0x0000000000000012 0x0000000000000013}', - '(10, 0, 0) = {0x0000000000000014 0x0000000000000015}', - '(11, 0, 0) = {0x0000000000000016 0x0000000000000017}']) - - # ulong3 - self.try_command('language renderscript allocation dump 34', - ['(0, 0, 0) = {0x0000000000000000 0x0000000000000001 0x0000000000000002}', - '(1, 0, 0) = {0x0000000000000004 0x0000000000000005 0x0000000000000006}', - '(2, 0, 0) = {0x0000000000000008 0x0000000000000009 0x000000000000000a}', - '(3, 0, 0) = {0x000000000000000c 0x000000000000000d 0x000000000000000e}', - '(4, 0, 0) = {0x0000000000000010 0x0000000000000011 0x0000000000000012}', - '(5, 0, 0) = {0x0000000000000014 0x0000000000000015 0x0000000000000016}']) - - # ulong4 - self.try_command('language renderscript allocation dump 35', - ['(0, 0, 0) = {0x0000000000000000 0x0000000000000001 ' - '0x0000000000000002 0x0000000000000003}', - '(1, 0, 0) = {0x0000000000000004 0x0000000000000005 ' - '0x0000000000000006 0x0000000000000007}', - '(2, 0, 0) = {0x0000000000000008 0x0000000000000009 ' - '0x000000000000000a 0x000000000000000b}', - '(3, 0, 0) = {0x000000000000000c 0x000000000000000d ' - '0x000000000000000e 0x000000000000000f}', - '(4, 0, 0) = {0x0000000000000010 0x0000000000000011 ' - '0x0000000000000012 0x0000000000000013}', - '(5, 0, 0) = {0x0000000000000014 0x0000000000000015 ' - '0x0000000000000016 0x0000000000000017}']) - - @wimpy - @ordered_test(3) - def test_dump_square_kernel(self): - self.try_command('breakpoint del 2', - ['1 breakpoints deleted']) - - # Hit third kernel - self.try_command('process continue', - ['resuming', - 'stopped', - 'stop reason = breakpoint']) - - # Test that uint allocation has been squared by square_kernel - self.try_command('language renderscript allocation dump 28', - ['(0, 0, 0) = 0', - '(1, 0, 0) = 1', - '(2, 0, 0) = 4', - '(3, 0, 0) = 9', - '(4, 0, 0) = 16', - '(5, 0, 0) = 25', - '(6, 0, 0) = 36', - '(7, 0, 0) = 49', - '(8, 0, 0) = 64', - '(9, 0, 0) = 81', - '(10, 0, 0) = 100', - '(11, 0, 0) = 121', - '(12, 0, 0) = 144', - '(13, 0, 0) = 169', - '(14, 0, 0) = 196', - '(15, 0, 0) = 225', - '(16, 0, 0) = 256', - '(17, 0, 0) = 289', - '(18, 0, 0) = 324', - '(19, 0, 0) = 361', - '(20, 0, 0) = 400', - '(21, 0, 0) = 441', - '(22, 0, 0) = 484', - '(23, 0, 0) = 529']) - - @ordered_test(4) - def test_alloction_dump_floating_types(self): - # half - self.try_command('language renderscript allocation dump 36', - ['(0, 0, 0) = 1', - '(1, 0, 0) = 1.00098', - '(2, 0, 0) = 1.00195', - '(3, 0, 0) = 1.00293', - '(4, 0, 0) = 1.00391', - '(5, 0, 0) = 1.00488', - '(6, 0, 0) = 1.00586', - '(7, 0, 0) = 1.00684', - '(8, 0, 0) = 1.00781', - '(9, 0, 0) = 1.00879', - '(10, 0, 0) = 1.00977', - '(11, 0, 0) = 1.01074', - '(12, 0, 0) = 1.01172', - '(13, 0, 0) = 1.0127', - '(14, 0, 0) = 1.01367', - '(15, 0, 0) = 1.01465', - '(16, 0, 0) = 1.0156', - '(17, 0, 0) = 1.0166', - '(18, 0, 0) = 1.01758', - '(19, 0, 0) = 1.01855', - '(20, 0, 0) = 1.01953', - '(21, 0, 0) = 1.02051', - '(22, 0, 0) = 1.02148', - '(23, 0, 0) = 1.02246']) - - # half2 - self.try_command('language renderscript allocation dump 37', - ['(0, 0, 0) = {1 1.00098}', - '(1, 0, 0) = {1.00195 1.00293}', - '(2, 0, 0) = {1.00391 1.00488}', - '(3, 0, 0) = {1.00586 1.00684}', - '(4, 0, 0) = {1.00781 1.00879}', - '(5, 0, 0) = {1.00977 1.01074}', - '(6, 0, 0) = {1.01172 1.0127}', - '(7, 0, 0) = {1.01367 1.01465}', - '(9, 0, 0) = {1.01758 1.01855}', - '(10, 0, 0) = {1.01953 1.02051}', - '(11, 0, 0) = {1.02148 1.02246}'], - [r'\(8, 0, 0\) = \{1\.0156[23] 1\.0166\}']) - - # half3 - self.try_command('language renderscript allocation dump 38', - ['(0, 0, 0) = {1 1.00098 1.00195}', - '(0, 1, 0) = {1.00391 1.00488 1.00586}', - '(0, 2, 0) = {1.00781 1.00879 1.00977}', - '(0, 3, 0) = {1.01172 1.0127 1.01367}', - '(0, 5, 0) = {1.01953 1.02051 1.02148}'], - [r'\(0, 4, 0\) = \{1\.0156[23] 1\.0166 1\.01758\}']) - - # half4 - self.try_command('language renderscript allocation dump 39', - ['(0, 0, 0) = {1 1.00098 1.00195 1.00293}', - '(1, 0, 0) = {1.00391 1.00488 1.00586 1.00684}', - '(2, 0, 0) = {1.00781 1.00879 1.00977 1.01074}', - '(3, 0, 0) = {1.01172 1.0127 1.01367 1.01465}', - '(5, 0, 0) = {1.01953 1.02051 1.02148 1.02246}'], - [r'\(4, 0, 0\) = \{1\.0156[23] 1\.0166 1\.01758 1\.01855\}']) - - # float - self.try_command('language renderscript allocation dump 40', - ['(0, 0, 0) = inf', - '(1, 0, 0) = 1', - '(2, 0, 0) = 0.5', - '(3, 0, 0) = 0.333333', - '(4, 0, 0) = 0.25', - '(5, 0, 0) = 0.2', - '(6, 0, 0) = 0.166667', - '(7, 0, 0) = 0.142857', - '(8, 0, 0) = 0.125', - '(9, 0, 0) = 0.111111', - '(10, 0, 0) = 0.1', - '(11, 0, 0) = 0.0909091', - '(12, 0, 0) = 0.0833333', - '(13, 0, 0) = 0.0769231', - '(14, 0, 0) = 0.0714286', - '(15, 0, 0) = 0.0666667', - '(16, 0, 0) = 0.0625', - '(17, 0, 0) = 0.0588235', - '(18, 0, 0) = 0.0555556', - '(19, 0, 0) = 0.0526316', - '(20, 0, 0) = 0.05', - '(21, 0, 0) = 0.047619', - '(22, 0, 0) = 0.0454545', - '(23, 0, 0) = 0.0434783']) - - # float2 - self.try_command('language renderscript allocation dump 41', - ['(0, 0, 0) = {inf 1}', - '(1, 0, 0) = {0.5 0.333333}', - '(2, 0, 0) = {0.25 0.2}', - '(3, 0, 0) = {0.166667 0.142857}', - '(4, 0, 0) = {0.125 0.111111}', - '(5, 0, 0) = {0.1 0.0909091}', - '(6, 0, 0) = {0.0833333 0.0769231}', - '(7, 0, 0) = {0.0714286 0.0666667}', - '(8, 0, 0) = {0.0625 0.0588235}', - '(9, 0, 0) = {0.0555556 0.0526316}', - '(10, 0, 0) = {0.05 0.047619}', - '(11, 0, 0) = {0.0454545 0.0434783}']) - - # float3 - self.try_command('language renderscript allocation dump 42', - ['(0, 0, 0) = {inf 1 0.5}', - '(1, 0, 0) = {0.25 0.2 0.166667}', - '(2, 0, 0) = {0.125 0.111111 0.1}', - '(3, 0, 0) = {0.0833333 0.0769231 0.0714286}', - '(4, 0, 0) = {0.0625 0.0588235 0.0555556}', - '(5, 0, 0) = {0.05 0.047619 0.0454545}']) - - # float4 - self.try_command('language renderscript allocation dump 43', - ['(0, 0, 0) = {inf 1 0.5 0.333333}', - '(1, 0, 0) = {0.25 0.2 0.166667 0.142857}', - '(2, 0, 0) = {0.125 0.111111 0.1 0.0909091}', - '(0, 1, 0) = {0.0833333 0.0769231 0.0714286 0.0666667}', - '(1, 1, 0) = {0.0625 0.0588235 0.0555556 0.0526316}', - '(2, 1, 0) = {0.05 0.047619 0.0454545 0.0434783}']) - - # double - self.try_command('language renderscript allocation dump 44', - ['(0, 0, 0) = inf', - '(1, 0, 0) = 1', - '(2, 0, 0) = 0.5', - '(3, 0, 0) = 0.333333333333333', - '(4, 0, 0) = 0.25', - '(5, 0, 0) = 0.2', - '(6, 0, 0) = 0.166666666666667', - '(7, 0, 0) = 0.142857142857143', - '(8, 0, 0) = 0.125', - '(9, 0, 0) = 0.111111111111111', - '(10, 0, 0) = 0.1', - '(11, 0, 0) = 0.0909090909090909', - '(12, 0, 0) = 0.0833333333333333', - '(13, 0, 0) = 0.0769230769230769', - '(14, 0, 0) = 0.0714285714285714', - '(15, 0, 0) = 0.0666666666666667', - '(16, 0, 0) = 0.0625', - '(17, 0, 0) = 0.0588235294117647', - '(18, 0, 0) = 0.0555555555555556', - '(19, 0, 0) = 0.0526315789473684', - '(20, 0, 0) = 0.05', - '(21, 0, 0) = 0.0476190476190476', - '(22, 0, 0) = 0.0454545454545455', - '(23, 0, 0) = 0.0434782608695652']) - - # double2 - self.try_command('language renderscript allocation dump 45', - ['(0, 0, 0) = {inf 1}', - '(1, 0, 0) = {0.5 0.333333333333333}', - '(2, 0, 0) = {0.25 0.2}', - '(3, 0, 0) = {0.166666666666667 0.142857142857143}', - '(0, 0, 1) = {0.125 0.111111111111111}', - '(1, 0, 1) = {0.1 0.0909090909090909}', - '(2, 0, 1) = {0.0833333333333333 0.0769230769230769}', - '(3, 0, 1) = {0.0714285714285714 0.0666666666666667}', - '(0, 0, 2) = {0.0625 0.0588235294117647}', - '(1, 0, 2) = {0.0555555555555556 0.0526315789473684}', - '(2, 0, 2) = {0.05 0.0476190476190476}', - '(3, 0, 2) = {0.0454545454545455 0.0434782608695652}']) - - # double3 - self.try_command('language renderscript allocation dump 46', - ['(0, 0, 0) = {inf 1 0.5}', - '(0, 1, 0) = {0.25 0.2 0.166666666666667}', - '(0, 0, 1) = {0.125 0.111111111111111 0.1}', - '(0, 1, 1) = {0.0833333333333333 0.0769230769230769 ' - '0.0714285714285714}', - '(0, 0, 2) = {0.0625 0.0588235294117647 0.0555555555555556}', - '(0, 1, 2) = {0.05 0.0476190476190476 0.0454545454545455}']) - - # double4 - self.try_command('language renderscript allocation dump 47', - ['(0, 0, 0) = {inf 1 0.5 0.333333333333333}', - '(0, 1, 0) = {0.25 0.2 0.166666666666667 0.142857142857143}', - '(0, 0, 1) = {0.125 0.111111111111111 0.1 0.0909090909090909}', - '(0, 1, 1) = {0.0833333333333333 0.0769230769230769 ' - '0.0714285714285714 0.0666666666666667}', - '(0, 0, 2) = {0.0625 0.0588235294117647 ' - '0.0555555555555556 0.0526315789473684}', - '(0, 1, 2) = {0.05 0.0476190476190476 ' - '0.0454545454545455 0.0434782608695652}']) - - @wimpy - @ordered_test(5) - def test_allocation_dump_half_kernel(self): - # Delete kernel breakpoint on add_half_kernel - self.try_command('breakpoint del 3', - ['1 breakpoints deleted']) - - # Hit struct_kernel - self.try_command('process continue', - ['resuming', - 'stopped', - 'stop reason = breakpoint']) - - # Double 3 has been modified by add_half_kernel - self.try_command('language renderscript allocation dump 46', - ['(0, 0, 0) = {inf 1.5 1}', - '(0, 1, 0) = {0.75 0.7 0.666666666666667}', - '(0, 0, 1) = {0.625 0.611111111111111 0.6}', - '(0, 1, 1) = {0.583333333333333 0.576923076923077 0.571428571428571}', - '(0, 0, 2) = {0.5625 0.558823529411765 0.555555555555556}', - '(0, 1, 2) = {0.55 0.547619047619048 0.545454545454545}']) - - # Floating point allocation data should have been overwritten - self.try_command('language renderscript allocation dump 40', - ['(0, 0, 0) = -inf', - '(1, 0, 0) = -1', - '(2, 0, 0) = -0.5', - '(3, 0, 0) = -0.333333', - '(4, 0, 0) = -0.25', - '(5, 0, 0) = -0.2', - '(6, 0, 0) = -0.166667', - '(7, 0, 0) = -0.142857', - '(8, 0, 0) = -0.125', - '(9, 0, 0) = -0.111111', - '(10, 0, 0) = -0.1', - '(11, 0, 0) = -0.0909091', - '(12, 0, 0) = -0.0833333', - '(13, 0, 0) = -0.0769231', - '(14, 0, 0) = -0.0714286', - '(15, 0, 0) = -0.0666667', - '(16, 0, 0) = -0.0625', - '(17, 0, 0) = -0.0588235', - '(18, 0, 0) = -0.0555556', - '(19, 0, 0) = -0.0526316', - '(20, 0, 0) = -0.05', - '(21, 0, 0) = -0.047619', - '(22, 0, 0) = -0.0454545', - '(23, 0, 0) = -0.0434783']) - - self.try_command('language renderscript allocation dump 41', - ['(0, 0, 0) = {-inf -1}', - '(1, 0, 0) = {-0.5 -0.333333}', - '(2, 0, 0) = {-0.25 -0.2}', - '(3, 0, 0) = {-0.166667 -0.142857}', - '(4, 0, 0) = {-0.125 -0.111111}', - '(5, 0, 0) = {-0.1 -0.0909091}', - '(6, 0, 0) = {-0.0833333 -0.0769231}', - '(7, 0, 0) = {-0.0714286 -0.0666667}', - '(8, 0, 0) = {-0.0625 -0.0588235}', - '(9, 0, 0) = {-0.0555556 -0.0526316}', - '(10, 0, 0) = {-0.05 -0.047619}', - '(11, 0, 0) = {-0.0454545 -0.0434783}']) - - self.try_command('language renderscript allocation dump 42', - ['(0, 0, 0) = {-inf -1 -0.5}', - '(1, 0, 0) = {-0.25 -0.2 -0.166667}', - '(2, 0, 0) = {-0.125 -0.111111 -0.1}', - '(3, 0, 0) = {-0.0833333 -0.0769231 -0.0714286}', - '(4, 0, 0) = {-0.0625 -0.0588235 -0.0555556}', - '(5, 0, 0) = {-0.05 -0.047619 -0.0454545}']) - - self.try_command('language renderscript allocation dump 43', - ['(0, 0, 0) = {-inf -1 -0.5 -0.333333}', - '(1, 0, 0) = {-0.25 -0.2 -0.166667 -0.142857}', - '(2, 0, 0) = {-0.125 -0.111111 -0.1 -0.0909091}', - '(0, 1, 0) = {-0.0833333 -0.0769231 -0.0714286 -0.0666667}', - '(1, 1, 0) = {-0.0625 -0.0588235 -0.0555556 -0.0526316}', - '(2, 1, 0) = {-0.05 -0.047619 -0.0454545 -0.0434783}']) diff --git a/tests/lldb/tests/testcases/test_allocation_dump_2_cpp.py b/tests/lldb/tests/testcases/test_allocation_dump_2_cpp.py deleted file mode 100644 index b103ccbb..00000000 --- a/tests/lldb/tests/testcases/test_allocation_dump_2_cpp.py +++ /dev/null @@ -1,525 +0,0 @@ -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -'''Module that contains the test TestAllocationDump2Cpp.''' - -from __future__ import absolute_import - -from harness.test_base_remote import TestBaseRemote - - -class TestAllocationDump2Cpp(TestBaseRemote): - '''Tests printing the contents of allocations in an NDK app.''' - - bundle_target = { - 'cpp': 'CppAllocations' - } - - def test_case(self): - '''Run the lldb commands that are being tested. - - Raises: - TestFail: One of the lldb commands did not provide the expected - output. - ''' - # pylint: disable=line-too-long - self.try_command('language renderscript kernel breakpoint all enable', - ['Breakpoints will be set on all kernels']) - - self.try_command('process continue', - ['resuming', - 'stopped', - 'stop reason = breakpoint']) - - self.try_command('breakpoint del 1', - ['1 breakpoints deleted']) - - # Hit second kernel - self.try_command('process continue', - ['resuming', - 'stopped', - 'stop reason = breakpoint']) - - # uchar - self.try_command('language renderscript allocation dump 20', - ['(0, 0, 0) = 0', - '(1, 0, 0) = 1', - '(2, 0, 0) = 2', - '(3, 0, 0) = 3', - '(4, 0, 0) = 4', - '(5, 0, 0) = 5', - '(6, 0, 0) = 6', - '(7, 0, 0) = 7', - '(8, 0, 0) = 8', - '(9, 0, 0) = 9', - '(10, 0, 0) = 10', - '(11, 0, 0) = 11', - '(12, 0, 0) = 12', - '(13, 0, 0) = 13', - '(14, 0, 0) = 14', - '(15, 0, 0) = 15', - '(16, 0, 0) = 16', - '(17, 0, 0) = 17', - '(18, 0, 0) = 18', - '(19, 0, 0) = 19', - '(20, 0, 0) = 20', - '(21, 0, 0) = 21', - '(22, 0, 0) = 22', - '(23, 0, 0) = 23']) - - # uchar2 - self.try_command('language renderscript allocation dump 21', - ['(0, 0, 0) = {0x00 0x01}', - '(1, 0, 0) = {0x02 0x03}', - '(0, 1, 0) = {0x04 0x05}', - '(1, 1, 0) = {0x06 0x07}', - '(0, 2, 0) = {0x08 0x09}', - '(1, 2, 0) = {0x0a 0x0b}', - '(0, 3, 0) = {0x0c 0x0d}', - '(1, 3, 0) = {0x0e 0x0f}', - '(0, 4, 0) = {0x10 0x11}', - '(1, 4, 0) = {0x12 0x13}', - '(0, 5, 0) = {0x14 0x15}', - '(1, 5, 0) = {0x16 0x17}']) - - # uchar3 - self.try_command('language renderscript allocation dump 22', - ['(0, 0, 0) = {0x00 0x01 0x02}', - '(1, 0, 0) = {0x04 0x05 0x06}', - '(2, 0, 0) = {0x08 0x09 0x0a}', - '(3, 0, 0) = {0x0c 0x0d 0x0e}', - '(4, 0, 0) = {0x10 0x11 0x12}', - '(5, 0, 0) = {0x14 0x15 0x16}']) - - # uchar4 - self.try_command('language renderscript allocation dump 23', - ['(0, 0, 0) = {0x00 0x01 0x02 0x03}', - '(1, 0, 0) = {0x04 0x05 0x06 0x07}', - '(2, 0, 0) = {0x08 0x09 0x0a 0x0b}', - '(3, 0, 0) = {0x0c 0x0d 0x0e 0x0f}', - '(4, 0, 0) = {0x10 0x11 0x12 0x13}', - '(5, 0, 0) = {0x14 0x15 0x16 0x17}']) - - # ushort - self.try_command('language renderscript allocation dump 24', - ['(0, 0, 0) = 0', - '(1, 0, 0) = 1', - '(2, 0, 0) = 2', - '(3, 0, 0) = 3', - '(4, 0, 0) = 4', - '(5, 0, 0) = 5', - '(6, 0, 0) = 6', - '(7, 0, 0) = 7', - '(8, 0, 0) = 8', - '(9, 0, 0) = 9', - '(10, 0, 0) = 10', - '(11, 0, 0) = 11', - '(12, 0, 0) = 12', - '(13, 0, 0) = 13', - '(14, 0, 0) = 14', - '(15, 0, 0) = 15', - '(16, 0, 0) = 16', - '(17, 0, 0) = 17', - '(18, 0, 0) = 18', - '(19, 0, 0) = 19', - '(20, 0, 0) = 20', - '(21, 0, 0) = 21', - '(22, 0, 0) = 22', - '(23, 0, 0) = 23']) - - # ushort2 - self.try_command('language renderscript allocation dump 25', - ['(0, 0, 0) = {0x0000 0x0001}', - '(1, 0, 0) = {0x0002 0x0003}', - '(2, 0, 0) = {0x0004 0x0005}', - '(3, 0, 0) = {0x0006 0x0007}', - '(4, 0, 0) = {0x0008 0x0009}', - '(5, 0, 0) = {0x000a 0x000b}', - '(6, 0, 0) = {0x000c 0x000d}', - '(7, 0, 0) = {0x000e 0x000f}', - '(8, 0, 0) = {0x0010 0x0011}', - '(9, 0, 0) = {0x0012 0x0013}', - '(10, 0, 0) = {0x0014 0x0015}', - '(11, 0, 0) = {0x0016 0x0017}']) - - # ushort3 - self.try_command('language renderscript allocation dump 26', - ['(0, 0, 0) = {0x0000 0x0001 0x0002}', - '(0, 1, 0) = {0x0004 0x0005 0x0006}', - '(0, 2, 0) = {0x0008 0x0009 0x000a}', - '(0, 3, 0) = {0x000c 0x000d 0x000e}', - '(0, 4, 0) = {0x0010 0x0011 0x0012}', - '(0, 5, 0) = {0x0014 0x0015 0x0016}']) - - # ushort4 - self.try_command('language renderscript allocation dump 27', - ['(0, 0, 0) = {0x0000 0x0001 0x0002 0x0003}', - '(1, 0, 0) = {0x0004 0x0005 0x0006 0x0007}', - '(2, 0, 0) = {0x0008 0x0009 0x000a 0x000b}', - '(3, 0, 0) = {0x000c 0x000d 0x000e 0x000f}', - '(4, 0, 0) = {0x0010 0x0011 0x0012 0x0013}', - '(5, 0, 0) = {0x0014 0x0015 0x0016 0x0017}']) - - # uint - self.try_command('language renderscript allocation dump 28', - ['(0, 0, 0) = 0', - '(1, 0, 0) = 1', - '(2, 0, 0) = 2', - '(3, 0, 0) = 3', - '(4, 0, 0) = 4', - '(5, 0, 0) = 5', - '(6, 0, 0) = 6', - '(7, 0, 0) = 7', - '(8, 0, 0) = 8', - '(9, 0, 0) = 9', - '(10, 0, 0) = 10', - '(11, 0, 0) = 11', - '(12, 0, 0) = 12', - '(13, 0, 0) = 13', - '(14, 0, 0) = 14', - '(15, 0, 0) = 15', - '(16, 0, 0) = 16', - '(17, 0, 0) = 17', - '(18, 0, 0) = 18', - '(19, 0, 0) = 19', - '(20, 0, 0) = 20', - '(21, 0, 0) = 21', - '(22, 0, 0) = 22', - '(23, 0, 0) = 23']) - - # uint2 - self.try_command('language renderscript allocation dump 29', - ['(0, 0, 0) = {0x00000000 0x00000001}', - '(1, 0, 0) = {0x00000002 0x00000003}', - '(2, 0, 0) = {0x00000004 0x00000005}', - '(3, 0, 0) = {0x00000006 0x00000007}', - '(4, 0, 0) = {0x00000008 0x00000009}', - '(5, 0, 0) = {0x0000000a 0x0000000b}', - '(6, 0, 0) = {0x0000000c 0x0000000d}', - '(7, 0, 0) = {0x0000000e 0x0000000f}', - '(8, 0, 0) = {0x00000010 0x00000011}', - '(9, 0, 0) = {0x00000012 0x00000013}', - '(10, 0, 0) = {0x00000014 0x00000015}', - '(11, 0, 0) = {0x00000016 0x00000017}']) - - # uint3 - self.try_command('language renderscript allocation dump 30', - ['(0, 0, 0) = {0x00000000 0x00000001 0x00000002}', - '(1, 0, 0) = {0x00000004 0x00000005 0x00000006}', - '(2, 0, 0) = {0x00000008 0x00000009 0x0000000a}', - '(3, 0, 0) = {0x0000000c 0x0000000d 0x0000000e}', - '(4, 0, 0) = {0x00000010 0x00000011 0x00000012}', - '(5, 0, 0) = {0x00000014 0x00000015 0x00000016}']) - - # uint4 - self.try_command('language renderscript allocation dump 31', - ['(0, 0, 0) = {0x00000000 0x00000001 0x00000002 0x00000003}', - '(0, 0, 1) = {0x00000004 0x00000005 0x00000006 0x00000007}', - '(0, 0, 2) = {0x00000008 0x00000009 0x0000000a 0x0000000b}', - '(0, 0, 3) = {0x0000000c 0x0000000d 0x0000000e 0x0000000f}', - '(0, 0, 4) = {0x00000010 0x00000011 0x00000012 0x00000013}', - '(0, 0, 5) = {0x00000014 0x00000015 0x00000016 0x00000017}']) - - # ulong - self.try_command('language renderscript allocation dump 32', - ['(0, 0, 0) = 0', - '(1, 0, 0) = 1', - '(2, 0, 0) = 2', - '(3, 0, 0) = 3', - '(0, 1, 0) = 4', - '(1, 1, 0) = 5', - '(2, 1, 0) = 6', - '(3, 1, 0) = 7', - '(0, 2, 0) = 8', - '(1, 2, 0) = 9', - '(2, 2, 0) = 10', - '(3, 2, 0) = 11', - '(0, 0, 1) = 12', - '(1, 0, 1) = 13', - '(2, 0, 1) = 14', - '(3, 0, 1) = 15', - '(0, 1, 1) = 16', - '(1, 1, 1) = 17', - '(2, 1, 1) = 18', - '(3, 1, 1) = 19', - '(0, 2, 1) = 20', - '(1, 2, 1) = 21', - '(2, 2, 1) = 22', - '(3, 2, 1) = 23']) - - # ulong2 - self.try_command('language renderscript allocation dump 33', - ['(0, 0, 0) = {0x0000000000000000 0x0000000000000001}', - '(1, 0, 0) = {0x0000000000000002 0x0000000000000003}', - '(2, 0, 0) = {0x0000000000000004 0x0000000000000005}', - '(3, 0, 0) = {0x0000000000000006 0x0000000000000007}', - '(4, 0, 0) = {0x0000000000000008 0x0000000000000009}', - '(5, 0, 0) = {0x000000000000000a 0x000000000000000b}', - '(6, 0, 0) = {0x000000000000000c 0x000000000000000d}', - '(7, 0, 0) = {0x000000000000000e 0x000000000000000f}', - '(8, 0, 0) = {0x0000000000000010 0x0000000000000011}', - '(9, 0, 0) = {0x0000000000000012 0x0000000000000013}', - '(10, 0, 0) = {0x0000000000000014 0x0000000000000015}', - '(11, 0, 0) = {0x0000000000000016 0x0000000000000017}']) - - # ulong3 - self.try_command('language renderscript allocation dump 34', - ['(0, 0, 0) = {0x0000000000000000 0x0000000000000001 0x0000000000000002}', - '(1, 0, 0) = {0x0000000000000004 0x0000000000000005 0x0000000000000006}', - '(2, 0, 0) = {0x0000000000000008 0x0000000000000009 0x000000000000000a}', - '(3, 0, 0) = {0x000000000000000c 0x000000000000000d 0x000000000000000e}', - '(4, 0, 0) = {0x0000000000000010 0x0000000000000011 0x0000000000000012}', - '(5, 0, 0) = {0x0000000000000014 0x0000000000000015 0x0000000000000016}']) - - # ulong4 - self.try_command('language renderscript allocation dump 35', - ['(0, 0, 0) = {0x0000000000000000 0x0000000000000001 ' - '0x0000000000000002 0x0000000000000003}', - '(1, 0, 0) = {0x0000000000000004 0x0000000000000005 ' - '0x0000000000000006 0x0000000000000007}', - '(2, 0, 0) = {0x0000000000000008 0x0000000000000009 ' - '0x000000000000000a 0x000000000000000b}', - '(3, 0, 0) = {0x000000000000000c 0x000000000000000d ' - '0x000000000000000e 0x000000000000000f}', - '(4, 0, 0) = {0x0000000000000010 0x0000000000000011 ' - '0x0000000000000012 0x0000000000000013}', - '(5, 0, 0) = {0x0000000000000014 0x0000000000000015 ' - '0x0000000000000016 0x0000000000000017}']) - - self.try_command('breakpoint del 2', - ['1 breakpoints deleted']) - - # Hit third kernel - self.try_command('process continue', - ['resuming', - 'stopped', - 'stop reason = breakpoint']) - - # Test that uint allocation has been squared by square_kernel - self.try_command('language renderscript allocation dump 28', - ['(0, 0, 0) = 0', - '(1, 0, 0) = 1', - '(2, 0, 0) = 4', - '(3, 0, 0) = 9', - '(4, 0, 0) = 16', - '(5, 0, 0) = 25', - '(6, 0, 0) = 36', - '(7, 0, 0) = 49', - '(8, 0, 0) = 64', - '(9, 0, 0) = 81', - '(10, 0, 0) = 100', - '(11, 0, 0) = 121', - '(12, 0, 0) = 144', - '(13, 0, 0) = 169', - '(14, 0, 0) = 196', - '(15, 0, 0) = 225', - '(16, 0, 0) = 256', - '(17, 0, 0) = 289', - '(18, 0, 0) = 324', - '(19, 0, 0) = 361', - '(20, 0, 0) = 400', - '(21, 0, 0) = 441', - '(22, 0, 0) = 484', - '(23, 0, 0) = 529']) - - # half - self.try_command('language renderscript allocation dump 36', - ['(0, 0, 0) = inf', - '(1, 0, 0) = 1', - '(2, 0, 0) = 0.5', - '(3, 0, 0) = 0.333252', - '(4, 0, 0) = 0.25', - '(5, 0, 0) = 0.199951', - '(6, 0, 0) = 0.166626', - '(7, 0, 0) = 0.142822', - '(8, 0, 0) = 0.125', - '(9, 0, 0) = 0.111084', - '(10, 0, 0) = 0.0999756', - '(11, 0, 0) = 0.0908813', - '(12, 0, 0) = 0.083313', - '(13, 0, 0) = 0.0769043', - '(14, 0, 0) = 0.0714111', - '(15, 0, 0) = 0.0666504', - '(16, 0, 0) = 0.0625', - '(17, 0, 0) = 0.0588379', - '(18, 0, 0) = 0.055542', - '(19, 0, 0) = 0.0526428', - '(20, 0, 0) = 0.0499878', - '(21, 0, 0) = 0.0476074', - '(22, 0, 0) = 0.0454407', - '(23, 0, 0) = 0.0434875']) - - # half2 - self.try_command('language renderscript allocation dump 37', - ['(0, 0, 0) = {inf 1}', - '(1, 0, 0) = {0.5 0.333252}', - '(2, 0, 0) = {0.25 0.199951}', - '(3, 0, 0) = {0.166626 0.142822}', - '(4, 0, 0) = {0.125 0.111084}', - '(5, 0, 0) = {0.0999756 0.0908813}', - '(6, 0, 0) = {0.083313 0.0769043}', - '(7, 0, 0) = {0.0714111 0.0666504}', - '(8, 0, 0) = {0.0625 0.0588379}', - '(9, 0, 0) = {0.055542 0.0526428}', - '(10, 0, 0) = {0.0499878 0.0476074}', - '(11, 0, 0) = {0.0454407 0.0434875}']) - - # half3 - self.try_command('language renderscript allocation dump 38', - ['(0, 0, 0) = {inf 1 0.5}', - '(0, 1, 0) = {0.25 0.199951 0.166626}', - '(0, 2, 0) = {0.125 0.111084 0.0999756}', - '(0, 3, 0) = {0.083313 0.0769043 0.0714111}', - '(0, 4, 0) = {0.0625 0.0588379 0.055542}', - '(0, 5, 0) = {0.0499878 0.0476074 0.0454407}']) - - # half4 - self.try_command('language renderscript allocation dump 39', - ['(0, 0, 0) = {inf 1 0.5 0.333252}', - '(1, 0, 0) = {0.25 0.199951 0.166626 0.142822}', - '(2, 0, 0) = {0.125 0.111084 0.0999756 0.0908813}', - '(3, 0, 0) = {0.083313 0.0769043 0.0714111 0.0666504}', - '(4, 0, 0) = {0.0625 0.0588379 0.055542 0.0526428}', - '(5, 0, 0) = {0.0499878 0.0476074 0.0454407 0.0434875}']) - - # float - self.try_command('language renderscript allocation dump 40', - ['(0, 0, 0) = inf', - '(1, 0, 0) = 1', - '(2, 0, 0) = 0.5', - '(3, 0, 0) = 0.333333', - '(4, 0, 0) = 0.25', - '(5, 0, 0) = 0.2', - '(6, 0, 0) = 0.166667', - '(7, 0, 0) = 0.142857', - '(8, 0, 0) = 0.125', - '(9, 0, 0) = 0.111111', - '(10, 0, 0) = 0.1', - '(11, 0, 0) = 0.0909091', - '(12, 0, 0) = 0.0833333', - '(13, 0, 0) = 0.0769231', - '(14, 0, 0) = 0.0714286', - '(15, 0, 0) = 0.0666667', - '(16, 0, 0) = 0.0625', - '(17, 0, 0) = 0.0588235', - '(18, 0, 0) = 0.0555556', - '(19, 0, 0) = 0.0526316', - '(20, 0, 0) = 0.05', - '(21, 0, 0) = 0.047619', - '(22, 0, 0) = 0.0454545', - '(23, 0, 0) = 0.0434783']) - - # float2 - self.try_command('language renderscript allocation dump 41', - ['(0, 0, 0) = {inf 1}', - '(1, 0, 0) = {0.5 0.333333}', - '(2, 0, 0) = {0.25 0.2}', - '(3, 0, 0) = {0.166667 0.142857}', - '(4, 0, 0) = {0.125 0.111111}', - '(5, 0, 0) = {0.1 0.0909091}', - '(6, 0, 0) = {0.0833333 0.0769231}', - '(7, 0, 0) = {0.0714286 0.0666667}', - '(8, 0, 0) = {0.0625 0.0588235}', - '(9, 0, 0) = {0.0555556 0.0526316}', - '(10, 0, 0) = {0.05 0.047619}', - '(11, 0, 0) = {0.0454545 0.0434783}']) - - # float3 - self.try_command('language renderscript allocation dump 42', - ['(0, 0, 0) = {inf 1 0.5}', - '(1, 0, 0) = {0.25 0.2 0.166667}', - '(2, 0, 0) = {0.125 0.111111 0.1}', - '(3, 0, 0) = {0.0833333 0.0769231 0.0714286}', - '(4, 0, 0) = {0.0625 0.0588235 0.0555556}', - '(5, 0, 0) = {0.05 0.047619 0.0454545}']) - - # float4 - self.try_command('language renderscript allocation dump 43', - ['(0, 0, 0) = {inf 1 0.5 0.333333}', - '(1, 0, 0) = {0.25 0.2 0.166667 0.142857}', - '(2, 0, 0) = {0.125 0.111111 0.1 0.0909091}', - '(0, 1, 0) = {0.0833333 0.0769231 0.0714286 0.0666667}', - '(1, 1, 0) = {0.0625 0.0588235 0.0555556 0.0526316}', - '(2, 1, 0) = {0.05 0.047619 0.0454545 0.0434783}']) - - # double - self.try_command('language renderscript allocation dump 44', - ['(0, 0, 0) = inf', - '(1, 0, 0) = 1', - '(2, 0, 0) = 0.5', - '(3, 0, 0) = 0.333333333333333', - '(4, 0, 0) = 0.25', - '(5, 0, 0) = 0.2', - '(6, 0, 0) = 0.166666666666667', - '(7, 0, 0) = 0.142857142857143', - '(8, 0, 0) = 0.125', - '(9, 0, 0) = 0.111111111111111', - '(10, 0, 0) = 0.1', - '(11, 0, 0) = 0.0909090909090909', - '(12, 0, 0) = 0.0833333333333333', - '(13, 0, 0) = 0.0769230769230769', - '(14, 0, 0) = 0.0714285714285714', - '(15, 0, 0) = 0.0666666666666667', - '(16, 0, 0) = 0.0625', - '(17, 0, 0) = 0.0588235294117647', - '(18, 0, 0) = 0.0555555555555556', - '(19, 0, 0) = 0.0526315789473684', - '(20, 0, 0) = 0.05', - '(21, 0, 0) = 0.0476190476190476', - '(22, 0, 0) = 0.0454545454545455', - '(23, 0, 0) = 0.0434782608695652']) - - # double2 - self.try_command('language renderscript allocation dump 45', - ['(0, 0, 0) = {inf 1}', - '(1, 0, 0) = {0.5 0.333333333333333}', - '(2, 0, 0) = {0.25 0.2}', - '(3, 0, 0) = {0.166666666666667 0.142857142857143}', - '(0, 0, 1) = {0.125 0.111111111111111}', - '(1, 0, 1) = {0.1 0.0909090909090909}', - '(2, 0, 1) = {0.0833333333333333 0.0769230769230769}', - '(3, 0, 1) = {0.0714285714285714 0.0666666666666667}', - '(0, 0, 2) = {0.0625 0.0588235294117647}', - '(1, 0, 2) = {0.0555555555555556 0.0526315789473684}', - '(2, 0, 2) = {0.05 0.0476190476190476}', - '(3, 0, 2) = {0.0454545454545455 0.0434782608695652}']) - - # double3 - self.try_command('language renderscript allocation dump 46', - ['(0, 0, 0) = {inf 1 0.5}', - '(0, 1, 0) = {0.25 0.2 0.166666666666667}', - '(0, 0, 1) = {0.125 0.111111111111111 0.1}', - '(0, 1, 1) = {0.0833333333333333 0.0769230769230769 ' - '0.0714285714285714}', - '(0, 0, 2) = {0.0625 0.0588235294117647 0.0555555555555556}', - '(0, 1, 2) = {0.05 0.0476190476190476 0.0454545454545455}']) - - # double4 - self.try_command('language renderscript allocation dump 47', - ['(0, 0, 0) = {inf 1 0.5 0.333333333333333}', - '(0, 1, 0) = {0.25 0.2 0.166666666666667 0.142857142857143}', - '(0, 0, 1) = {0.125 0.111111111111111 0.1 0.0909090909090909}', - '(0, 1, 1) = {0.0833333333333333 0.0769230769230769 ' - '0.0714285714285714 0.0666666666666667}', - '(0, 0, 2) = {0.0625 0.0588235294117647 ' - '0.0555555555555556 0.0526315789473684}', - '(0, 1, 2) = {0.05 0.0476190476190476 ' - '0.0454545454545455 0.0434782608695652}']) - - # Delete kernel breakpoint on add_half_kernel - self.try_command('breakpoint del 3', - ['1 breakpoints deleted']) - - self.try_command('process continue', - ['exited with status = 0']) diff --git a/tests/lldb/tests/testcases/test_allocation_dump_2_jni.py b/tests/lldb/tests/testcases/test_allocation_dump_2_jni.py deleted file mode 100644 index 41e33d39..00000000 --- a/tests/lldb/tests/testcases/test_allocation_dump_2_jni.py +++ /dev/null @@ -1,518 +0,0 @@ -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -'''Module that contains the test TestAllocationDump2JNI.''' - -from __future__ import absolute_import - -from harness.test_base_remote import TestBaseRemote - - -class TestAllocationDump2JNI(TestBaseRemote): - '''Tests printing the contents of allocations of a JNI apk.''' - - bundle_target = { - 'jni': 'JNIAllocations' - } - - def test_case(self): - '''Run the lldb commands that are being tested. - - Raises: - TestFail: One of the lldb commands did not provide the expected - output. - ''' - # pylint: disable=line-too-long - self.try_command('language renderscript kernel breakpoint all enable', - ['Breakpoints will be set on all kernels']) - - self.try_command('process continue', - ['resuming', - 'stopped', - 'stop reason = breakpoint']) - - self.try_command('breakpoint del 1', - ['1 breakpoints deleted']) - - # Hit second kernel - self.try_command('process continue', - ['resuming', - 'stopped', - 'stop reason = breakpoint']) - - # uchar - self.try_command('language renderscript allocation dump 20', - ['(0, 0, 0) = 0', - '(1, 0, 0) = 1', - '(2, 0, 0) = 2', - '(3, 0, 0) = 3', - '(4, 0, 0) = 4', - '(5, 0, 0) = 5', - '(6, 0, 0) = 6', - '(7, 0, 0) = 7', - '(8, 0, 0) = 8', - '(9, 0, 0) = 9', - '(10, 0, 0) = 10', - '(11, 0, 0) = 11', - '(12, 0, 0) = 12', - '(13, 0, 0) = 13', - '(14, 0, 0) = 14', - '(15, 0, 0) = 15', - '(16, 0, 0) = 16', - '(17, 0, 0) = 17', - '(18, 0, 0) = 18', - '(19, 0, 0) = 19', - '(20, 0, 0) = 20', - '(21, 0, 0) = 21', - '(22, 0, 0) = 22', - '(23, 0, 0) = 23']) - - # uchar2 - self.try_command('language renderscript allocation dump 21', - ['(0, 0, 0) = {0x00 0x01}', - '(1, 0, 0) = {0x02 0x03}', - '(0, 1, 0) = {0x04 0x05}', - '(1, 1, 0) = {0x06 0x07}', - '(0, 2, 0) = {0x08 0x09}', - '(1, 2, 0) = {0x0a 0x0b}', - '(0, 3, 0) = {0x0c 0x0d}', - '(1, 3, 0) = {0x0e 0x0f}', - '(0, 4, 0) = {0x10 0x11}', - '(1, 4, 0) = {0x12 0x13}', - '(0, 5, 0) = {0x14 0x15}', - '(1, 5, 0) = {0x16 0x17}']) - - # uchar3 - self.try_command('language renderscript allocation dump 22', - ['(0, 0, 0) = {0x00 0x01 0x02}', - '(1, 0, 0) = {0x04 0x05 0x06}', - '(2, 0, 0) = {0x08 0x09 0x0a}', - '(3, 0, 0) = {0x0c 0x0d 0x0e}', - '(4, 0, 0) = {0x10 0x11 0x12}', - '(5, 0, 0) = {0x14 0x15 0x16}']) - - # uchar4 - self.try_command('language renderscript allocation dump 23', - ['(0, 0, 0) = {0x00 0x01 0x02 0x03}', - '(1, 0, 0) = {0x04 0x05 0x06 0x07}', - '(2, 0, 0) = {0x08 0x09 0x0a 0x0b}', - '(3, 0, 0) = {0x0c 0x0d 0x0e 0x0f}', - '(4, 0, 0) = {0x10 0x11 0x12 0x13}', - '(5, 0, 0) = {0x14 0x15 0x16 0x17}']) - - # ushort - self.try_command('language renderscript allocation dump 24', - ['(0, 0, 0) = 0', - '(1, 0, 0) = 1', - '(2, 0, 0) = 2', - '(3, 0, 0) = 3', - '(4, 0, 0) = 4', - '(5, 0, 0) = 5', - '(6, 0, 0) = 6', - '(7, 0, 0) = 7', - '(8, 0, 0) = 8', - '(9, 0, 0) = 9', - '(10, 0, 0) = 10', - '(11, 0, 0) = 11', - '(12, 0, 0) = 12', - '(13, 0, 0) = 13', - '(14, 0, 0) = 14', - '(15, 0, 0) = 15', - '(16, 0, 0) = 16', - '(17, 0, 0) = 17', - '(18, 0, 0) = 18', - '(19, 0, 0) = 19', - '(20, 0, 0) = 20', - '(21, 0, 0) = 21', - '(22, 0, 0) = 22', - '(23, 0, 0) = 23']) - - # ushort2 - self.try_command('language renderscript allocation dump 25', - ['(0, 0, 0) = {0x0000 0x0001}', - '(1, 0, 0) = {0x0002 0x0003}', - '(2, 0, 0) = {0x0004 0x0005}', - '(3, 0, 0) = {0x0006 0x0007}', - '(4, 0, 0) = {0x0008 0x0009}', - '(5, 0, 0) = {0x000a 0x000b}', - '(6, 0, 0) = {0x000c 0x000d}', - '(7, 0, 0) = {0x000e 0x000f}', - '(8, 0, 0) = {0x0010 0x0011}', - '(9, 0, 0) = {0x0012 0x0013}', - '(10, 0, 0) = {0x0014 0x0015}', - '(11, 0, 0) = {0x0016 0x0017}']) - - # ushort3 - self.try_command('language renderscript allocation dump 26', - ['(0, 0, 0) = {0x0000 0x0001 0x0002}', - '(0, 1, 0) = {0x0004 0x0005 0x0006}', - '(0, 2, 0) = {0x0008 0x0009 0x000a}', - '(0, 3, 0) = {0x000c 0x000d 0x000e}', - '(0, 4, 0) = {0x0010 0x0011 0x0012}', - '(0, 5, 0) = {0x0014 0x0015 0x0016}']) - - # ushort4 - self.try_command('language renderscript allocation dump 27', - ['(0, 0, 0) = {0x0000 0x0001 0x0002 0x0003}', - '(1, 0, 0) = {0x0004 0x0005 0x0006 0x0007}', - '(2, 0, 0) = {0x0008 0x0009 0x000a 0x000b}', - '(3, 0, 0) = {0x000c 0x000d 0x000e 0x000f}', - '(4, 0, 0) = {0x0010 0x0011 0x0012 0x0013}', - '(5, 0, 0) = {0x0014 0x0015 0x0016 0x0017}']) - - # uint - self.try_command('language renderscript allocation dump 28', - ['(0, 0, 0) = 0', - '(1, 0, 0) = 1', - '(2, 0, 0) = 2', - '(3, 0, 0) = 3', - '(4, 0, 0) = 4', - '(5, 0, 0) = 5', - '(6, 0, 0) = 6', - '(7, 0, 0) = 7', - '(8, 0, 0) = 8', - '(9, 0, 0) = 9', - '(10, 0, 0) = 10', - '(11, 0, 0) = 11', - '(12, 0, 0) = 12', - '(13, 0, 0) = 13', - '(14, 0, 0) = 14', - '(15, 0, 0) = 15', - '(16, 0, 0) = 16', - '(17, 0, 0) = 17', - '(18, 0, 0) = 18', - '(19, 0, 0) = 19', - '(20, 0, 0) = 20', - '(21, 0, 0) = 21', - '(22, 0, 0) = 22', - '(23, 0, 0) = 23']) - - # uint2 - self.try_command('language renderscript allocation dump 29', - ['(0, 0, 0) = {0x00000000 0x00000001}', - '(1, 0, 0) = {0x00000002 0x00000003}', - '(2, 0, 0) = {0x00000004 0x00000005}', - '(3, 0, 0) = {0x00000006 0x00000007}', - '(4, 0, 0) = {0x00000008 0x00000009}', - '(5, 0, 0) = {0x0000000a 0x0000000b}', - '(6, 0, 0) = {0x0000000c 0x0000000d}', - '(7, 0, 0) = {0x0000000e 0x0000000f}', - '(8, 0, 0) = {0x00000010 0x00000011}', - '(9, 0, 0) = {0x00000012 0x00000013}', - '(10, 0, 0) = {0x00000014 0x00000015}', - '(11, 0, 0) = {0x00000016 0x00000017}']) - - # uint3 - self.try_command('language renderscript allocation dump 30', - ['(0, 0, 0) = {0x00000000 0x00000001 0x00000002}', - '(1, 0, 0) = {0x00000004 0x00000005 0x00000006}', - '(2, 0, 0) = {0x00000008 0x00000009 0x0000000a}', - '(3, 0, 0) = {0x0000000c 0x0000000d 0x0000000e}', - '(4, 0, 0) = {0x00000010 0x00000011 0x00000012}', - '(5, 0, 0) = {0x00000014 0x00000015 0x00000016}']) - - # uint4 - self.try_command('language renderscript allocation dump 31', - ['(0, 0, 0) = {0x00000000 0x00000001 0x00000002 0x00000003}', - '(0, 0, 1) = {0x00000004 0x00000005 0x00000006 0x00000007}', - '(0, 0, 2) = {0x00000008 0x00000009 0x0000000a 0x0000000b}', - '(0, 0, 3) = {0x0000000c 0x0000000d 0x0000000e 0x0000000f}', - '(0, 0, 4) = {0x00000010 0x00000011 0x00000012 0x00000013}', - '(0, 0, 5) = {0x00000014 0x00000015 0x00000016 0x00000017}']) - - # ulong - self.try_command('language renderscript allocation dump 32', - ['(0, 0, 0) = 0', - '(1, 0, 0) = 1', - '(2, 0, 0) = 2', - '(3, 0, 0) = 3', - '(0, 1, 0) = 4', - '(1, 1, 0) = 5', - '(2, 1, 0) = 6', - '(3, 1, 0) = 7', - '(0, 2, 0) = 8', - '(1, 2, 0) = 9', - '(2, 2, 0) = 10', - '(3, 2, 0) = 11', - '(0, 0, 1) = 12', - '(1, 0, 1) = 13', - '(2, 0, 1) = 14', - '(3, 0, 1) = 15', - '(0, 1, 1) = 16', - '(1, 1, 1) = 17', - '(2, 1, 1) = 18', - '(3, 1, 1) = 19', - '(0, 2, 1) = 20', - '(1, 2, 1) = 21', - '(2, 2, 1) = 22', - '(3, 2, 1) = 23']) - - # ulong2 - self.try_command('language renderscript allocation dump 33', - ['(0, 0, 0) = {0x0000000000000000 0x0000000000000001}', - '(1, 0, 0) = {0x0000000000000002 0x0000000000000003}', - '(2, 0, 0) = {0x0000000000000004 0x0000000000000005}', - '(3, 0, 0) = {0x0000000000000006 0x0000000000000007}', - '(4, 0, 0) = {0x0000000000000008 0x0000000000000009}', - '(5, 0, 0) = {0x000000000000000a 0x000000000000000b}', - '(6, 0, 0) = {0x000000000000000c 0x000000000000000d}', - '(7, 0, 0) = {0x000000000000000e 0x000000000000000f}', - '(8, 0, 0) = {0x0000000000000010 0x0000000000000011}', - '(9, 0, 0) = {0x0000000000000012 0x0000000000000013}', - '(10, 0, 0) = {0x0000000000000014 0x0000000000000015}', - '(11, 0, 0) = {0x0000000000000016 0x0000000000000017}']) - - # ulong3 - self.try_command('language renderscript allocation dump 34', - ['(0, 0, 0) = {0x0000000000000000 0x0000000000000001 0x0000000000000002}', - '(1, 0, 0) = {0x0000000000000004 0x0000000000000005 0x0000000000000006}', - '(2, 0, 0) = {0x0000000000000008 0x0000000000000009 0x000000000000000a}', - '(3, 0, 0) = {0x000000000000000c 0x000000000000000d 0x000000000000000e}', - '(4, 0, 0) = {0x0000000000000010 0x0000000000000011 0x0000000000000012}', - '(5, 0, 0) = {0x0000000000000014 0x0000000000000015 0x0000000000000016}']) - - # ulong4 - self.try_command('language renderscript allocation dump 35', - ['(0, 0, 0) = {0x0000000000000000 0x0000000000000001 ' - '0x0000000000000002 0x0000000000000003}', - '(1, 0, 0) = {0x0000000000000004 0x0000000000000005 ' - '0x0000000000000006 0x0000000000000007}', - '(2, 0, 0) = {0x0000000000000008 0x0000000000000009 ' - '0x000000000000000a 0x000000000000000b}', - '(3, 0, 0) = {0x000000000000000c 0x000000000000000d ' - '0x000000000000000e 0x000000000000000f}', - '(4, 0, 0) = {0x0000000000000010 0x0000000000000011 ' - '0x0000000000000012 0x0000000000000013}', - '(5, 0, 0) = {0x0000000000000014 0x0000000000000015 ' - '0x0000000000000016 0x0000000000000017}']) - - self.try_command('breakpoint del 2', - ['1 breakpoints deleted']) - - # Hit third kernel - self.try_command('process continue', - ['resuming', - 'stopped', - 'stop reason = breakpoint']) - - # Test that uint allocation has been squared by square_kernel - self.try_command('language renderscript allocation dump 28', - ['(0, 0, 0) = 0', - '(1, 0, 0) = 1', - '(2, 0, 0) = 4', - '(3, 0, 0) = 9', - '(4, 0, 0) = 16', - '(5, 0, 0) = 25', - '(6, 0, 0) = 36', - '(7, 0, 0) = 49', - '(8, 0, 0) = 64', - '(9, 0, 0) = 81', - '(10, 0, 0) = 100', - '(11, 0, 0) = 121', - '(12, 0, 0) = 144', - '(13, 0, 0) = 169', - '(14, 0, 0) = 196', - '(15, 0, 0) = 225', - '(16, 0, 0) = 256', - '(17, 0, 0) = 289', - '(18, 0, 0) = 324', - '(19, 0, 0) = 361', - '(20, 0, 0) = 400', - '(21, 0, 0) = 441', - '(22, 0, 0) = 484', - '(23, 0, 0) = 529']) - - # half - self.try_command('language renderscript allocation dump 36', - ['(0, 0, 0) = inf', - '(1, 0, 0) = 1', - '(2, 0, 0) = 0.5', - '(3, 0, 0) = 0.333252', - '(4, 0, 0) = 0.25', - '(5, 0, 0) = 0.199951', - '(6, 0, 0) = 0.166626', - '(7, 0, 0) = 0.142822', - '(8, 0, 0) = 0.125', - '(9, 0, 0) = 0.111084', - '(10, 0, 0) = 0.0999756', - '(11, 0, 0) = 0.0908813', - '(12, 0, 0) = 0.083313', - '(13, 0, 0) = 0.0769043', - '(14, 0, 0) = 0.0714111', - '(15, 0, 0) = 0.0666504', - '(16, 0, 0) = 0.0625', - '(17, 0, 0) = 0.0588379', - '(18, 0, 0) = 0.055542', - '(19, 0, 0) = 0.0526428', - '(20, 0, 0) = 0.0499878', - '(21, 0, 0) = 0.0476074', - '(22, 0, 0) = 0.0454407', - '(23, 0, 0) = 0.0434875']) - - # half2 - self.try_command('language renderscript allocation dump 37', - ['(0, 0, 0) = {inf 1}', - '(1, 0, 0) = {0.5 0.333252}', - '(2, 0, 0) = {0.25 0.199951}', - '(3, 0, 0) = {0.166626 0.142822}', - '(4, 0, 0) = {0.125 0.111084}', - '(5, 0, 0) = {0.0999756 0.0908813}', - '(6, 0, 0) = {0.083313 0.0769043}', - '(7, 0, 0) = {0.0714111 0.0666504}', - '(8, 0, 0) = {0.0625 0.0588379}', - '(9, 0, 0) = {0.055542 0.0526428}', - '(10, 0, 0) = {0.0499878 0.0476074}', - '(11, 0, 0) = {0.0454407 0.0434875}']) - - # half3 - self.try_command('language renderscript allocation dump 38', - ['(0, 0, 0) = {inf 1 0.5}', - '(0, 1, 0) = {0.25 0.199951 0.166626}', - '(0, 2, 0) = {0.125 0.111084 0.0999756}', - '(0, 3, 0) = {0.083313 0.0769043 0.0714111}', - '(0, 4, 0) = {0.0625 0.0588379 0.055542}', - '(0, 5, 0) = {0.0499878 0.0476074 0.0454407}']) - - # half4 - self.try_command('language renderscript allocation dump 39', - ['(0, 0, 0) = {inf 1 0.5 0.333252}', - '(1, 0, 0) = {0.25 0.199951 0.166626 0.142822}', - '(2, 0, 0) = {0.125 0.111084 0.0999756 0.0908813}', - '(3, 0, 0) = {0.083313 0.0769043 0.0714111 0.0666504}', - '(4, 0, 0) = {0.0625 0.0588379 0.055542 0.0526428}', - '(5, 0, 0) = {0.0499878 0.0476074 0.0454407 0.0434875}']) - - # float - self.try_command('language renderscript allocation dump 40', - ['(0, 0, 0) = inf', - '(1, 0, 0) = 1', - '(2, 0, 0) = 0.5', - '(3, 0, 0) = 0.333333', - '(4, 0, 0) = 0.25', - '(5, 0, 0) = 0.2', - '(6, 0, 0) = 0.166667', - '(7, 0, 0) = 0.142857', - '(8, 0, 0) = 0.125', - '(9, 0, 0) = 0.111111', - '(10, 0, 0) = 0.1', - '(11, 0, 0) = 0.0909091', - '(12, 0, 0) = 0.0833333', - '(13, 0, 0) = 0.0769231', - '(14, 0, 0) = 0.0714286', - '(15, 0, 0) = 0.0666667', - '(16, 0, 0) = 0.0625', - '(17, 0, 0) = 0.0588235', - '(18, 0, 0) = 0.0555556', - '(19, 0, 0) = 0.0526316', - '(20, 0, 0) = 0.05', - '(21, 0, 0) = 0.047619', - '(22, 0, 0) = 0.0454545', - '(23, 0, 0) = 0.0434783']) - - # float2 - self.try_command('language renderscript allocation dump 41', - ['(0, 0, 0) = {inf 1}', - '(1, 0, 0) = {0.5 0.333333}', - '(2, 0, 0) = {0.25 0.2}', - '(3, 0, 0) = {0.166667 0.142857}', - '(4, 0, 0) = {0.125 0.111111}', - '(5, 0, 0) = {0.1 0.0909091}', - '(6, 0, 0) = {0.0833333 0.0769231}', - '(7, 0, 0) = {0.0714286 0.0666667}', - '(8, 0, 0) = {0.0625 0.0588235}', - '(9, 0, 0) = {0.0555556 0.0526316}', - '(10, 0, 0) = {0.05 0.047619}', - '(11, 0, 0) = {0.0454545 0.0434783}']) - - # float3 - self.try_command('language renderscript allocation dump 42', - ['(0, 0, 0) = {inf 1 0.5}', - '(1, 0, 0) = {0.25 0.2 0.166667}', - '(2, 0, 0) = {0.125 0.111111 0.1}', - '(3, 0, 0) = {0.0833333 0.0769231 0.0714286}', - '(4, 0, 0) = {0.0625 0.0588235 0.0555556}', - '(5, 0, 0) = {0.05 0.047619 0.0454545}']) - - # float4 - self.try_command('language renderscript allocation dump 43', - ['(0, 0, 0) = {inf 1 0.5 0.333333}', - '(1, 0, 0) = {0.25 0.2 0.166667 0.142857}', - '(2, 0, 0) = {0.125 0.111111 0.1 0.0909091}', - '(0, 1, 0) = {0.0833333 0.0769231 0.0714286 0.0666667}', - '(1, 1, 0) = {0.0625 0.0588235 0.0555556 0.0526316}', - '(2, 1, 0) = {0.05 0.047619 0.0454545 0.0434783}']) - - # double - self.try_command('language renderscript allocation dump 44', - ['(0, 0, 0) = inf', - '(1, 0, 0) = 1', - '(2, 0, 0) = 0.5', - '(3, 0, 0) = 0.333333333333333', - '(4, 0, 0) = 0.25', - '(5, 0, 0) = 0.2', - '(6, 0, 0) = 0.166666666666667', - '(7, 0, 0) = 0.142857142857143', - '(8, 0, 0) = 0.125', - '(9, 0, 0) = 0.111111111111111', - '(10, 0, 0) = 0.1', - '(11, 0, 0) = 0.0909090909090909', - '(12, 0, 0) = 0.0833333333333333', - '(13, 0, 0) = 0.0769230769230769', - '(14, 0, 0) = 0.0714285714285714', - '(15, 0, 0) = 0.0666666666666667', - '(16, 0, 0) = 0.0625', - '(17, 0, 0) = 0.0588235294117647', - '(18, 0, 0) = 0.0555555555555556', - '(19, 0, 0) = 0.0526315789473684', - '(20, 0, 0) = 0.05', - '(21, 0, 0) = 0.0476190476190476', - '(22, 0, 0) = 0.0454545454545455', - '(23, 0, 0) = 0.0434782608695652']) - - # double2 - self.try_command('language renderscript allocation dump 45', - ['(0, 0, 0) = {inf 1}', - '(1, 0, 0) = {0.5 0.333333333333333}', - '(2, 0, 0) = {0.25 0.2}', - '(3, 0, 0) = {0.166666666666667 0.142857142857143}', - '(0, 0, 1) = {0.125 0.111111111111111}', - '(1, 0, 1) = {0.1 0.0909090909090909}', - '(2, 0, 1) = {0.0833333333333333 0.0769230769230769}', - '(3, 0, 1) = {0.0714285714285714 0.0666666666666667}', - '(0, 0, 2) = {0.0625 0.0588235294117647}', - '(1, 0, 2) = {0.0555555555555556 0.0526315789473684}', - '(2, 0, 2) = {0.05 0.0476190476190476}', - '(3, 0, 2) = {0.0454545454545455 0.0434782608695652}']) - - # double3 - self.try_command('language renderscript allocation dump 46', - ['(0, 0, 0) = {inf 1 0.5}', - '(0, 1, 0) = {0.25 0.2 0.166666666666667}', - '(0, 0, 1) = {0.125 0.111111111111111 0.1}', - '(0, 1, 1) = {0.0833333333333333 0.0769230769230769 ' - '0.0714285714285714}', - '(0, 0, 2) = {0.0625 0.0588235294117647 0.0555555555555556}', - '(0, 1, 2) = {0.05 0.0476190476190476 0.0454545454545455}']) - - # double4 - self.try_command('language renderscript allocation dump 47', - ['(0, 0, 0) = {inf 1 0.5 0.333333333333333}', - '(0, 1, 0) = {0.25 0.2 0.166666666666667 0.142857142857143}', - '(0, 0, 1) = {0.125 0.111111111111111 0.1 0.0909090909090909}', - '(0, 1, 1) = {0.0833333333333333 0.0769230769230769 ' - '0.0714285714285714 0.0666666666666667}', - '(0, 0, 2) = {0.0625 0.0588235294117647 ' - '0.0555555555555556 0.0526315789473684}', - '(0, 1, 2) = {0.05 0.0476190476190476 ' - '0.0454545454545455 0.0434782608695652}']) diff --git a/tests/lldb/tests/testcases/test_allocation_dump_struct.py b/tests/lldb/tests/testcases/test_allocation_dump_struct.py deleted file mode 100644 index f161131f..00000000 --- a/tests/lldb/tests/testcases/test_allocation_dump_struct.py +++ /dev/null @@ -1,165 +0,0 @@ -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -'''Module that contains the test TestAllocationDumpStruct.''' - -from __future__ import absolute_import - -from harness.test_base_remote import TestBaseRemote - - -class TestAllocationDumpStruct(TestBaseRemote): - '''Tests printing the contents of a struct allocation.''' - - bundle_target = { - 'java': 'Allocations' - } - - def setup(self, android): - '''This test requires to be run on one thread.''' - android.push_prop('debug.rs.max-threads', 1) - - def teardown(self, android): - '''Reset the number of RS threads to the previous value.''' - android.pop_prop('debug.rs.max-threads') - - def test_dump_complex_struct_allocation(self): - # Hit struct_kernel on last coordinate, so almost all elements have been initalised - self.try_command( - 'language renderscript kernel breakpoint set struct_kernel -c 23', - ['Conditional kernel breakpoint on coordinate (23, 0, 0)', - 'Breakpoint(s) created']) - - self.try_command('process continue', - ['resuming', - 'stopped', - 'stop reason = breakpoint']) - - # complex_struct output allocation - self.try_command('language renderscript allocation dump 49', - ['(0, 0, 0) = (complexStruct) {\n' - ' (i = 0, j = 0)\n' - ' (0x00, 0x41, 0x42, 0x43)\n' - ' ([0] = 0, [1] = 0.5)\n' - '}', - '(1, 0, 0) = (complexStruct) {\n' - ' (i = 1, j = 1)\n' - ' (0x01, 0x41, 0x42, 0x43)\n' - ' ([0] = 1, [1] = 1.5)\n' - '}', - '(2, 0, 0) = (complexStruct) {\n' - ' (i = 2, j = 2)\n' - ' (0x02, 0x41, 0x42, 0x43)\n' - ' ([0] = 2, [1] = 2.5)\n' - '}', - '(3, 0, 0) = (complexStruct) {\n' - ' (i = 3, j = 3)\n' - ' (0x03, 0x41, 0x42, 0x43)\n' - ' ([0] = 3, [1] = 3.5)\n' - '}', - '(4, 0, 0) = (complexStruct) {\n' - ' (i = 4, j = 4)\n' - ' (0x04, 0x41, 0x42, 0x43)\n' - ' ([0] = 4, [1] = 4.5)\n' - '}', - '(5, 0, 0) = (complexStruct) {\n' - ' (i = 5, j = 5)\n' - ' (0x05, 0x41, 0x42, 0x43)\n' - ' ([0] = 5, [1] = 5.5)\n' - '}', - '(6, 0, 0) = (complexStruct) {\n' - ' (i = 6, j = 6)\n' - ' (0x06, 0x41, 0x42, 0x43)\n' - ' ([0] = 6, [1] = 6.5)\n' - '}', - '(7, 0, 0) = (complexStruct) {\n' - ' (i = 7, j = 7)\n' - ' (0x07, 0x41, 0x42, 0x43)\n' - ' ([0] = 7, [1] = 7.5)\n' - '}', - '(8, 0, 0) = (complexStruct) {\n' - ' (i = 8, j = 8)\n' - ' (0x08, 0x41, 0x42, 0x43)\n' - ' ([0] = 8, [1] = 8.5)\n' - '}', - '(9, 0, 0) = (complexStruct) {\n' - ' (i = 9, j = 9)\n' - ' (0x09, 0x41, 0x42, 0x43)\n' - ' ([0] = 9, [1] = 9.5)\n' - '}', - '(10, 0, 0) = (complexStruct) {\n' - ' (i = 10, j = 10)\n' - ' (0x0a, 0x41, 0x42, 0x43)\n' - ' ([0] = 10, [1] = 10.5)\n' - '}', - '(11, 0, 0) = (complexStruct) {\n' - ' (i = 11, j = 11)\n' - ' (0x0b, 0x41, 0x42, 0x43)\n' - ' ([0] = 11, [1] = 11.5)\n' - '}', - '(12, 0, 0) = (complexStruct) {\n' - ' (i = 12, j = 12)\n' - ' (0x0c, 0x41, 0x42, 0x43)\n' - ' ([0] = 12, [1] = 12.5)\n' - '}', - '(13, 0, 0) = (complexStruct) {\n' - ' (i = 13, j = 13)\n' - ' (0x0d, 0x41, 0x42, 0x43)\n' - ' ([0] = 13, [1] = 13.5)\n' - '}', - '(14, 0, 0) = (complexStruct) {\n' - ' (i = 14, j = 14)\n' - ' (0x0e, 0x41, 0x42, 0x43)\n' - ' ([0] = 14, [1] = 14.5)\n' - '}', - '(15, 0, 0) = (complexStruct) {\n' - ' (i = 15, j = 15)\n' - ' (0x0f, 0x41, 0x42, 0x43)\n' - ' ([0] = 15, [1] = 15.5)\n' - '}', - '(16, 0, 0) = (complexStruct) {\n' - ' (i = 16, j = 16)\n' - ' (0x10, 0x41, 0x42, 0x43)\n' - ' ([0] = 16, [1] = 16.5)\n' - '}', - '(17, 0, 0) = (complexStruct) {\n' - ' (i = 17, j = 17)\n' - ' (0x11, 0x41, 0x42, 0x43)\n' - ' ([0] = 17, [1] = 17.5)\n' - '}', - '(18, 0, 0) = (complexStruct) {\n' - ' (i = 18, j = 18)\n' - ' (0x12, 0x41, 0x42, 0x43)\n' - ' ([0] = 18, [1] = 18.5)\n' - '}', - '(19, 0, 0) = (complexStruct) {\n' - ' (i = 19, j = 19)\n' - ' (0x13, 0x41, 0x42, 0x43)\n' - ' ([0] = 19, [1] = 19.5)\n' - '}', - '(20, 0, 0) = (complexStruct) {\n' - ' (i = 20, j = 20)\n' - ' (0x14, 0x41, 0x42, 0x43)\n' - ' ([0] = 20, [1] = 20.5)\n' - '}', - '(21, 0, 0) = (complexStruct) {\n' - ' (i = 21, j = 21)\n' - ' (0x15, 0x41, 0x42, 0x43)\n' - ' ([0] = 21, [1] = 21.5)\n' - '}', - '(22, 0, 0) = (complexStruct) {\n' - ' (i = 22, j = 22)\n' - ' (0x16, 0x41, 0x42, 0x43)\n' - ' ([0] = 22, [1] = 22.5)\n' - '}']) diff --git a/tests/lldb/tests/testcases/test_allocation_file.py b/tests/lldb/tests/testcases/test_allocation_file.py deleted file mode 100644 index 680ae4a3..00000000 --- a/tests/lldb/tests/testcases/test_allocation_file.py +++ /dev/null @@ -1,210 +0,0 @@ -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -'''Module that contains the test TestAllocationFile.''' - -from __future__ import absolute_import - -import os - -from harness.test_base_remote import TestBaseRemote -from harness.decorators import ( - cpp_only_test, - ordered_test -) - - -class TestAllocationFile(TestBaseRemote): - '''Tests saving the contents of allocations to disk and reloading them.''' - - bundle_target = { - 'java': 'Allocations', - 'cpp': 'CppAllocations', - 'jni': 'JNIAllocations' - } - - @ordered_test(0) - def test_allocation_file_roundtrip(self): - self.try_command('language renderscript kernel breakpoint all enable', - ['Breakpoints will be set on all kernels']) - - self.try_command('process continue', - ['resuming', - 'stopped', - 'stop reason = breakpoint']) - - # Binary file of int2 allocation - file_int2 = self.get_tmp_file_path() - - self.try_command('language renderscript allocation save 12 ' + - file_int2, - ["Allocation written to file '%s'" % file_int2]) - - # Check file was created - self.assert_true(os.path.isfile(file_int2)) - - # Load the file we just created, to assert the allocation contents are - # the same - self.try_command('language renderscript allocation load 12 ' + - file_int2, - ["Contents of file '%s' read into allocation 12" % - file_int2]) - os.remove(file_int2) - - self.try_command('language renderscript allocation dump 12', - ['(0, 0, 0) = {0 1}', - '(1, 0, 0) = {2 3}', - '(2, 0, 0) = {4 5}', - '(3, 0, 0) = {6 7}', - '(4, 0, 0) = {8 9}', - '(5, 0, 0) = {10 11}', - '(6, 0, 0) = {12 13}', - '(7, 0, 0) = {14 15}', - '(8, 0, 0) = {16 17}', - '(9, 0, 0) = {18 19}', - '(10, 0, 0) = {20 21}', - '(11, 0, 0) = {22 23}']) - - self.try_command('breakpoint del 1', - ['1 breakpoints deleted']) - - # Hit second kernel - self.try_command('process continue', - ['resuming', - 'stopped', - 'stop reason = breakpoint']) - - # Binary file of uint allocation - file_uint = self.get_tmp_file_path() - - self.try_command('language renderscript allocation save 28 ' + - file_uint, - ["Allocation written to file '%s'" % file_uint]) - - # Check file was created - self.assert_true(os.path.isfile(file_uint)) - - # Test loading file into allocation with an incompatible type 'short' - self.try_command('language renderscript allocation load 7 ' + file_uint, - ["Contents of file '%s' read into allocation 7" % - file_uint, - "Warning: Mismatched Element sizes", - "Warning: Mismatched Types", - "Warning: Mismatched allocation sizes"]) - - # Check result of size inconsistency, mapping 4-byte unsigned to 2-byte - # int - self.try_command('language renderscript allocation dump 7', - ['(0, 0, 0) = 0', - '(1, 0, 0) = 0', - '(2, 0, 0) = 1', - '(3, 0, 0) = 0', - '(4, 0, 0) = 2', - '(5, 0, 0) = 0', - '(6, 0, 0) = 3', - '(7, 0, 0) = 0', - '(8, 0, 0) = 4', - '(9, 0, 0) = 0', - '(10, 0, 0) = 5', - '(11, 0, 0) = 0', - '(12, 0, 0) = 6', - '(13, 0, 0) = 0', - '(14, 0, 0) = 7', - '(15, 0, 0) = 0', - '(16, 0, 0) = 8', - '(17, 0, 0) = 0', - '(18, 0, 0) = 9', - '(19, 0, 0) = 0', - '(20, 0, 0) = 10', - '(21, 0, 0) = 0', - '(22, 0, 0) = 11', - '(23, 0, 0) = 0']) - - self.try_command('breakpoint del 2', - ['1 breakpoints deleted']) - - # Hit third kernel - self.try_command('process continue', - ['resuming', - 'stopped', - 'stop reason = breakpoint']) - - # Test that uint allocation has been squared by square_kernel - self.try_command('language renderscript allocation dump 28', - ['(0, 0, 0) = 0', - '(1, 0, 0) = 1', - '(2, 0, 0) = 4', - '(3, 0, 0) = 9', - '(4, 0, 0) = 16', - '(5, 0, 0) = 25', - '(6, 0, 0) = 36', - '(7, 0, 0) = 49', - '(8, 0, 0) = 64', - '(9, 0, 0) = 81', - '(10, 0, 0) = 100', - '(11, 0, 0) = 121', - '(12, 0, 0) = 144', - '(13, 0, 0) = 169', - '(14, 0, 0) = 196', - '(15, 0, 0) = 225', - '(16, 0, 0) = 256', - '(17, 0, 0) = 289', - '(18, 0, 0) = 324', - '(19, 0, 0) = 361', - '(20, 0, 0) = 400', - '(21, 0, 0) = 441', - '(22, 0, 0) = 484', - '(23, 0, 0) = 529']) - - # Load uint allocation from save before square_kernel had been run - self.try_command('language renderscript allocation load 28 ' + - file_uint, - ["Contents of file '%s' read into allocation 28" % - file_uint]) - os.remove(file_uint) - - # Check contents are back to original - self.try_command('language renderscript allocation dump 28', - ['(0, 0, 0) = 0', - '(1, 0, 0) = 1', - '(2, 0, 0) = 2', - '(3, 0, 0) = 3', - '(4, 0, 0) = 4', - '(5, 0, 0) = 5', - '(6, 0, 0) = 6', - '(7, 0, 0) = 7', - '(8, 0, 0) = 8', - '(9, 0, 0) = 9', - '(10, 0, 0) = 10', - '(11, 0, 0) = 11', - '(12, 0, 0) = 12', - '(13, 0, 0) = 13', - '(14, 0, 0) = 14', - '(15, 0, 0) = 15', - '(16, 0, 0) = 16', - '(17, 0, 0) = 17', - '(18, 0, 0) = 18', - '(19, 0, 0) = 19', - '(20, 0, 0) = 20', - '(21, 0, 0) = 21', - '(22, 0, 0) = 22', - '(23, 0, 0) = 23']) - - @ordered_test('last') - @cpp_only_test() - def test_cpp_cleanup(self): - self.try_command('breakpoint delete 3', ['1 breakpoints deleted']) - - self.try_command('process continue', - ['exited with status = 0']) diff --git a/tests/lldb/tests/testcases/test_allocation_list.py b/tests/lldb/tests/testcases/test_allocation_list.py deleted file mode 100644 index ca492f2a..00000000 --- a/tests/lldb/tests/testcases/test_allocation_list.py +++ /dev/null @@ -1,547 +0,0 @@ -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -'''Module that contains the test TestAllocationList.''' - -from __future__ import absolute_import - -from harness.test_base_remote import TestBaseRemote -from harness.decorators import ( - ordered_test, - wimpy, - cpp_only_test, - java_only_test, -) - - -class TestAllocationList(TestBaseRemote): - '''Tests printing the details of all allocations.''' - - bundle_target = { - 'java': 'Allocations', - 'jni': 'JNIAllocations', - 'cpp': 'CppAllocations' - } - - @wimpy - @ordered_test(0) - def test_allocation_list_single(self): - # pylint: disable=anomalous-backslash-in-string - self.try_command('language renderscript kernel breakpoint all enable', - ['Breakpoints will be set on all kernels']) - - self.try_command('process continue', - ['resuming', - 'stopped', - 'stop reason = breakpoint']) - - # Test command line flag for single allocation - self.try_command('language renderscript allocation list -i 3', - [], - ['3:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(1, 3, 8\)\n' - ' Data Type: char\n' - ' Data Kind: User']) - - @ordered_test(1) - def test_allocation_list_all(self): - self.try_command('language renderscript allocation list', - [], - ['1:\n' - # Regex for non zero hex number - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(64, 64, 0\)\n' - ' Data Type: uchar4\n' - ' Data Kind: RGBA Pixel', - '2:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(64, 64, 0\)\n' - ' Data Type: uchar4\n' - ' Data Kind: RGBA Pixel', - '3:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(1, 3, 8\)\n' - ' Data Type: char\n' - ' Data Kind: User', - '4:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(12, 0, 0\)\n' - ' Data Type: char2\n' - ' Data Kind: User', - '5:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(6, 0, 0\)\n' - ' Data Type: char3\n' - ' Data Kind: User', - '6:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(6, 0, 0\)\n' - ' Data Type: char4\n' - ' Data Kind: User', - '7:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(24, 0, 0\)\n' - ' Data Type: short\n' - ' Data Kind: User', - '8:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(6, 1, 2\)\n' - ' Data Type: short2\n' - ' Data Kind: User', - '9:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(6, 0, 0\)\n' - ' Data Type: short3\n' - ' Data Kind: User', - '10:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(6, 0, 0\)\n' - ' Data Type: short4\n' - ' Data Kind: User', - '11:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(24, 0, 0\)\n' - ' Data Type: int\n' - ' Data Kind: User', - '12:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(12, 0, 0\)\n' - ' Data Type: int2\n' - ' Data Kind: User', - '13:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(3, 2, 0\)\n' - ' Data Type: int3\n' - ' Data Kind: User', - '14:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(6, 0, 0\)\n' - ' Data Type: int4\n' - ' Data Kind: User', - '15:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(24, 0, 0\)\n' - ' Data Type: long\n' - ' Data Kind: User', - '16:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(12, 0, 0\)\n' - ' Data Type: long2\n' - ' Data Kind: User', - '17:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(6, 0, 0\)\n' - ' Data Type: long3\n' - ' Data Kind: User', - '18:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(1, 6, 0\)\n' - ' Data Type: long4\n' - ' Data Kind: User', - '19:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(24, 0, 0\)\n' - ' Data Type: bool\n' - ' Data Kind: User' - ]) - - @wimpy - @ordered_test(2) - def test_continue_1(self): - self.try_command('breakpoint del 1', - ['1 breakpoints deleted']) - - # Hit second kernel - self.try_command('process continue', - ['resuming', - 'stopped', - 'stop reason = breakpoint']) - - @ordered_test(3) - def test_allocation_list_all2_java(self): - # TODO investigate why java tests show extra allocations - if self.app_type == 'java': - allocation_1_re = [ - '1:\n' - # Regex for non zero hex number - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(64, 64, 0\)\n' - ' Data Type: uchar4\n' - ' Data Kind: RGBA Pixel' - ] - else: - allocation_1_re = [] - - self.try_command('language renderscript allocation list', - [], - allocation_1_re + - ['2:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(64, 64, 0\)\n' - ' Data Type: uchar4\n' - ' Data Kind: RGBA Pixel', - '7:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(24, 0, 0\)\n' - ' Data Type: short\n' - ' Data Kind: User', - '20:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(24, 0, 0\)\n' - ' Data Type: uchar\n' - ' Data Kind: User', - '21:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(2, 6, 0\)\n' - ' Data Type: uchar2\n' - ' Data Kind: User', - '22:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(6, 0, 0\)\n' - ' Data Type: uchar3\n' - ' Data Kind: User', - '23:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(6, 0, 0\)\n' - ' Data Type: uchar4\n' - ' Data Kind: User', - '24:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(24, 0, 0\)\n' - ' Data Type: ushort\n' - ' Data Kind: User', - '25:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(12, 0, 0\)\n' - ' Data Type: ushort2\n' - ' Data Kind: User', - '26:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(1, 6, 0\)\n' - ' Data Type: ushort3\n' - ' Data Kind: User', - '27:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(6, 0, 0\)\n' - ' Data Type: ushort4\n' - ' Data Kind: User', - '28:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(24, 0, 0\)\n' - ' Data Type: uint\n' - ' Data Kind: User', - '29:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(12, 0, 0\)\n' - ' Data Type: uint2\n' - ' Data Kind: User', - '30:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(6, 0, 0\)\n' - ' Data Type: uint3\n' - ' Data Kind: User', - '31:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(1, 1, 6\)\n' - ' Data Type: uint4\n' - ' Data Kind: User', - '32:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(4, 3, 2\)\n' - ' Data Type: ulong\n' - ' Data Kind: User', - '33:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(12, 0, 0\)\n' - ' Data Type: ulong2\n' - ' Data Kind: User', - '34:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(6, 0, 0\)\n' - ' Data Type: ulong3\n' - ' Data Kind: User', - '35:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(6, 0, 0\)\n' - ' Data Type: ulong4\n' - ' Data Kind: User' - ]) - - @wimpy - @ordered_test(4) - def test_continue_2(self): - self.try_command('breakpoint del 2', - ['1 breakpoints deleted']) - - # Hit third kernel - self.try_command('process continue', - ['resuming', - 'stopped', - 'stop reason = breakpoint']) - - @ordered_test(5) - def test_allocation_list_all3(self): - self.try_command('language renderscript allocation list', - [], - ['2:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(64, 64, 0\)\n' - ' Data Type: uchar4\n' - ' Data Kind: RGBA Pixel', - '7:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(24, 0, 0\)\n' - ' Data Type: short\n' - ' Data Kind: User', - '28:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(24, 0, 0\)\n' - ' Data Type: uint\n' - ' Data Kind: User', - '36:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(24, 0, 0\)\n' - ' Data Type: half\n' - ' Data Kind: User', - '37:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(12, 0, 0\)\n' - ' Data Type: half2\n' - ' Data Kind: User', - '38:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(1, 6, 0\)\n' - ' Data Type: half3\n' - ' Data Kind: User', - '39:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(6, 0, 0\)\n' - ' Data Type: half4\n' - ' Data Kind: User', - '40:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(24, 0, 0\)\n' - ' Data Type: float\n' - ' Data Kind: User', - '41:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(12, 0, 0\)\n' - ' Data Type: float2\n' - ' Data Kind: User', - '42:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(6, 0, 0\)\n' - ' Data Type: float3\n' - ' Data Kind: User', - '43:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(3, 2, 0\)\n' - ' Data Type: float4\n' - ' Data Kind: User', - '44:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(24, 0, 0\)\n' - ' Data Type: double\n' - ' Data Kind: User', - '45:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(4, 1, 3\)\n' - ' Data Type: double2\n' - ' Data Kind: User', - '46:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(1, 2, 3\)\n' - ' Data Type: double3\n' - ' Data Kind: User', - '47:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(1, 2, 3\)\n' - ' Data Type: double4\n' - ' Data Kind: User']) - - @wimpy - @ordered_test(6) - @java_only_test() - def test_allocation_list_all4(self): - self.try_command('breakpoint del 3', - ['1 breakpoints deleted']) - - # Hit last kernel - self.try_command('process continue', - ['resuming', - 'stopped', - 'stop reason = breakpoint']) - - self.try_command('language renderscript allocation list', - [], - ['2:\n' - # Regex for non zero hex number - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(64, 64, 0\)\n' - ' Data Type: uchar4\n' - ' Data Kind: RGBA Pixel', - '7:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(24, 0, 0\)\n' - ' Data Type: short\n' - ' Data Kind: User', - '28:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(24, 0, 0\)\n' - ' Data Type: uint\n' - ' Data Kind: User', - '46:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(1, 2, 3\)\n' - ' Data Type: double3\n' - ' Data Kind: User', - '48:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(24, 0, 0\)\n' - ' Data Type: complexStruct\n' - ' Data Kind: User', - '49:\n' - ' Context: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Address: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Data pointer: 0x0*[1-9a-fA-F][0-9a-fA-F]*\n' - ' Dimensions: \(24, 0, 0\)\n' - ' Data Type: complexStruct\n' - ' Data Kind: User']) - - @ordered_test(7) - @cpp_only_test() - def test_cpp_cleanup(self): - self.try_command('breakpoint delete 3', ['1 breakpoints deleted']) - - self.try_command('process continue', - ['exited with status = 0']) diff --git a/tests/lldb/tests/testcases/test_backtrace.py b/tests/lldb/tests/testcases/test_backtrace.py deleted file mode 100644 index 1e5e79f7..00000000 --- a/tests/lldb/tests/testcases/test_backtrace.py +++ /dev/null @@ -1,92 +0,0 @@ -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -'''Module that contains the test TestBacktrace.''' - -from __future__ import absolute_import - -from harness.test_base_remote import TestBaseRemote -from harness.decorators import ( - ordered_test, - cpp_only_test, -) - - -class TestBacktrace(TestBaseRemote): - '''Tests breaking on a kernel and a function, and viewing the call stack.''' - - bundle_target = { - 'java': 'BranchingFunCalls', - 'jni': 'JNIBranchingFunCalls', - 'cpp': 'CppBranchingFunCalls' - } - - def test_kernel_backtrace(self): - # pylint: disable=line-too-long - self.try_command('language renderscript status', - ['Runtime Library discovered', - 'Runtime Driver discovered']) - - self.try_command('language renderscript kernel breakpoint set simple_kernel', - ['Breakpoint(s) created', - '(pending)']) - - self.try_command('process continue', - ['resuming', - 'stopped', - 'stop reason = breakpoint']) - - self.try_command('bt', - ['stop reason = breakpoint', - # We should be able to see three functions in bt: - # libRSCpuRef, kernel.expand and the kernel - 'frame #2:', - 'librs.scalars.so', - 'simple_kernel'], - [r'scalars\.rs:6[123]']) - - self.try_command('breakpoint delete 1', - ['1 breakpoints deleted']) - - self.try_command('b set_i', - ['Breakpoint 2', - 'set_i'], - [r'scalars\.rs:3[678]']) - - self.try_command('breakpoint list', - ['set_i', 'resolved']) - - self.try_command('process continue', - ['resuming', - 'stopped', - 'stop reason = breakpoint']) - - self.try_command('bt', - ['stop reason = breakpoint', - # We should be able to see five functions in bt: - # libRSCpuRef, kernel.expand, kernel and two functions - 'frame #4:', - 'librs.scalars.so', - 'modify_i', - 'set_i'], - [r'scalars\.rs:3[678]']) - - @ordered_test('last') - @cpp_only_test() - def test_cpp_cleanup(self): - self.try_command('breakpoint delete 2', - ['1 breakpoints deleted']) - - self.try_command('process continue', - ['exited with status = 0']) diff --git a/tests/lldb/tests/testcases/test_breakpoint_coordinate.py b/tests/lldb/tests/testcases/test_breakpoint_coordinate.py deleted file mode 100644 index 319d4f20..00000000 --- a/tests/lldb/tests/testcases/test_breakpoint_coordinate.py +++ /dev/null @@ -1,177 +0,0 @@ -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -'''Module that contains the test TestBreakpointCoordinate.''' - -from __future__ import absolute_import - -from harness.test_base_remote import TestBaseRemote -from harness.decorators import ( - wimpy, - ordered_test, - cpp_only_test, -) -from harness.assert_mixins import CoordinateAssertionsMixin - - -class TestBreakpointCoordinate(TestBaseRemote, CoordinateAssertionsMixin): - '''Tests breaking on a specific kernel invocation. - - Uses the -c option to specify the coordinate. - ''' - - bundle_target = { - 'java': 'Allocations', - 'jni': 'JNIAllocations', - 'cpp': 'CppAllocations' - } - - def setup(self, android): - '''This test requires to be run on one thread. - - Args: - android: The android_util module. - ''' - android.push_prop('debug.rs.max-threads', 1) - - def teardown(self, android): - '''Reset the number of RS threads to the previous value. - - Args: - android: The android_util module. - ''' - android.pop_prop('debug.rs.max-threads') - - @wimpy - @ordered_test(0) - def test_breakpoint_coordinate_2d_swizzle_kernel(self): - # pylint: disable=line-too-long - - # test conditional coordinate in two dimensions - # breakpoint 1 - self.assert_coord_bp_set('swizzle_kernel', 3, 7) - - # we will delete this breakpoint before we hit it. - # breakpoint 2 - self.assert_coord_bp_set('swizzle_kernel', 199, 190) - - self.assert_coord_stop('allocs', 'swizzle_kernel', x=3, y=7) - - # check breakpoints that have been hit are disabled - self.try_command( - 'breakpoint list', - [ - "1: RenderScript kernel breakpoint for 'swizzle_kernel', locations = 1 Options: disabled", - "2: RenderScript kernel breakpoint for 'swizzle_kernel', locations = 1" - ] - ) - - # delete breakpoint on 199,199,0 - self.try_command('breakpoint delete 2', ['1 breakpoints deleted']) - - # check breakpoints that have been hit are disabled - self.try_command( - 'breakpoint list', - ["1: RenderScript kernel breakpoint for 'swizzle_kernel', locations = 1 Options: disabled"] - ) - - # test conditional coordinate in a single dimension - # breakpoint 3 - self.assert_coord_bp_set('square_kernel', 8) - - # check breakpoints that have been hit are disabled - self.try_command( - 'breakpoint list', - [ - "1: RenderScript kernel breakpoint for 'swizzle_kernel', locations = 1 Options: disabled", - "3: RenderScript kernel breakpoint for 'square_kernel', locations = 1" - ] - ) - - self.assert_coord_stop('allocs', 'square_kernel', x=8) - - # check breakpoints that have been hit are disabled - self.try_command( - 'breakpoint list', - [ - "1: RenderScript kernel breakpoint for 'swizzle_kernel', locations = 1 Options: disabled", - "3: RenderScript kernel breakpoint for 'square_kernel', locations = 1 Options: disabled" - ] - ) - - @wimpy - @ordered_test(1) - def test_breakpoint_coordinate_3d_add_half_kernel(self): - # test conditional coordinate in three dimensions - # breakpoint 4 - self.assert_coord_bp_set('add_half_kernel', 0, 0, 1) - # test we can set more than one conditional kernel breakpoint - # and both will be hit; - # breakpoint 5 - self.assert_coord_bp_set('add_half_kernel', 0, 1, 2) - - # Now assert that the next two continue/stop cycles hit our conditionals - self.assert_coord_stop('allocs', 'add_half_kernel', x=0, y=0, z=1) - self.assert_coord_stop('allocs', 'add_half_kernel', x=0, y=1, z=2) - - # check we can see the coordinate from a function invoked by the kernel - # breakpoint 6 - self.try_command( - 'break set -n half_helper', - ['librs.allocs.so`half_helper'] - ) - - # continue till we hit breakpoint 6 - self.assert_coord_stop('allocs', 'half_helper', x=0, y=1, z=2) - - self.try_command( - 'breakpoint list', - [ - "1: RenderScript kernel breakpoint for 'swizzle_kernel', locations = 1 Options: disabled", - "3: RenderScript kernel breakpoint for 'square_kernel', locations = 1 Options: disabled", - "4: RenderScript kernel breakpoint for 'add_half_kernel', locations = 1 Options: disabled", - "5: RenderScript kernel breakpoint for 'add_half_kernel', locations = 1 Options: disabled", - "6: name = 'half_helper', locations = 1, resolved = 1, hit count = 1" - ] - ) - - self.try_command('breakpoint delete 3', ['1 breakpoints deleted']) - - self.try_command( - 'breakpoint list', - [ - "1: RenderScript kernel breakpoint for 'swizzle_kernel', locations = 1 Options: disabled", - "4: RenderScript kernel breakpoint for 'add_half_kernel', locations = 1 Options: disabled", - "5: RenderScript kernel breakpoint for 'add_half_kernel', locations = 1 Options: disabled", - "6: name = 'half_helper', locations = 1, resolved = 1, hit count = 1" - ] - ) - - self.try_command('breakpoint delete 6', ['1 breakpoints deleted']) - - self.try_command( - 'breakpoint list', - [ - "1: RenderScript kernel breakpoint for 'swizzle_kernel', locations = 1 Options: disabled", - "4: RenderScript kernel breakpoint for 'add_half_kernel', locations = 1 Options: disabled", - "5: RenderScript kernel breakpoint for 'add_half_kernel', locations = 1 Options: disabled" - ] - ) - - @cpp_only_test() - @ordered_test('last') - def test_cpp_cleanup(self): - self.try_command('breakpoint delete 4', ['1 breakpoints deleted']) - self.try_command('breakpoint delete 5', ['1 breakpoints deleted']) - self.try_command('process continue', ['exited with status = 0']) diff --git a/tests/lldb/tests/testcases/test_breakpoint_fileline.py b/tests/lldb/tests/testcases/test_breakpoint_fileline.py deleted file mode 100644 index be89ca94..00000000 --- a/tests/lldb/tests/testcases/test_breakpoint_fileline.py +++ /dev/null @@ -1,66 +0,0 @@ -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -'''Module that contains the test TestBreakpointFileLine.''' - -from __future__ import absolute_import - -from harness.test_base_remote import TestBaseRemote -from harness.decorators import ( - cpp_only_test, - ordered_test -) - - -class TestBreakpointFileLine(TestBaseRemote): - '''Tests the setting of a breakpoint on a specific line of a RS file.''' - - bundle_target = { - 'java': 'JavaDebugWaitAttach', - 'jni': 'JNIDebugWaitAttach', - 'cpp': 'CppDebugWaitAttach' - } - - @ordered_test(0) - def test_breakpoint_fileline(self): - self.try_command('language renderscript status', - ['Runtime Library discovered', - 'Runtime Driver discovered']) - - self.try_command('breakpoint set --file simple.rs --line 28', - ['(pending)']) - - self.try_command('process continue', - []) - - self.try_command('bt', - ['librs.simple.so', - 'simple_kernel', - 'stop reason = breakpoint']) - - self.try_command('breakpoint list', - ['simple.rs', - 'resolved = 1']) - - self.try_command('process status', - ['stopped', - 'stop reason = breakpoint']) - - self.try_command('breakpoint delete 1', - ['1 breakpoints deleted']) - - @ordered_test('last') - @cpp_only_test() - def test_cpp_cleanup(self): - self.try_command('process continue', ['exited with status = 0']) diff --git a/tests/lldb/tests/testcases/test_breakpoint_fileline_multiple_rs_files.py b/tests/lldb/tests/testcases/test_breakpoint_fileline_multiple_rs_files.py deleted file mode 100644 index 9ba4283a..00000000 --- a/tests/lldb/tests/testcases/test_breakpoint_fileline_multiple_rs_files.py +++ /dev/null @@ -1,89 +0,0 @@ -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -'''Module that contains the test TestBreakpointFileLineMultipleRSFiles.''' - -from __future__ import absolute_import - -from harness.test_base_remote import TestBaseRemote -from harness.decorators import ( - cpp_only_test, - ordered_test -) - - -class TestBreakpointFileLineMultipleRSFiles(TestBaseRemote): - '''Tests the setting of a breakpoint on one of multiple RS files.''' - - bundle_target = { - 'java': 'MultipleRSFiles', - 'jni': 'JNIMultipleRSFiles', - 'cpp': 'CppMultipleRSFiles' - } - - def _binary_name(self): - return { - 'java': 'multiplersfiles', - 'jni': 'multiplersfiles', - 'cpp': 'CppMultipleRSFi' - }[self.app_type] - - @ordered_test(0) - def test_breakpoint_fileline_multiple_files(self): - self.try_command('language renderscript status', - ['Runtime Library discovered', - 'Runtime Driver discovered']) - - self.try_command('breakpoint set --file first.rs --line 28', - ['(pending)']) - - self.try_command('process continue', - ['stopped', - 'librs.first.so`first_kernel', - 'at first.rs:28', - "name = '%s'" % self._binary_name(), - 'stop reason = breakpoint 1']) - - self.try_command('breakpoint set --file second.rs --line 23', - ['Breakpoint 2', - 'librs.second.so`second_kernel', - 'second.rs:23']) - - self.try_command('breakpoint list', - ['first.rs', - 'second.rs', - 'resolved = 1', - 'first.rs:28', - 'second.rs:23']) - - self.try_command('breakpoint delete 1', - ['1 breakpoints deleted']) - - self.try_command('process continue', - ['stopped', - 'librs.second.so`second_kernel', - 'at second.rs:23', - "name = '%s'" % self._binary_name(), - 'stop reason = breakpoint 2']) - - self.try_command('process status', - ['stopped', - 'stop reason = breakpoint']) - - @cpp_only_test() - @ordered_test('last') - def test_cpp_cleanup(self): - self.try_command('breakpoint delete 2', ['1 breakpoints deleted']) - - self.try_command('process continue', ['exited with status = 0']) diff --git a/tests/lldb/tests/testcases/test_breakpoint_kernel_1.py b/tests/lldb/tests/testcases/test_breakpoint_kernel_1.py deleted file mode 100644 index a501b66c..00000000 --- a/tests/lldb/tests/testcases/test_breakpoint_kernel_1.py +++ /dev/null @@ -1,96 +0,0 @@ -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -'''Module that contains the test TestBreakpointKernel1.''' - -from __future__ import absolute_import - -from harness.test_base_remote import TestBaseRemote -from harness.decorators import ( - ordered_test, - cpp_only_test -) - - -class TestBreakpointKernel1(TestBaseRemote): - '''Tests the setting of a breakpoint on a RS kernel.''' - - bundle_target = { - 'java': 'JavaDebugWaitAttach', - 'jni': 'JNIDebugWaitAttach', - 'cpp': 'CppDebugWaitAttach' - } - - @ordered_test(0) - def test_breakpoint_set_nonexistent_kernel(self): - # pylint: disable=line-too-long - self.try_command('language renderscript status', - ['Runtime Library discovered', - 'Runtime Driver discovered']) - - self.try_command('language renderscript kernel breakpoint set simple_kernel', - ['Breakpoint(s) created', - '(pending)']) - - # Try set a breakpoint on a kernel which doesn't exist - self.try_command('language renderscript kernel breakpoint set imaginary_kernel', - ['Breakpoint(s) created', - '(pending)']) - - self.try_command('breakpoint list', - ["'simple_kernel', locations = 0 (pending)", - "'imaginary_kernel', locations = 0 (pending)"]) - - self.try_command('process continue', - ['resuming', - 'stopped', - 'stop reason = breakpoint']) - - self.try_command('bt', - ['stop reason = breakpoint', - 'frame #0:', - 'librs.simple.so', - 'simple_kernel']) - - self.try_command('breakpoint list', - ["'imaginary_kernel', locations = 0 (pending)", - "'simple_kernel', locations = 1, resolved = 1"]) - - @ordered_test(1) - def test_breakpoint_delete_nonexistent_kernel(self): - # Delete breakpoint on kernel which doesn't exist - self.try_command('breakpoint delete 2', - ['1 breakpoints deleted']) - - self.try_command('breakpoint list', - ["'simple_kernel', locations = 1, resolved = 1"]) - - self.try_command('process continue', - ['resuming', - 'stopped', - 'stop reason = breakpoint']) - - self.try_command('breakpoint list', - ["'simple_kernel', locations = 1, resolved = 1"]) - - self.try_command('breakpoint delete 1', - ['1 breakpoints deleted']) - - self.try_command('breakpoint list', - ['No breakpoints currently set']) - - @ordered_test('last') - @cpp_only_test() - def test_cpp_cleanup(self): - self.try_command('process continue', ['exited with status = 0']) diff --git a/tests/lldb/tests/testcases/test_breakpoint_kernel_2.py b/tests/lldb/tests/testcases/test_breakpoint_kernel_2.py deleted file mode 100644 index 6dea13fb..00000000 --- a/tests/lldb/tests/testcases/test_breakpoint_kernel_2.py +++ /dev/null @@ -1,55 +0,0 @@ -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -'''Module that contains the test TestBreakpointKernel2.''' - -from __future__ import absolute_import - -from harness.test_base_remote import TestBaseRemote - - -class TestBreakpointKernel2(TestBaseRemote): - '''Tests the setting of a breakpoint on a RS kernel.''' - - bundle_target = { - 'java': 'JavaInfiniteLoop', - 'jni': 'JNIInfiniteLoop', - 'cpp': 'CppInfiniteLoop' - } - - def test_breakpoint_resolution_simple_kernel(self): - # pylint: disable=line-too-long - self.try_command('language renderscript kernel breakpoint set simple_kernel', - ['Breakpoint(s) created']) - - self.try_command('process continue', - ['resuming', - 'stopped', - 'stop reason = breakpoint']) - - self.try_command('bt', - ['stop reason = breakpoint', - 'frame #0:', - 'librs.infiniteloop.so', - 'simple_kernel'], - [r'infiniteloop\.rs:4[34]']) - - self.try_command('breakpoint list', - ['simple_kernel', - 'resolved = 1']) - - self.try_command('process status', - ['stopped', - '.so`simple_kernel', - 'stop reason = breakpoint']) diff --git a/tests/lldb/tests/testcases/test_breakpoint_kernel_all.py b/tests/lldb/tests/testcases/test_breakpoint_kernel_all.py deleted file mode 100644 index ea988e4d..00000000 --- a/tests/lldb/tests/testcases/test_breakpoint_kernel_all.py +++ /dev/null @@ -1,94 +0,0 @@ -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -'''Module that contains the test TestBreakpointKernelAll.''' - -from __future__ import absolute_import - -from harness.test_base_remote import TestBaseRemote -from harness.decorators import ( - ordered_test, - cpp_only_test, -) - - -class TestBreakpointKernelAll(TestBaseRemote): - '''Tests setting breakpoints on every RS kernel.''' - - bundle_target = { - 'java': 'JavaDebugWaitAttach', - 'jni': 'JNIDebugWaitAttach', - 'cpp': 'CppDebugWaitAttach' - } - - @ordered_test(0) - def test_kernel_breakpoint_all_unloaded_kernels(self): - # Test command works with no kernels currently loaded - self.try_command('language renderscript kernel breakpoint all enable', - ['Breakpoints will be set on all kernels']) - - self.try_command('process continue', - ['resuming', - 'stopped', - 'stop reason = breakpoint']) - - self.try_command('breakpoint list', - ["'simple_kernel', locations = 1, resolved = 1", - "'other_kernel', locations = 1, resolved = 1"]) - - # Check disable doesn't delete breakpoints - self.try_command('language renderscript kernel breakpoint all disable', - ['Breakpoints will not be set on any new kernels']) - - # Delete all breakpoints manually - self.try_command('breakpoint delete 1', - ['1 breakpoints deleted']) - - self.try_command('breakpoint delete 2', - ['1 breakpoints deleted']) - - self.try_command('breakpoint list', - ["No breakpoints currently set"]) - - # Test command works when kernels are loaded - self.try_command('language renderscript kernel breakpoint all enable', - ['Breakpoints will be set on all kernels']) - - self.try_command('breakpoint list', - ["'simple_kernel', locations = 1, resolved = 1", - "'other_kernel', locations = 1, resolved = 1"]) - - self.try_command('process continue', - ['resuming', - 'stopped', - 'stop reason = breakpoint']) - - self.try_command('breakpoint delete 3', - ['1 breakpoints deleted']) - - # Check other_kernel breakpoint gets hit - self.try_command('breakpoint list', - ["'other_kernel', locations = 1, resolved = 1"]) - - self.try_command('process continue', - ['resuming', - 'stopped', - 'stop reason = breakpoint']) - - @ordered_test('last') - @cpp_only_test() - def test_cpp_cleanup(self): - self.try_command('breakpoint delete 4', ['1 breakpoints deleted']) - - self.try_command('process continue', ['exited with status = 0']) diff --git a/tests/lldb/tests/testcases/test_breakpoint_kernel_all_multiple_rs_files.py b/tests/lldb/tests/testcases/test_breakpoint_kernel_all_multiple_rs_files.py deleted file mode 100644 index 675b5a33..00000000 --- a/tests/lldb/tests/testcases/test_breakpoint_kernel_all_multiple_rs_files.py +++ /dev/null @@ -1,100 +0,0 @@ -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -'''Module that contains the test TestBreakpointKernelAllMultipleRSFiles.''' - -from __future__ import absolute_import - -from harness.test_base_remote import TestBaseRemote -from harness.decorators import ( - wimpy, - ordered_test, - cpp_only_test, -) - - -class TestBreakpointKernelAllMultipleRSFiles(TestBaseRemote): - '''Tests setting breakpoints on every RS kernel in multiple kernel files.''' - - bundle_target = { - 'java': 'MultipleRSFiles', - 'jni': 'JNIMultipleRSFiles', - 'cpp': 'CppMultipleRSFiles' - } - - @ordered_test(0) - def test_deferred_breakpoint_resolution(self): - # Test command works with no kernels currently loaded - self.try_command('language renderscript kernel breakpoint all enable', - ['Breakpoints will be set on all kernels']) - - self.try_command('process continue', - ['resuming', - 'stopped', - 'stop reason = breakpoint']) - - self.try_command('breakpoint list', - ["'first_kernel', locations = 1, resolved = 1", - "'second_kernel', locations = 1, resolved = 1"]) - - @ordered_test(1) - def test_disable_all_kernel_breakpoint_doesnt_delete_breakpoints(self): - # Check disable doesn't delete breakpoints - self.try_command('language renderscript kernel breakpoint all disable', - ['Breakpoints will not be set on any new kernels']) - - # Delete all breakpoints manually - self.try_command('breakpoint delete 1', - ['1 breakpoints deleted']) - - self.try_command('breakpoint delete 2', - ['1 breakpoints deleted']) - - self.try_command('breakpoint list', - ["No breakpoints currently set"]) - - @ordered_test(2) - def test_enable_breakpoint_on_loaded_kernels(self): - # Test command works when kernels are loaded - self.try_command('language renderscript kernel breakpoint all enable', - ['Breakpoints will be set on all kernels']) - - self.try_command('breakpoint list', - ["'first_kernel', locations = 1, resolved = 1", - "'second_kernel', locations = 1, resolved = 1"]) - - self.try_command('process continue', - ['resuming', - 'stopped', - 'stop reason = breakpoint']) - - self.try_command('breakpoint delete 3', - ['1 breakpoints deleted']) - - # Check other_kernel breakpoint gets hit - self.try_command('breakpoint list', - ["'second_kernel', locations = 1, resolved = 1"]) - - self.try_command('process continue', - ['resuming', - 'stopped', - 'stop reason = breakpoint']) - - @ordered_test('last') - @cpp_only_test() - def test_cpp_cleanup(self): - self.try_command('breakpoint delete 4', ['1 breakpoints deleted']) - - self.try_command('process continue', ['exited with status = 0']) - diff --git a/tests/lldb/tests/testcases/test_breakpoint_kernel_multiple_rs_files.py b/tests/lldb/tests/testcases/test_breakpoint_kernel_multiple_rs_files.py deleted file mode 100644 index 5cb29d0b..00000000 --- a/tests/lldb/tests/testcases/test_breakpoint_kernel_multiple_rs_files.py +++ /dev/null @@ -1,93 +0,0 @@ -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -'''Module that contains the test TestBreakpointKernelMultipleRSFiles.''' - -from __future__ import absolute_import - -from harness.test_base_remote import TestBaseRemote -from harness.decorators import ( - ordered_test, - cpp_only_test -) - - -class TestBreakpointKernelMultipleRSFiles(TestBaseRemote): - '''Tests the setting of a breakpoint on RS kernels in multiple files.''' - - bundle_target = { - 'java': 'MultipleRSFiles', - 'jni': 'JNIMultipleRSFiles', - 'cpp': 'CppMultipleRSFiles' - } - - def _binary_name(self): - return { - 'java': 'multiplersfiles', - 'jni': 'multiplersfiles', - 'cpp': 'CppMultipleRSFi' - }[self.app_type] - - def test_kernel_breakpoint_multiple_rs_files(self): - # pylint: disable=line-too-long - self.try_command('language renderscript kernel breakpoint set first_kernel', - ['Breakpoint(s) created', - '(pending)']) - - self.try_command('breakpoint list', - ["'first_kernel', locations = 0 (pending)"]) - - self.try_command('process continue', - ['stopped', - 'librs.first.so`first_kernel', - "name = '%s'" % self._binary_name(), - 'stop reason = breakpoint 1'], - [r'at first\.rs:2[678]']) - - self.try_command('breakpoint list', - ["'first_kernel', locations = 1, resolved = 1"]) - - self.try_command('language renderscript kernel breakpoint set second_kernel', - ['Breakpoint(s) created', - 'Breakpoint 2', - 'Breakpoint(s) created'], - [r"librs\.second\.so`second_kernel at second\.rs:2[012]",]) - - self.try_command('breakpoint list', - ["'first_kernel', locations = 1, resolved = 1", - "'second_kernel', locations = 1, resolved = 1"]) - - self.try_command('breakpoint delete 1', - ['1 breakpoints deleted']) - - self.try_command('breakpoint list', - ["'second_kernel', locations = 1, resolved = 1"]) - - self.try_command('process continue', - ['resuming', - 'stopped', - 'stop reason = breakpoint', - "librs.second.so`second_kernel"], - [r'second\.rs:2[012]']) - - self.try_command('breakpoint delete 2', - ['1 breakpoints deleted']) - - self.try_command('breakpoint list', - ['No breakpoints currently set']) - - @ordered_test('last') - @cpp_only_test() - def test_cpp_cleanup(self): - self.try_command('process continue', ['exited with status = 0']) diff --git a/tests/lldb/tests/testcases/test_call_api_funs.py b/tests/lldb/tests/testcases/test_call_api_funs.py deleted file mode 100644 index d94df3a9..00000000 --- a/tests/lldb/tests/testcases/test_call_api_funs.py +++ /dev/null @@ -1,197 +0,0 @@ -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -'''Module that contains the test TestCallApiFuns.''' - -from __future__ import absolute_import - -import re -import string - -from harness.test_base_remote import TestBaseRemote -from harness import RS_funs -from harness.decorators import ( - wimpy, - ordered_test, - cpp_only_test, -) - - -class _APIFunsExprTestsMeta(type): - """ - Generate unique, standalone test methods from a list of lldb expressions. - The lldb expression evaluation engine for calling RenderScript - builtins need to be tested thoroughly; rather than manually - write the 1000s of individual test cases, we automatically generate them - and their variants to add to the test class. This is done from a list - of expressions that are all tested in the same way. - """ - def __new__(self, name, bases, class_dict): - func_name_sub = re.compile(r'[%s\s]+' % string.punctuation) - - for count, line in enumerate(RS_funs.FUNC_LIST): - def make_test(line): - """ - We use an extra level of indirection here to properly - close over the *value* of the loop variable, `line` - """ - @ordered_test(count) - def test(self): - # build the expression - ret, expr = RS_funs.build_expr(line) - try: - # evaluate the expression with expected return value - self.try_command(expr, [], [RS_funs.TYPE_MAP[ret]]) - except KeyError: - # or just check the return type if no return value - # specified - self.try_command(expr, '(%s)' % ret) - return test - - # Make a pretty python method that adheres to the testcase standard - # Use the `count` parameter to ensure the name is unique in the class - test_name = 'test_%s_%s' % (re.sub(func_name_sub, '_', line), count) - test = make_test(line) - test.func_name = test_name - # We mark every 10th test case as runnable in wimpy mode - class_dict[test_name] = wimpy(test) if count % 10 == 0 else test - - return type(name, bases, class_dict) - - -class TestCallApiFuns(TestBaseRemote): - '''Tests calling of some RS API functions. This tests that JITing works.''' - - __metaclass__ = _APIFunsExprTestsMeta - - bundle_target = { - 'java': "KernelVariables", - 'jni': "JNIKernelVariables", - 'cpp': "CppKernelVariables" - } - - @wimpy - @ordered_test(-2) - def test_setup(self): - self.try_command('language renderscript status', - ['Runtime Library discovered', - 'Runtime Driver discovered']) - - self.try_command('b -f simple.rs -l 145', []) - - self.try_command('process continue', - ['resuming', - 'stopped', - 'stop reason = breakpoint']) - - @wimpy - @ordered_test(-1) - def test_call_api_funs_atomic(self): - # Test the atomics separately because we want to check the output - # AtomicAdd(1234, 2) - self.try_command('expr rsAtomicAdd(&int_global, 2)', - ['1234'], - [r'\(int(32_t)?\)']) - - self.try_command('expr int_global', - ['(int)', - '1236']) - - # AtomicAnd(2345, 333) - self.try_command('expr rsAtomicAnd(&uint_global, 333)', - ['2345'], - [r'\(int(32_t)?\)']) - - self.try_command('expr uint_global', - ['(uint)', - '265']) - - # AtomicCas(1236, 1236, 2345) - self.try_command('expr rsAtomicCas(&int_global, 1236, 2345)', - ['1236'], - [r'\(int(32_t)?\)']) - - self.try_command('expr int_global', - ['(int)', - '2345']) - - # AtomicDec(265) - self.try_command('expr rsAtomicDec(&uint_global)', - ['265'], - [r'\(int(32_t)?\)']) - - self.try_command('expr uint_global', - ['(uint)', - '264']) - - # AtomicInc(2345) - self.try_command('expr rsAtomicInc(&int_global)', - ['2345'], - [r'\(int(32_t)?\)']) - - self.try_command('expr int_global', - ['(int)', - '2346']) - - # AtomicMax(264, 3456) - self.try_command('expr rsAtomicMax(&uint_global, 3456)', - ['264'], - [r'\(uint(32_t)?\)']) - - self.try_command('expr uint_global', - ['(uint)', - '3456']) - - # AtomicMin(2346, 3) - self.try_command('expr rsAtomicMin(&int_global, 3)', - ['2346'], - [r'\(int(32_t)?\)']) - - self.try_command('expr int_global', - ['(int)', - '3']) - - # AtomicOr(3, 456) - self.try_command('expr rsAtomicOr(&int_global, 456)', - ['3'], - [r'\(int(32_t)?\)']) - - self.try_command('expr int_global', - ['(int)', - '459']) - - # AtomicSub(3456, 7) - self.try_command('expr rsAtomicSub(&uint_global, 7)', - ['3456'], - [r'\(int(32_t)?\)']) - - self.try_command('expr uint_global', - ['(uint)', - '3449']) - - # AtomicXor(459, 89) - self.try_command('expr rsAtomicXor(&int_global, 89)', - ['459'], - [r'\(int(32_t)?\)']) - - self.try_command('expr int_global', - ['(int)', - '402']) - - @ordered_test('last') - @cpp_only_test() - def test_cpp_cleanup(self): - self.try_command('breakpoint delete 1', ['1 breakpoints deleted']) - - self.try_command('process continue', ['exited with status = 0']) diff --git a/tests/lldb/tests/testcases/test_coordinates.py b/tests/lldb/tests/testcases/test_coordinates.py deleted file mode 100644 index 86807952..00000000 --- a/tests/lldb/tests/testcases/test_coordinates.py +++ /dev/null @@ -1,128 +0,0 @@ -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -'''Module that contains the test TestCoordinates.''' - -from __future__ import absolute_import - -from harness.test_base_remote import TestBaseRemote -from harness.decorators import ( - ordered_test, - cpp_only_test -) - - -class TestCoordinates(TestBaseRemote): - '''Tests the inspection of coordinates. - - Tests the inspection of the range and dimension of coordinates as well - as the current coordinates.''' - - bundle_target = { - 'java': 'JavaDebugWaitAttach', - 'jni': 'JNIDebugWaitAttach', - 'cpp': 'CppDebugWaitAttach' - } - - def setup(self, android): - '''This test requires to be run on one thread. - - Args: - android: The android_util module. - ''' - android.push_prop('debug.rs.max-threads', 1) - - def teardown(self, android): - '''Reset the number of RS threads to the previous value. - - Args: - android: The android_util module. - ''' - android.pop_prop('debug.rs.max-threads') - - @ordered_test(0) - def test_inspect_coordinates(self): - # pylint: disable=line-too-long - self.try_command('language renderscript status', - ['Runtime Library discovered', - 'Runtime Driver discovered']) - - self.try_command('language renderscript kernel breakpoint set simple_kernel', - ['Breakpoint(s) created', - '(pending)']) - - # Check the initial conditions. - self._lldb_continue() - self._inspect_coordinates(0, 0, 0) - - # Check two more steps. - self._lldb_continue() - self._inspect_coordinates(1, 0, 0) - self._lldb_continue() - self._inspect_coordinates(2, 0, 0) - - # After eight more steps we should have advanced one step in the y dimension. - for _ in range(8): - self._lldb_continue() - self._inspect_coordinates(2, 1, 0) - - @ordered_test('last') - @cpp_only_test() - def test_cpp_cleanup(self): - self.try_command('breakpoint delete 1', ['1 breakpoints deleted']) - - self.try_command('process continue', - ['exited with status = 0']) - - def _lldb_continue(self): - '''Try 'continue' lldb command. Expect to hit a breakpoint.''' - self.try_command('process continue', - ['resuming', - 'stopped', - 'stop reason = breakpoint']) - - def _inspect_coordinates(self, x_coord, y_coord, z_coord): - '''Run lldb commands to inspect kernel size and coordinates - and match against expected values. - - Args: - (x_coord, y_coord, z_coord): The expected coordinates (int triple) - - Raises: - TestFail: One of the lldb commands did not provide the expected - output. - ''' - self.try_command('language renderscript kernel coordinate', - ['Coordinate: (%d, %d, %d)' - % (x_coord, y_coord, z_coord)]) - - self.try_command('frame select 1', - ['librs.simple.so`simple_kernel.expand', - 'at generated.rs:1']) - - # Inspect the invocation length, should be the same every time. - self.try_command('expr p->dim', - ['x = 8', - 'y = 8', - 'z = 0']) - - # The X coordinate is in the rsIndex variable. - self.try_command('expr rsIndex', - ['= ' + str(x_coord)]) - - # Inspect the Y and Z coordinates. - self.try_command('expr p->current', - ['x = ' + str(0), - 'y = ' + str(y_coord), - 'z = ' + str(z_coord)]) diff --git a/tests/lldb/tests/testcases/test_dwarf_lang.py b/tests/lldb/tests/testcases/test_dwarf_lang.py deleted file mode 100644 index 08cf8599..00000000 --- a/tests/lldb/tests/testcases/test_dwarf_lang.py +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -'''Module that contains the test DWARF language attribute test.''' - -from __future__ import absolute_import - -from harness.test_base_remote import TestBaseRemote - - -class TestDWARFLang(TestBaseRemote): - '''Tests the DWARF language attribute is present in RenderScript kernels.''' - - bundle_target = { - 'java': 'JavaDebugWaitAttach', - 'jni': 'JNIDebugWaitAttach', - 'cpp': 'CppDebugWaitAttach' - } - - def test_renderscript_kernel_frame_dwarf_language(self): - self.try_command('language renderscript status', []) - self.try_command('b simple_kernel', []) - self.try_command('process continue', []) - - self.assert_lang_renderscript() diff --git a/tests/lldb/tests/testcases/test_invoke_fun.py b/tests/lldb/tests/testcases/test_invoke_fun.py deleted file mode 100644 index 26485582..00000000 --- a/tests/lldb/tests/testcases/test_invoke_fun.py +++ /dev/null @@ -1,69 +0,0 @@ -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -'''Module that contains the test TestInvokeFun.''' - -from __future__ import absolute_import - -from harness.test_base_remote import TestBaseRemote -from harness.decorators import ( - ordered_test, - cpp_only_test -) - - -class TestInvokeFun(TestBaseRemote): - '''Tests debugging a function executed from Java using invoke_*.''' - - bundle_target = { - 'java': 'BranchingFunCalls', - 'jni': 'JNIBranchingFunCalls', - 'cpp': 'CppBranchingFunCalls' - } - - def test_invoke_fun(self): - # pylint: disable=line-too-long - self.try_command('language renderscript status', - ['Runtime Library discovered', - 'Runtime Driver discovered']) - - self.try_command('breakpoint set --name addToGlobal', - ['Breakpoint 1', '(pending)']) - - self.try_command('process continue', - ['stopped', - 'stop reason = breakpoint'], - [r'scalars\.rs:7[345]']) - - self.try_command('language renderscript kernel breakpoint set simple_kernel', - ['Breakpoint 2', 'Breakpoint(s) created']) - - self.try_command('process continue', - ['stopped', - 'stop reason = breakpoint', - 'simple_kernel'], - [r'scalars\.rs:6[123]']) - - self.try_command('expr glob', - ['(int)', - '357']) - - @ordered_test('last') - @cpp_only_test() - def test_cpp_cleanup(self): - self.try_command('breakpoint delete 1', ['1 breakpoints deleted']) - - self.try_command('breakpoint delete 2', ['1 breakpoints deleted']) - - self.try_command('process continue', ['exited with status = 0']) diff --git a/tests/lldb/tests/testcases/test_language.py b/tests/lldb/tests/testcases/test_language.py deleted file mode 100644 index 84327810..00000000 --- a/tests/lldb/tests/testcases/test_language.py +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -'''Module that contains the test TestLanguage.''' - -from __future__ import absolute_import - -from harness.test_base import TestBaseNoTargetProcess - - -class TestLanguage(TestBaseNoTargetProcess): - ''' - Tests the "language" command and "language renderscript" subcommand. - ''' - - def test_lldb_has_language_commands(self): - ci = self._ci - self.assert_true( - ci.HasCommands() and - ci.CommandExists('language') - ) - - self.try_command('language', ['renderscript']) - self.try_command('language renderscript', ['kernel', - 'context', - 'module', - 'status']) - diff --git a/tests/lldb/tests/testcases/test_language_subcmds.py b/tests/lldb/tests/testcases/test_language_subcmds.py deleted file mode 100644 index 67c8bd17..00000000 --- a/tests/lldb/tests/testcases/test_language_subcmds.py +++ /dev/null @@ -1,162 +0,0 @@ -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -'''Module that contains the test TestLanguageSubcmds.''' - -from __future__ import absolute_import - -import os - -from harness.test_base_remote import TestBaseRemote -from harness.decorators import ( - cpp_only_test, - ordered_test, -) - - -class TestLanguageSubcmds(TestBaseRemote): - '''Tests the 'language renderscript' subcommands.''' - - bundle_target = { - 'java': 'JavaDebugWaitAttach', - 'jni': 'JNIDebugWaitAttach', - 'cpp': 'CppDebugWaitAttach' - } - - def setup(self, android): - '''This test requires to be run on one thread.''' - android.push_prop('debug.rs.max-threads', 1) - - def teardown(self, android): - '''Reset the number of RS threads to the previous value.''' - android.pop_prop('debug.rs.max-threads') - - def _pkg_name(self): - return { - 'java': 'com.android.rs.waitattachdebug', - 'jni': 'com.android.rs.jnidebugwaitattach', - 'cpp': 'com.android.rs.cppwaitattach' - }[self.app_type] - - def test_language_subcommands(self): - self.try_command('language', - []) - - self.try_command('language renderscript status', - ['Runtime Library discovered', - 'Runtime Driver discovered', - 'Runtime functions hooked', - 'rsdAllocationInit', - 'rsdAllocationRead2D', - 'rsdScriptInit', - 'rsdScriptInvokeForEach', - 'rsdScriptInvokeForEachMulti', - 'rsdScriptSetGlobalVar']) - - self.try_command('breakpoint set --file simple.rs --line 28', - ['(pending)']) - - self.try_command('process continue', - []) - - self.try_command('language renderscript kernel', - ['breakpoint', - 'coordinate', - 'list']) - - self.try_command('language renderscript kernel breakpoint', - ['all', - 'set']) - - self.try_command('language renderscript kernel list', - ['RenderScript Kernels', - "Resource 'simple'", - 'root', - 'simple_kernel']) - - self.try_command('language renderscript kernel coordinate', - ['Coordinate: (0, 0, 0)']) - - self.try_command('language renderscript context', - ['dump']) - - self.try_command('language renderscript context dump', - ['Inferred RenderScript Contexts', - '1 script instances']) - - self.try_command('language renderscript allocation', - ['list', - 'load', - 'save', - 'dump', - 'refresh']) - - self.try_command('language renderscript allocation list', - ['RenderScript Allocations:']) - - self.try_command('language renderscript allocation list -i 0', - ['RenderScript Allocations:']) - - self.try_command('language renderscript allocation list --id 0', - ['RenderScript Allocations:']) - - self.try_command('language renderscript allocation dump 1', - ['Data (X, Y, Z):']) - - output_file = self.get_tmp_file_path() - self.try_command('language renderscript allocation dump 1 -f ' + - output_file, - ["Results written to '%s'" % output_file]) - - if os.path.isfile(output_file): - os.remove(output_file) - - self.try_command('language renderscript allocation dump 1 --file ' + - output_file, - ["Results written to '%s'" % output_file]) - - self.try_command('language renderscript allocation save 1 ' + - output_file, - ["Allocation written to file '%s'" % output_file]) - - self.try_command('language renderscript allocation load 1 ' + - output_file, - ["Contents of file '%s' read into allocation 1" % - output_file]) - - self.try_command('language renderscript allocation refresh', - ['All allocations successfully recomputed']) - - self.try_command('language renderscript module', - ['dump']) - - self.try_command('language renderscript module dump', - ['RenderScript Modules:', - 'librs.simple.so', - 'Debug info loaded', - 'Globals: 1', - 'gColor - float4', - 'Kernels: 3', - 'root', - 'simple_kernel', - 'other_kernel', - 'java_package_name: %s' % self._pkg_name(), - 'version:']) - - @ordered_test('last') - @cpp_only_test() - def test_cpp_cleanup(self): - self.try_command('breakpoint delete 1', ['1 breakpoints deleted']) - - self.try_command('process continue', ['exited with status = 0']) diff --git a/tests/lldb/tests/testcases/test_language_subcmds_no_debug.py b/tests/lldb/tests/testcases/test_language_subcmds_no_debug.py deleted file mode 100644 index c57343de..00000000 --- a/tests/lldb/tests/testcases/test_language_subcmds_no_debug.py +++ /dev/null @@ -1,146 +0,0 @@ -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -'''Module that contains the test TestLanguageSubcmdsNoDebug.''' - -from __future__ import absolute_import - -import os - -from harness.test_base_remote import TestBaseRemote -from harness.decorators import ( - cpp_only_test, - ordered_test, -) - - -class TestLanguageSubcmdsNoDebug(TestBaseRemote): - '''Tests the 'language renderscript' subcommands without debug info. - - In particular, module dump should report missing debug info. - ''' - - bundle_target = { - 'java': 'JavaNoDebugWaitAttach', - 'jni': 'JNINoDebugWaitAttach', - 'cpp': 'CppNoDebugWaitAttach' - } - - def _pkg_name(self): - return { - 'java': 'com.android.rs.waitattachnodebug', - 'jni': 'com.android.rs.jninodebugwaitattach', - 'cpp': 'com.android.rs.cppwaitattach' - }[self.app_type] - - @ordered_test(0) - def test_language_subcommands_no_debug(self): - # pylint: disable=line-too-long - self.try_command('language renderscript status', - ['Runtime Library discovered', - 'Runtime Driver discovered']) - - self.try_command('language renderscript kernel breakpoint set simple_kernel' - '', - ['(pending)']) - - self.try_command('process continue', - []) - - self.try_command('language renderscript kernel', - ['breakpoint', - 'coordinate', - 'list']) - - self.try_command('language renderscript kernel list', - ['RenderScript Kernels', - "Resource 'simple'", - 'root', - 'simple_kernel']) - - self.try_command('language renderscript context', - ['dump']) - - self.try_command('language renderscript context dump', - ['Inferred RenderScript Contexts', - '1 script instances']) - - self.try_command('language renderscript allocation', - ['list', - 'load', - 'save', - 'dump', - 'refresh']) - - self.try_command('language renderscript allocation list', - ['RenderScript Allocations:']) - - self.try_command('language renderscript allocation list -i 0', - ['RenderScript Allocations:']) - - self.try_command('language renderscript allocation list --id 0', - ['RenderScript Allocations:']) - - self.try_command('language renderscript allocation dump 1', - ['Data (X, Y, Z):']) - - output_file = self.get_tmp_file_path() - self.try_command('language renderscript allocation dump 1 -f ' + - output_file, - ["Results written to '%s'" % output_file]) - - if os.path.isfile(output_file): - os.remove(output_file) - - self.try_command('language renderscript allocation dump 1 --file ' + - output_file, - ["Results written to '%s'" % output_file]) - - self.try_command('language renderscript allocation save 1 ' + - output_file, - ["Allocation written to file '%s'" % output_file]) - - self.try_command('language renderscript allocation load 1 ' + - output_file, - ["Contents of file '%s' read into allocation 1" % - output_file]) - - self.try_command('language renderscript allocation refresh', - ['All allocations successfully recomputed']) - - # C++ tests have an additional kernel `other_kernel` - kernel_count = 3 if self.app_type == 'cpp' else 2 - self.try_command('language renderscript module', - ['dump']) - - self.try_command('language renderscript module dump', - ['RenderScript Modules:', - 'librs.simple.so', - 'Debug info does not exist.', - 'Globals: 1', - 'gColor - variable identified, but not found in ' - 'binary (symbol exists)', - 'Kernels: %s' % kernel_count, - 'root', - 'simple_kernel', - '', - 'java_package_name: %s' % self._pkg_name(), - 'version']) - - @ordered_test('last') - @cpp_only_test() - def test_cpp_cleanup(self): - self.try_command('breakpoint delete 1', ['1 breakpoints deleted']) - - self.try_command('process continue', ['exited with status = 0']) diff --git a/tests/lldb/tests/testcases/test_multiple_rs_files.py b/tests/lldb/tests/testcases/test_multiple_rs_files.py deleted file mode 100644 index e0497f02..00000000 --- a/tests/lldb/tests/testcases/test_multiple_rs_files.py +++ /dev/null @@ -1,95 +0,0 @@ -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -'''Module that contains the test TestMultipleRSFiles.''' - -from __future__ import absolute_import - -from harness.test_base_remote import TestBaseRemote -from harness.decorators import ( - ordered_test, - cpp_only_test, -) - -class TestMultipleRSFiles(TestBaseRemote): - '''Tests some commands on an apk which has two rs files.''' - - bundle_target = { - 'java': 'MultipleRSFiles', - 'jni': 'JNIMultipleRSFiles', - 'cpp': 'CppMultipleRSFiles' - } - - def _binary_name(self): - return { - 'java': 'multiplersfiles', - 'jni': 'multiplersfiles', - 'cpp': 'CppMultipleRSFi' - }[self.app_type] - - def _pkg_name(self): - return { - 'java': 'com.android.rs.multiplersfiles', - 'jni': 'com.android.rs.jnimultiplersfiles', - 'cpp': 'com.android.rs.cppmultiplersfiles' - }[self.app_type] - - def test_multiple_rs_files(self): - self.try_command('language renderscript status', - ['Runtime Library discovered', - 'Runtime Driver discovered', - 'Runtime functions hooked']) - - self.try_command('breakpoint set --file first.rs --line 28', - ['(pending)']) - - self.try_command('process continue', - ['stopped', - 'librs.first.so`first_kernel', - 'at first.rs:28', - "name = '%s'" % self._binary_name(), - 'stop reason = breakpoint 1']) - - self.try_command('language renderscript kernel list', - ['RenderScript Kernels', - "Resource 'first'", - "Resource 'second'", - 'root', - 'first_kernel', - 'second_kernel']) - - self.try_command('language renderscript context dump', - ['Inferred RenderScript Contexts', - '2 script instances']) - - self.try_command('language renderscript module dump', - ['RenderScript Modules:', - 'librs.first.so', - 'librs.second.so', - 'Debug info loaded', - 'Globals: 1', - 'gColor - float4', - 'Kernels: 2', - 'root', - 'first_kernel', - 'second_kernel', - 'java_package_name: %s' % self._pkg_name(), - 'version:']) - - @ordered_test('last') - @cpp_only_test() - def test_cpp_cleanup(self): - self.try_command('breakpoint delete 1', ['1 breakpoints deleted']) - - self.try_command('process continue', ['exited with status = 0']) diff --git a/tests/lldb/tests/testcases/test_read_global.py b/tests/lldb/tests/testcases/test_read_global.py deleted file mode 100644 index 0a337e02..00000000 --- a/tests/lldb/tests/testcases/test_read_global.py +++ /dev/null @@ -1,344 +0,0 @@ -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -'''Module that contains the test TestReadGlobal.''' - -from __future__ import absolute_import - -from harness.test_base_remote import TestBaseRemote -from harness.decorators import ( - wimpy, - ordered_test, - cpp_only_test, -) - - -class TestReadGlobal(TestBaseRemote): - '''Tests inspecting global variables of all types.''' - - bundle_target = { - 'java': 'KernelVariables', - 'jni': 'JNIKernelVariables', - 'cpp': 'CppKernelVariables' - } - - def _try_inspecting_global(self, global_name, expected_output, - expected_regex=None): - '''Inspect a global and check for the output. - - Run the "expr" and "target variable" commands on a given global and - with a given output. (The commands should be equivalent.) - - Args: - global_name: String which is the name of the global to inspect. - expected_output: List of strings that should be found in the output. - expected_regex: List of regular expressions that should match lldb's - output. - - Raises: - TestFail: One of the lldb commands did not provide the expected - output. - ''' - self.try_command('expr ' + global_name, - expected_output, - expected_regex) - - self.try_command('target variable ' + global_name, - expected_output, - expected_regex) - - @wimpy - @ordered_test(0) - def test_setup(self): - self.try_command('language renderscript status', - ['Runtime Library discovered', - 'Runtime Driver discovered']) - - self.try_command('b -f simple.rs -l 145', []) - - self.try_command('process continue', - ['resuming', - 'stopped', - 'stop reason = breakpoint']) - - @wimpy - def test_list_script_globals(self): - # pylint: disable=line-too-long - - self.try_command('target variable', - ['Global variables for', - 'librs.simple.so', - "(uchar) uchar_global = '\\xea'", - '(short) short_global = -321', - '(ushort) ushort_global = 432', - '(int) int_global = 1234', - '(uint) uint_global = 2345', - '(float) float_global = 4.5', - '(ulong) ulong_global = 8888', - '(double) double_global = -456.5', - '(char2) char2_global = (11, -22)', - '(uchar2) uchar2_global = (0x21, 0x2c)', - '(short2) short2_global = (-555, 666)', - '(ushort2) ushort2_global = (777, 888)', - '(int2) int2_global = (999, -1111)', - '(uint2) uint2_global = (2222, 3333)', - '(float2) float2_global = (4.5, -5)', - '(long2) long2_global = (-4444, 5555)', - '(ulong2) ulong2_global = (6666, 7777)', - '(double2) double2_global = (88.5, -99)', - '(char3) char3_global = (11, -22, -33,', - '(uchar3) uchar3_global = (0x21, 0x2c, 0x37,', - '(short3) short3_global = (-555, 666, 777,', - '(ushort3) ushort3_global = (777, 888, 999,', - '(int3) int3_global = (999, -1111, 2222,', - '(uint3) uint3_global = (2222, 3333, 4444,', - '(float3) float3_global = (4.5, -5, -6.5,', - '(long3) long3_global = (-4444, 5555, 6666,', - '(ulong3) ulong3_global = (6666, 7777, 8888,', - '(double3) double3_global = (88.5, -99, 111.5,', - '(char4) char4_global = (55, 11, -22, -33)', - '(uchar4) uchar4_global = (0xde, 0x21, 0x2c, 0x37)', - '(short4) short4_global = (-444, -555, 666, 777)', - '(ushort4) ushort4_global = (666, 777, 888, 999)', - '(int4) int4_global = (888, 999, -1111, 2222)', - '(uint4) uint4_global = (1111, 2222, 3333, 4444)', - '(float4) float4_global = (3, 4.5, -5, -6.5)', - '(long4) long4_global = (-3333, -4444, 5555, 6666)', - '(ulong4) ulong4_global = (5555, 6666, 7777, 8888)', - '(double4) double4_global = (-77, 88.5, -99, 111.5)', - '(rs_matrix2x2) matrix2x2_global = (m = (1, 2.5, 3, 4.5))', - '(rs_matrix3x3) matrix3x3_global = {\n' - ' m = ([0] = 5, [1] = 6.5, [2] = 7, [3] = 8.5, [4] = 9, [5] = 1.5, [6] = 2, [7] = 3.5, [8] = 4)', - '(rs_matrix4x4) matrix4x4_global = {\n' - ' m = {\n' - ' [0] = 5.5\n' - ' [1] = 6\n' - ' [2] = 7.5\n' - ' [3] = 8\n' - ' [4] = 9\n' - ' [5] = 1.5\n' - ' [6] = 2\n' - ' [7] = 3.5\n' - ' [8] = 4.5\n' - ' [9] = 5.5\n' - ' [10] = 6.5\n' - ' [11] = 7\n' - ' [12] = 8\n' - ' [13] = 9.5\n' - ' [14] = 1.5\n' - ' [15] = 2.5\n' - ' }\n', - '(rs_quaternion) quaternion_global = (4.5, 5.5, 6, 3)'], - [r"\((signed )?char\) char_global = '\\f'", - r'\((long )?long\) long_global = -77777']) - - @wimpy - def test_read_char_global(self): - # Use expr to inspect locals - self._try_inspecting_global('char_global', - ["'\\f'"], - [r'\((signed )?char\)']) - - def test_read_primitive_global(self): - self._try_inspecting_global('uchar_global', - ['(uchar)', "'\\xea'"]) - - self._try_inspecting_global('short_global', - ['(short)', '-321']) - - self._try_inspecting_global('ushort_global', - ['(ushort)', '432']) - - self._try_inspecting_global('int_global', - ['(int)', '1234']) - - self._try_inspecting_global('uint_global', - ['(uint)', '2345']) - - self._try_inspecting_global('float_global', - ['(float)', '4.5']) - - self._try_inspecting_global('long_global', - ['-77777'], - [r'\((long )?long\)']) - - self._try_inspecting_global('ulong_global', - ['(ulong)', '8888']) - - self._try_inspecting_global('double_global', - ['(double)', '-456.5']) - - self._try_inspecting_global('char2_global', - ['(char2)', '(11, -22)']) - - @wimpy - def test_write_global2(self): - self._try_inspecting_global('uchar2_global', - ['(uchar2)', '(0x21, 0x2c)']) - - def test_write_global3(self): - self._try_inspecting_global('short2_global', - ['(short2)', '(-555, 666)']) - - self._try_inspecting_global('ushort2_global', - ['(ushort2)', '(777, 888)']) - - self._try_inspecting_global('int2_global', - ['(int2)', '(999, -1111)']) - - self._try_inspecting_global('uint2_global', - ['(uint2)', '(2222, 3333)']) - - self._try_inspecting_global('float2_global', - ['(float2)', '(4.5, -5)']) - - self._try_inspecting_global('long2_global', - ['(long2)', '(-4444, 5555)']) - - self._try_inspecting_global('ulong2_global', - ['(ulong2)', '(6666, 7777)']) - - self._try_inspecting_global('double2_global', - ['(double2)', '(88.5, -99)']) - - self._try_inspecting_global('char3_global', - ['(char3)', - '(11, -22, -33,']) - - self._try_inspecting_global('uchar3_global', - ['(uchar3)', - '(0x21, 0x2c, 0x37,']) - - @wimpy - def test_global_write_short3(self): - self._try_inspecting_global('short3_global', - ['(short3)', - '(-555, 666, 777,']) - - def test_read_vec3(self): - self._try_inspecting_global('ushort3_global', - ['(ushort3)', - '(777, 888, 999,']) - - self._try_inspecting_global('int3_global', - ['(int3)', - '(999, -1111, 2222,']) - - self._try_inspecting_global('uint3_global', - ['(uint3)', - '(2222, 3333, 4444,']) - - self._try_inspecting_global('float3_global', - ['(float3)', - '(4.5, -5, -6.5,']) - - self._try_inspecting_global('long3_global', - ['(long3)', - '(-4444, 5555, 6666,']) - - self._try_inspecting_global('ulong3_global', - ['(ulong3)', - '(6666, 7777, 8888,']) - - self._try_inspecting_global('double3_global', - ['(double3)', - '(88.5, -99, 111.5,']) - - self._try_inspecting_global('char4_global', - ['(char4)', - '(55, 11, -22, -33)']) - - self._try_inspecting_global('uchar4_global', - ['(uchar4)', - '(0xde, 0x21, 0x2c, 0x37)']) - - self._try_inspecting_global('short4_global', - ['(short4)', - '(-444, -555, 666, 777)']) - - @wimpy - def test_read_ushort4(self): - self._try_inspecting_global('ushort4_global', - ['(ushort4)', - '(666, 777, 888, 999)']) - - def test_read_vec4(self): - self._try_inspecting_global('int4_global', - ['(int4)', - '(888, 999, -1111, 2222)']) - - self._try_inspecting_global('uint4_global', - ['(uint4)', - '(1111, 2222, 3333, 4444)']) - - self._try_inspecting_global('float4_global', - ['(float4)', - '(3, 4.5, -5, -6.5)']) - - self._try_inspecting_global('long4_global', - ['(long4)', - '(-3333, -4444, 5555, 6666)']) - - self._try_inspecting_global('ulong4_global', - ['(ulong4)', - '(5555, 6666, 7777, 8888)']) - - self._try_inspecting_global('double4_global', - ['(double4)', - '(-77, 88.5, -99, 111.5)']) - - self._try_inspecting_global('matrix2x2_global', - ['(rs_matrix2x2)', - '= (m = (1, 2.5, 3, 4.5))']) - - self._try_inspecting_global('matrix3x3_global', - ['(rs_matrix3x3)', - '= {\n' - ' m = ([0] = 5, [1] = 6.5, [2] = 7, [3] = 8.5, [4] = 9, [5] = 1.5, [6] = 2, [7] = 3.5, [8] = 4)']) - @wimpy - def test_read_matrix(self): - self._try_inspecting_global('matrix4x4_global', - ['(rs_matrix4x4)', - '= {\n' - ' m = {\n' - ' [0] = 5.5\n' - ' [1] = 6\n' - ' [2] = 7.5\n' - ' [3] = 8\n' - ' [4] = 9\n' - ' [5] = 1.5\n' - ' [6] = 2\n' - ' [7] = 3.5\n' - ' [8] = 4.5\n' - ' [9] = 5.5\n' - ' [10] = 6.5\n' - ' [11] = 7\n' - ' [12] = 8\n' - ' [13] = 9.5\n' - ' [14] = 1.5\n' - ' [15] = 2.5\n' - ' }\n']) - - @wimpy - def test_read_quaternion(self): - self._try_inspecting_global('quaternion_global', - ['(rs_quaternion)', - '(4.5, 5.5, 6, 3)']) - - @ordered_test('last') - @cpp_only_test() - def test_cpp_cleanup(self): - self.try_command('breakpoint delete 1', ['1 breakpoints deleted']) - - self.try_command('process continue', ['exited with status = 0']) diff --git a/tests/lldb/tests/testcases/test_read_local.py b/tests/lldb/tests/testcases/test_read_local.py deleted file mode 100644 index 9a6a80fd..00000000 --- a/tests/lldb/tests/testcases/test_read_local.py +++ /dev/null @@ -1,344 +0,0 @@ -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -'''Module that contains the test TestReadLocal.''' - -from __future__ import absolute_import - -from harness.test_base_remote import TestBaseRemote -from harness.decorators import ( - wimpy, - ordered_test, - skip_conditional, - cpp_only_test -) - - -class TestReadLocal(TestBaseRemote): - '''Tests inspecting local variables of all types.''' - - bundle_target = { - 'java': 'KernelVariables', - 'jni': 'JNIKernelVariables', - 'cpp': 'CppKernelVariables' - } - - def _try_inspecting_local(self, local_name, expected_output, - expected_regex=None): - '''Inspect a local and check for the output. - - Run the "expr" and "frame variable" commands on a given local and - with a given output. (The commands should be equivalent.) - - Args: - local_name: String which is the name of the global to inspect. - expected_output: List of strings that should be found in the output. - expected_regex: List of regular expressions that should match lldb's - output. - - Raises: - TestFail: One of the lldb commands did not provide the expected - output. - ''' - self.try_command('expr ' + local_name, - expected_output, - expected_regex) - - self.try_command('frame variable ' + local_name, - expected_output, - expected_regex) - - @wimpy - @ordered_test(0) - def test_setup(self): - self.try_command('language renderscript status', - ['Runtime Library discovered', - 'Runtime Driver discovered']) - - self.try_command('breakpoint set --file simple.rs --line 145', []) - - self.try_command('process continue', - ['resuming', - 'stopped', - 'stop reason = breakpoint']) - - @wimpy - def test_list_rs_kernel_frame_variables(self): - # pylint: disable=line-too-long - - self.try_command('frame variable', - ["(uchar) uchar_local = 'b'", - '(short) short_local = -321', - '(ushort) ushort_local = 432', - '(int) int_local = 1234', - '(uint) uint_local = 2345', - '(float) float_local = 4.5', - '(ulong) ulong_local = 8888', - '(double) double_local = -456.5', - '(char2) char2_local = (-11, -22)', - '(uchar2) uchar2_local = (0x21, 0x2c)', - '(short2) short2_local = (-555, 666)', - '(ushort2) ushort2_local = (777, 888)', - '(int2) int2_local = (999, -1111)', - '(uint2) uint2_local = (2222, 3333)', - '(float2) float2_local = (4.5, -5)', - '(long2) long2_local = (-4444, 5555)', - '(ulong2) ulong2_local = (6666, 7777)', - '(double2) double2_local = (88.5, -99)', - '(char3) char3_local = (11, -22, -33,', - '(uchar3) uchar3_local = (0x21, 0x2c, 0x37,', - '(short3) short3_local = (-555, 666, 777,', - '(ushort3) ushort3_local = (777, 888, 999,', - '(int3) int3_local = (999, -1111, 2222,', - '(uint3) uint3_local = (2222, 3333, 4444,', - '(float3) float3_local = (4.5, -5, -6.5,', - '(long3) long3_local = (-4444, 5555, 6666,', - '(ulong3) ulong3_local = (6666, 7777, 8888,', - '(double3) double3_local = (88.5, -99, 111.5,', - '(char4) char4_local = (55, 11, -22, -33)', - '(uchar4) uchar4_local = (0x16, 0x21, 0x2c, 0x37)', - '(short4) short4_local = (-444, -555, 666, 777)', - '(ushort4) ushort4_local = (666, 777, 888, 999)', - '(int4) int4_local = (888, 999, -1111, 2222)', - '(uint4) uint4_local = (1111, 2222, 3333, 4444)', - '(float4) float4_local = (3, 4.5, -5, -6.5)', - '(long4) long4_local = (-3333, -4444, 5555, 6666)', - '(ulong4) ulong4_local = (5555, 6666, 7777, 8888)', - '(double4) double4_local = (-77, 88.5, -99, 111.5)', - '(rs_matrix2x2) matrix2x2_local = (m = (1, 2.5, 3, 4.5))', - '(rs_matrix3x3) matrix3x3_local = {\n' - ' m = ([0] = 5, [1] = 6.5, [2] = 7, [3] = 8.5, [4] = 9, [5] = 1.5, [6] = 2, [7] = 3.5, [8] = 4)', - '(rs_matrix4x4) matrix4x4_local = {\n' - ' m = {\n' - ' [0] = 5.5\n' - ' [1] = 6\n' - ' [2] = 7.5\n' - ' [3] = 8\n' - ' [4] = 9\n' - ' [5] = 1.5\n' - ' [6] = 2\n' - ' [7] = 3.5\n' - ' [8] = 4.5\n' - ' [9] = 5.5\n' - ' [10] = 6.5\n' - ' [11] = 7\n' - ' [12] = 8\n' - ' [13] = 9.5\n' - ' [14] = 1.5\n' - ' [15] = 2.5\n' - ' }\n', - '(rs_quaternion) quaternion_local = (8, 9, 0.5, 7.5)'], - [r"\((signed )?char\) char_local = 'a'", - r'\((long )?long\) long_local = -77777']) - - - @wimpy - def test_inspect_primitive_types(self): - # Use expr to inspect locals - self._try_inspecting_local('char_local', - ["'a'"], - [r'\((signed )?char\)']) - - self._try_inspecting_local('uchar_local', - ['(uchar)', "'b'"]) - - self._try_inspecting_local('short_local', - ['(short)', '-321']) - - self._try_inspecting_local('ushort_local', - ['(ushort)', '432']) - - self._try_inspecting_local('int_local', - ['(int)', '1234']) - - self._try_inspecting_local('uint_local', - ['(uint)', '2345']) - - self._try_inspecting_local('float_local', - ['(float)', '4.5']) - - self._try_inspecting_local('long_local', - ['-77777'], [r'\((long )?long\)']) - - self._try_inspecting_local('ulong_local', - ['(ulong)', '8888']) - - self._try_inspecting_local('double_local', - ['(double)', '-456.5']) - - - @wimpy - def test_inspect_uchar2(self): - self._try_inspecting_local('uchar2_local', - ['(uchar2)', '(0x21, 0x2c)']) - - def test_inspect_vec2_types(self): - self._try_inspecting_local('char2_local', - ['(char2)', '(-11, -22)']) - - self._try_inspecting_local('short2_local', - ['(short2)', '(-555, 666)']) - - self._try_inspecting_local('ushort2_local', - ['(ushort2)', '(777, 888)']) - - self._try_inspecting_local('int2_local', - ['(int2)', '(999, -1111)']) - - self._try_inspecting_local('uint2_local', - ['(uint2)', '(2222, 3333)']) - - self._try_inspecting_local('float2_local', - ['(float2)', '(4.5, -5)']) - - self._try_inspecting_local('long2_local', - ['(long2)', '(-4444, 5555)']) - - self._try_inspecting_local('ulong2_local', - ['(ulong2)', '(6666, 7777)']) - - self._try_inspecting_local('double2_local', - ['(double2)', '(88.5, -99)']) - - self._try_inspecting_local('char3_local', - ['(char3)', - '(11, -22, -33,']) - - self._try_inspecting_local('uchar3_local', - ['(uchar3)', - '(0x21, 0x2c, 0x37,']) - - @wimpy - def test_inspect_short3(self): - self._try_inspecting_local('short3_local', - ['(short3)', - '(-555, 666, 777,']) - - def test_inspect_vec3_types(self): - self._try_inspecting_local('ushort3_local', - ['(ushort3)', - '(777, 888, 999,']) - - self._try_inspecting_local('int3_local', - ['(int3)', - '(999, -1111, 2222,']) - - self._try_inspecting_local('uint3_local', - ['(uint3)', - '(2222, 3333, 4444,']) - - self._try_inspecting_local('float3_local', - ['(float3)', - '(4.5, -5, -6.5,']) - - self._try_inspecting_local('long3_local', - ['(long3)', - '(-4444, 5555, 6666,']) - - self._try_inspecting_local('ulong3_local', - ['(ulong3)', - '(6666, 7777, 8888,']) - - self._try_inspecting_local('double3_local', - ['(double3)', - '(88.5, -99, 111.5,']) - - self._try_inspecting_local('char4_local', - ['(char4)', - '(55, 11, -22, -33)']) - - self._try_inspecting_local('uchar4_local', - ['(uchar4)', - '(0x16, 0x21, 0x2c, 0x37)']) - - self._try_inspecting_local('short4_local', - ['(short4)', - '(-444, -555, 666, 777)']) - - @wimpy - def test_inspect_ushort4(self): - self._try_inspecting_local('ushort4_local', - ['(ushort4)', - '(666, 777, 888, 999)']) - - def test_inspect_vec4_types(self): - self._try_inspecting_local('int4_local', - ['(int4)', - '(888, 999, -1111, 2222)']) - - self._try_inspecting_local('uint4_local', - ['(uint4)', - '(1111, 2222, 3333, 4444)']) - - self._try_inspecting_local('float4_local', - ['(float4)', - '(3, 4.5, -5, -6.5)']) - - self._try_inspecting_local('long4_local', - ['(long4)', - '(-3333, -4444, 5555, 6666)']) - - self._try_inspecting_local('ulong4_local', - ['(ulong4)', - '(5555, 6666, 7777, 8888)']) - - self._try_inspecting_local('double4_local', - ['(double4)', - '(-77, 88.5, -99, 111.5)']) - def test_inspect_matrix_types(self): - self._try_inspecting_local('matrix2x2_local', - ['(rs_matrix2x2)', - '= (m = (1, 2.5, 3, 4.5))']) - - self._try_inspecting_local('matrix3x3_local', - ['(rs_matrix3x3)', - '= {\n' - ' m = ([0] = 5, [1] = 6.5, [2] = 7, [3] = 8.5, [4] = 9, [5] = 1.5, [6] = 2, [7] = 3.5, [8] = 4)']) - - @wimpy - def test_inspect_matrix_4x4_local(self): - self._try_inspecting_local('matrix4x4_local', - ['(rs_matrix4x4)', - '= {\n' - ' m = {\n' - ' [0] = 5.5\n' - ' [1] = 6\n' - ' [2] = 7.5\n' - ' [3] = 8\n' - ' [4] = 9\n' - ' [5] = 1.5\n' - ' [6] = 2\n' - ' [7] = 3.5\n' - ' [8] = 4.5\n' - ' [9] = 5.5\n' - ' [10] = 6.5\n' - ' [11] = 7\n' - ' [12] = 8\n' - ' [13] = 9.5\n' - ' [14] = 1.5\n' - ' [15] = 2.5\n' - ' }\n']) - - @wimpy - def test_inspect_quaternion_local(self): - self._try_inspecting_local('quaternion_local', - ['(rs_quaternion)', - '(8, 9, 0.5, 7.5)']) - - @ordered_test('last') - @cpp_only_test() - def test_cpp_cleanup(self): - self.try_command('breakpoint delete 1', ['1 breakpoints deleted']) - - self.try_command('process continue', ['exited with status = 0']) diff --git a/tests/lldb/tests/testcases/test_reduction.py b/tests/lldb/tests/testcases/test_reduction.py deleted file mode 100644 index 9653c020..00000000 --- a/tests/lldb/tests/testcases/test_reduction.py +++ /dev/null @@ -1,279 +0,0 @@ -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from __future__ import absolute_import - -import itertools - -from harness.test_base_remote import TestBaseRemote -from harness.decorators import ( - ordered_test, - wimpy, -) -from harness.assert_mixins import CoordinateAssertionsMixin - -from reduce_common import ( - REDUCE_ITERATIONS, - REDUCE_STARTVAL, - REDUCE_SCRIPT, - X_TESTS, - Y_TESTS, - Z_TESTS, - ReductionMixin, -) - - -def coords_range_3d(x_range, y_range, z_range): - count = max((x_range, y_range, z_range)) - x = itertools.cycle(range(x_range)) - y = itertools.cycle(range(y_range)) - z = itertools.cycle(range(z_range)) - return itertools.islice( - itertools.izip(x, y, z), - count - ) - - -class TestReduce1DSingleThreaded( - TestBaseRemote, CoordinateAssertionsMixin, ReductionMixin): - """ - Reduction kernels for RenderScript are launched using - a different `.expand` function than regular `ForEach` kernels and reflect a - different API to the invoking program - - Although the debugger implementation for accessing these features tracks - this slightly differently for reduction kernels, the user interface should - still offer the basic functionality: - - breakpoints on a coordinate - - tracking, viewing and dumping allocations - - listing modules and constituent kernels and types - """ - - bundle_target = { - 'java': 'Reduction', - } - - def _delete_breakpoints(self): - try: - self.do_command('breakpoint delete -f') - except self.TestFail: - pass - - def setup(self, android): - """This test requires to be run on one thread.""" - android.push_prop('debug.rs.max-threads', 1) - - def teardown(self, android): - """Reset the number of RS threads to the previous value.""" - android.pop_prop('debug.rs.max-threads') - - @ordered_test(0) - @wimpy - def test_setup(self): - self.try_command('language renderscript status', []) - self.try_command('b find_min_user_type_accum', []) - self.try_command('c', []) - - @ordered_test(1) - @wimpy - def test_renderscript_module_dump(self): - """ - Generalised Reduction kernels for RenderScript are not tracked in the - same way as `ForEach` kernels, and do not have `__attribute__((kernel))` - so we need to make sure that when a module contains reduction kernels, - `language renderscript module dump` in lldb prints the correct kernels. - """ - self.try_command( - 'language renderscript module dump', - [ - 'Reductions: 1', - 'find_min_user_type', - 'accumulator: find_min_user_type_accum', - 'combiner: find_min_user_type_comb', - 'outconverter: find_min_user_type_outc' - ] - ) - - @ordered_test(2) - @wimpy - def test_module_dump_with_foreach_kernel_separate(self): - """ - The reduction breakpoint is separate from that of a standard kernel - function breakpoint, so we need to make sure that when we dump a module, - reductions are properly collected and displayed alongside the standard - __attribute__((kernel)) functions. - Assert that `... module dump` can correctly distinguish between `reduce` - kernels and `ForEach` kernels. - """ - self.try_command( - 'language renderscript module dump', - [ - 'Kernels: 2', - 'Reductions: 1', - 'accumulator: find_min_user_type_accum', - 'initializer: find_min_user_type_init', - 'combiner: find_min_user_type_comb', - 'outconverter: find_min_user_type_outc' - ] - ) - - @wimpy - @ordered_test(3) - def test_reduction_breakpoint_set_all_roles_resolved(self): - """ - Assert that a reduction breakpoint successfully resolves all the - functions that make up the reduction kernel - """ - self.try_command( - 'language renderscript reduction breakpoint set find_min_user_type', - ['Breakpoint(s) created'] - ) - - self.try_command( - 'process continue', - expected_regex=[ - r'Process \d+ stopped', - r'librs.reduce.so`find_min_user_type', - r'stop reason = breakpoint' - ] - ) - name = REDUCE_SCRIPT - self.try_command( - 'breakpoint list', - expected_regex=[ - "RenderScript reduce breakpoint for 'find_min_user_type', locations = 4, resolved = 4", - 'where = librs.reduce.so`find_min_user_type_init (\+ \d+ )?at %s(.+, resolved,)' % name, - 'where = librs.reduce.so`find_min_user_type_accum (\+ \d+ )?at %s(.+, resolved,)' % name, - 'where = librs.reduce.so`find_min_user_type_comb (\+ \d+ )?at %s(.+, resolved,)' % name, - 'where = librs.reduce.so`find_min_user_type_outc (\+ \d+ )?at %s(.+, resolved,)' % name, - ] - ) - - @ordered_test(4) - def test_reduce_iterations(self): - """ - Given a reduction, we want to make sure that we break on - every accumulator invocation before seeing the outconverter called. - This requires the tests to be run single threaded - """ - self._delete_breakpoints() - self.try_command( - 'language renderscript reduction breakpoint set find_min_user_type -t initializer', - ) - self.try_command( - 'process continue', - expected_regex=[ - r'Process \d+ stopped', - r'librs.reduce.so`find_min_user_type_init', - r'stop reason = breakpoint', - ] - ) - self._delete_breakpoints() - - self.try_command(( - 'language renderscript reduction breakpoint ' - 'set find_min_user_type --function-role accumulator,outconverter'), - ['Breakpoint(s) created'] - ) - for i in range(REDUCE_ITERATIONS): - self.try_command( - 'process continue', - expected_regex=[ - r'Process \d+ resuming', - r'Process \d+ stopped', - r'librs.reduce.so`find_min_user_type_accum', - r'stop reason = breakpoint' - ] - ) - self.try_command('p val') - self.try_command( - 'p val.b', - expected_regex=[ - r'^\((const )?int32_t\)\s*\$\d+ = %s\s*$' % ( - i + REDUCE_STARTVAL) - ] - ) - # We should then finally break on the outconverter - self.try_command( - 'process continue', - expected_regex=[ - r'Process \d+ resuming', - r'Process \d+ stopped', - r'librs.reduce.so`find_min_user_type_outc', - r'stop reason = breakpoint' - ] - ) - - @ordered_test(5) - def test_function_role_breakpoints_combinations(self): - func_role_combinations = itertools.combinations( - ('accumulator', 'initializer'), - r=2 - ) - self._test_func_role_combinations(func_role_combinations) - - @wimpy - @ordered_test(6) - def test_resolve_function_role_all_reduce_functions(self): - """ - Assert that a reduction breakpoint successfully resolves all the - functions that make up the reduction kernel when the parameter `all` is - passed to `--function-role` for the breakpoint command - """ - self._delete_breakpoints() - self.try_command( - 'language renderscript reduction breakpoint set find_min_user_type -t all', - [r'Breakpoint(s) created'] - ) - self.try_command('c', []) - breakpoints_match = [ - r"where = librs.reduce.so`%s (\+ \d+ )?at %s:\d+, address = 0x[0-9a-fA-F]+, resolved" % ( - 'find_min_user_type_%s' % func_match, - REDUCE_SCRIPT - ) - for func_match in ('accum', 'init', 'comb', 'outc') - ] - self.try_command( - 'breakpoint list', - expected_regex=[ - r"Current breakpoints:", - r"RenderScript reduce breakpoint for 'find_min_user_type', locations = 4, resolved = 4", - r"Names:", - r"RenderScriptReduction", - ] + breakpoints_match - ) - - @ordered_test(8) - def test_reduce_breakpoint_conditional_1d_coordinate(self): - """ - Assert that breakpoints conditional on an allocation coordinate - are only triggered on that coordinate - """ - for x, _, __ in sorted(coords_range_3d(X_TESTS, Y_TESTS, Z_TESTS)): - self._delete_breakpoints() - self.assert_coord_bp_set( - 'find_min_user_type -t accumulator', - x, - kernel_type='reduction' - ) - self.assert_coord_stop('reduce', 'find_min_user_type', x) - # Step *into* the function so locals are available - # FIXME remove the need for `next` here; skip the function prologue - self.try_command('n') - self.try_command('p accum->a') - self.try_command('p accum->b') - - @ordered_test('last') - def test_exit(self): - self.try_command('process kill', []) diff --git a/tests/lldb/tests/testcases/test_reduction_combiner.py b/tests/lldb/tests/testcases/test_reduction_combiner.py deleted file mode 100644 index c070f3b3..00000000 --- a/tests/lldb/tests/testcases/test_reduction_combiner.py +++ /dev/null @@ -1,134 +0,0 @@ -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from __future__ import absolute_import - -import re -import itertools - -from harness.test_base_remote import TestBaseRemote -from harness.decorators import ( - ordered_test, - wimpy, - skip_conditional, -) -from harness.assert_mixins import CoordinateAssertionsMixin - -from reduce_common import ( - REDUCE_SCRIPT, - REDUCE_AUTO_COMB_SCRIPT, - ReductionMixin, -) - - -multithreaded = lambda: skip_conditional( - lambda self: self.cpu_count == 1, - "skipping multithreaded test (1 CPU present)" -) - - -class TestReduceCombinerMultithreaded( - TestBaseRemote, CoordinateAssertionsMixin, ReductionMixin): - """ - RenderScript reduction combiners are currently run only on the output of a - parallel reduction step for the CPU reference implementation. These - testcases test LLDB's handling of breakpoints for the combiner function. - """ - - bundle_target = { - 'java': 'Reduction', - } - - def _delete_breakpoints(self): - try: - self.do_command('breakpoint delete -f') - except self.TestFail: - pass - - def setup(self, android): - """ - This test *must* be run on multiple threads, and is skipped if the - device does not support multiple threads - """ - cpu_spec = android.shell("cat /sys/devices/system/cpu/online").strip() - match = re.search(r'(^0(-\d+)?(,\d+([-]\d*)?)*)$', cpu_spec) - if not match or not match.groups(): - raise self.TestFail( - "unable to parse number of available CPUs in %r" % cpu_spec) - - def parse_range(s): - r = s.split('-') - if len(r) == 1: - return 1 - return int(r[1]) - int(r[0]) - - self.cpu_count = sum(map(parse_range, cpu_spec.split(','))) - android.push_prop('debug.rs.max-threads', self.cpu_count + 1) - - def teardown(self, android): - """Reset the number of RS threads to the previous value.""" - android.pop_prop('debug.rs.max-threads') - - @multithreaded() - @ordered_test(0) - @wimpy - def test_setup(self): - self.try_command('language renderscript status', []) - # first point of order: make sure the compiled script is properly - # loaded and that we can set a breakpoint on the named reduction - self.try_command( - 'language renderscript reduction breakpoint set find_min_user_type_auto_comb') - self.try_command( - 'process continue', - expected_regex=[ - r'Process \d+ stopped', - r'frame #0: (0x[0-9a-fA-F]+ )?librs.reduce_auto_comb.so`' - ] - ) - - @multithreaded() - def test_function_role_breakpoints_combinations(self): - func_role_combinations = itertools.combinations( - ('accumulator', 'outconverter', 'initializer', 'combiner'), - r=2 - ) - self._test_func_role_combinations(func_role_combinations) - - @multithreaded() - def test_reduction_breakpoint_set_single_type_user_comb(self): - return self._reduction_breakpoint_set_single_type( - 'reduce', - REDUCE_SCRIPT, - 'find_min_user_type', - ( - ('find_min_user_type_init', 'initializer'), - ('find_min_user_type_accum', 'accumulator'), - ('find_min_user_type_comb', 'combiner'), - ('find_min_user_type_outc', 'outconverter') - ) - ) - - @multithreaded() - def test_reduction_breakpoint_set_single_type_auto_comb(self): - return self._reduction_breakpoint_set_single_type( - 'reduce_auto_comb', - REDUCE_AUTO_COMB_SCRIPT, - 'find_min_user_type_auto_comb', - ( - ('find_min_user_type_init', 'initializer'), - ('find_min_user_type_accum', 'accumulator'), - ('find_min_user_type_accum.combiner', 'combiner'), - ('find_min_user_type_outc', 'outconverter') - ) - ) diff --git a/tests/lldb/tests/testcases/test_rs_consts.py b/tests/lldb/tests/testcases/test_rs_consts.py deleted file mode 100644 index 9a7ba70a..00000000 --- a/tests/lldb/tests/testcases/test_rs_consts.py +++ /dev/null @@ -1,94 +0,0 @@ -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -'''Module that contains the test TestRSConsts.''' - -from __future__ import absolute_import - -from harness.test_base_remote import TestBaseRemote -from harness.decorators import ( - ordered_test, - cpp_only_test, -) - - -class TestRSConsts(TestBaseRemote): - '''Tests examining the RenderScript constants.''' - - bundle_target = { - 'java': 'KernelVariables', - 'jni': 'JNIKernelVariables', - 'cpp': 'CppKernelVariables' - } - - def test_rs_consts(self): - self.try_command('language renderscript status', - ['Runtime Library discovered', - 'Runtime Driver discovered']) - - self.try_command('language renderscript kernel breakpoint set kernel', - []) - - self.try_command('process continue', - ['resuming', - 'stopped', - 'stop reason = breakpoint']) - - # Constants - self.try_command('expr M_1_PI', - ['0.318309']) - - self.try_command('expr M_2_PI', - ['0.636619']) - - self.try_command('expr M_2_SQRTPI', - ['1.128379']) - - self.try_command('expr M_E', - ['2.718281']) - - self.try_command('expr M_LN10', - ['2.302585']) - - self.try_command('expr M_LN2', - ['0.693147']) - - self.try_command('expr M_LOG10E', - ['0.434294']) - - self.try_command('expr M_LOG2E', - ['1.442695']) - - self.try_command('expr M_PI', - ['3.141592']) - - self.try_command('expr M_PI_2', - ['1.570796']) - - self.try_command('expr M_PI_4', - ['0.785398']) - - self.try_command('expr M_SQRT1_2', - ['0.707106']) - - self.try_command('expr M_SQRT2', - ['1.414213']) - - @ordered_test('last') - @cpp_only_test() - def test_cpp_cleanup(self): - self.try_command('breakpoint delete 1', ['1 breakpoints deleted']) - - self.try_command('process continue', ['exited with status = 0']) - diff --git a/tests/lldb/tests/testcases/test_script_group.py b/tests/lldb/tests/testcases/test_script_group.py deleted file mode 100644 index b3b31864..00000000 --- a/tests/lldb/tests/testcases/test_script_group.py +++ /dev/null @@ -1,109 +0,0 @@ -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -'''Module that contains the test TestScriptGroup.''' - -from __future__ import absolute_import - -from harness.test_base_remote import TestBaseRemote -from harness.decorators import wimpy - - -class TestScriptGroup(TestBaseRemote): - bundle_target = { - 'java': 'ScriptGroup' - } - - def setup(self, android): - '''This test requires to be run on one thread.''' - android.push_prop('debug.rs.max-threads', 1) - - def teardown(self, android): - '''Reset the number of RS threads to the previous value.''' - android.pop_prop('debug.rs.max-threads') - - @wimpy - def test_kernel_backtrace(self): - # number of allocation elements - array_size = 8 - - self.try_command('language renderscript status', - ['Runtime Library discovered', - 'Runtime Driver discovered', - 'rsdDebugHintScriptGroup2']) - - self.try_command('language renderscript scriptgroup breakpoint set scriptgroup_test', - ['Breakpoint 1: no locations (pending)']) - - self.try_command('language renderscript scriptgroup list', - ['0 script groups']) - - self.try_command('process continue', - ['resuming', - 'stopped', - 'stop reason = breakpoint', - 'librs.scriptgroup.so`foo', - 'scriptgroup.rs']) - - self.try_command('breakpoint list', - ['scriptgroup_test', - 'locations = 1']) - - self.try_command('language renderscript scriptgroup list', - ['1 script group', - 'scriptgroup_test', - 'foo', - 'goo']) - - self.try_command('language renderscript scriptgroup breakpoint set --stop-on-all scriptgroup_test', - ['Breakpoint 2: 2 locations']) - - self.try_command('breakpoint list', - ['scriptgroup_test', - 'librs.scriptgroup.so`foo', - 'librs.scriptgroup.so`goo']) - - # iterate over foo kernels - self.try_command('bt', - ['scriptgroup.rs:', - 'frame #0', 'librs.scriptgroup.so`foo', - 'frame #1', 'librs.scriptgroup.so`foo.expand']) - - for x in range(array_size): - self.try_command('frame var', - ['(int) a = {0}'.format(x)]) - self.try_command('process continue', - ['resuming', - 'stopped', - 'stop reason = breakpoint', - 'librs.scriptgroup.so`{0}'.format( - 'foo' if x < 7 else 'goo')]) - - # iterate over goo kernels - self.try_command('bt', - ['stop reason = breakpoint', - 'scriptgroup.rs:', - 'frame #0', 'librs.scriptgroup.so`goo', - 'frame #1', 'librs.scriptgroup.so`goo.expand']) - - for x in range(array_size): - self.try_command('frame var', - ['(int) a = {0}'.format(x * x)]) - - if x < 7: - self.try_command('process continue', - ['resuming', - 'stopped', - 'stop reason = breakpoint', - 'librs.scriptgroup.so`goo']) diff --git a/tests/lldb/tests/testcases/test_single_source.py b/tests/lldb/tests/testcases/test_single_source.py deleted file mode 100644 index 5da1d97b..00000000 --- a/tests/lldb/tests/testcases/test_single_source.py +++ /dev/null @@ -1,165 +0,0 @@ -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -'''Module that contains the test TestInvokeFun.''' - -from __future__ import absolute_import - -from harness.test_base_remote import TestBaseRemote -from harness.decorators import (ordered_test, wimpy) -from harness.exception import TestSuiteException - - -class TestSingleSource(TestBaseRemote): - '''Tests debugging a function executed from Java using invoke_*.''' - - bundle_target = { - 'java': "SingleSource" - } - - def setup(self, android): - - '''This test requires to be run on one thread.''' - android.push_prop('debug.rs.max-threads', 1) - - def teardown(self, android): - - '''Reset the number of RS threads to the previous value.''' - android.pop_prop('debug.rs.max-threads') - - @ordered_test(-1) - @wimpy - def test_startup(self): - - # pylint: disable=line-too-long - self.try_command('language renderscript status', - ['Runtime Library discovered', - 'Runtime Driver discovered']) - - self.try_command('breakpoint set --name check_in', - ['(pending)']) - - @ordered_test(0) - @wimpy - def test_invoke_1(self): - - # enter script_invoke_1 - self.try_command('breakpoint set --name script_invoke_1', - ['(pending)']) - - self.try_command('process continue', - ['stopped', - 'stop reason = breakpoint'], - [r'librs.rs_single_source.so`script_invoke_1']) - - self.try_command( - 'language renderscript allocation dump 1', - ['(0, 0, 0) = 1', - '(1, 0, 0) = 2', - '(2, 0, 0) = 3', - '(3, 0, 0) = 4']) - - self.try_command( - 'language renderscript allocation dump 2', - ['(0, 0, 0) = 5', - '(1, 0, 0) = 6', - '(2, 0, 0) = 7', - '(3, 0, 0) = 8']) - - self.try_command('breakpoint set --name `kernel_1', - ['address']) - - self.try_command('breakpoint set --name `kernel_2', - ['address']) - - # check our global allocation is visible - self.try_command('p global_alloc', - ['(rs_allocation)', - 'p = 0x']) - - # test kernel_1 - for _ in range(10): - # continue as long as there are threads hitting kernel_1 - out = self.do_command('process continue') - if 'librs.rs_single_source.so`kernel_1' in out: - continue - # if we hit check_in we have finished with kernel_1 - if 'librs.rs_single_source.so`check_in' in out: - self.try_command( - 'language renderscript allocation dump 1', - ['(0, 0, 0) = 25', - '(1, 0, 0) = 36', - '(2, 0, 0) = 49', - '(3, 0, 0) = 64']) - break - TestSuiteException('unexpected breakpoint') - else: - TestSuiteException('loop quota exceeded') - - # test kernel_2 - for _ in range(10): - # continue as long as there are threads hitting kernel_2 - out = self.do_command('process continue') - if 'librs.rs_single_source.so`kernel_2' in out: - continue - # if we hit check_in we have finished with kernel_2 - if 'librs.rs_single_source.so`check_in' in out: - self.try_command( - 'language renderscript allocation dump 2', - ['(0, 0, 0) = 125', - '(1, 0, 0) = 216', - '(2, 0, 0) = 343', - '(3, 0, 0) = 512']) - break - TestSuiteException('unexpected breakpoint') - else: - TestSuiteException('loop quota exceeded') - - @ordered_test(1) - @wimpy - def test_invoke_2(self): - - # enter script_invoke_2 - self.try_command('breakpoint set --name script_invoke_2', - ['address']) - - self.try_command('process continue', - ['stopped', - 'stop reason = breakpoint'], - [r'librs.rs_single_source.so`script_invoke_2']) - - # test void_kernel_1 - self.try_command('breakpoint set --name void_kernel_1', - ['address']) - - for _ in range(10): - out = self.do_command('process continue') - - # continue as long as there are threads hitting void_kernel_1 - if 'librs.rs_single_source.so`void_kernel_1' in out: - continue - - # if we hit check_in we have finished with void_kernel_1 - if 'librs.rs_single_source.so`check_in' in out: - self.try_command( - 'language renderscript allocation dump 4', - ['(0, 0, 0) = 0', - '(1, 0, 0) = 1', - '(2, 0, 0) = 2', - '(3, 0, 0) = 3']) - break - - TestSuiteException('unexpected breakpoint') - else: - TestSuiteException('loop quota exceeded') diff --git a/tests/lldb/tests/testcases/test_source_step.py b/tests/lldb/tests/testcases/test_source_step.py deleted file mode 100644 index c780b8a5..00000000 --- a/tests/lldb/tests/testcases/test_source_step.py +++ /dev/null @@ -1,113 +0,0 @@ -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -'''Module that contains the test TestSourceStep.''' - -from __future__ import absolute_import - -import os -from harness.test_base_remote import TestBaseRemote -from harness.decorators import ( - ordered_test, - cpp_only_test, -) - - -class TestSourceStep(TestBaseRemote): - '''Test stepping through the source using step-in, -over and -out.''' - - bundle_target = { - 'java': 'BranchingFunCalls', - 'jni': 'JNIBranchingFunCalls', - 'cpp': 'CppBranchingFunCalls' - - } - - def script_dir(self): - file_dir = os.path.dirname(os.path.realpath(__file__)) - app_root = os.path.join(file_dir, '..', '..') - - return { - 'java': os.path.join(app_root, 'java', 'BranchingFunCalls', 'src', 'rs'), - 'cpp': os.path.join(app_root, 'cpp', 'BranchingFunCalls'), - 'jni': os.path.join(app_root, 'jni', 'BranchingFunCalls', 'jnibranchingfuncalls') - }[self.app_type] - - def setup(self, android): - '''This test requires to be run on one thread.''' - android.push_prop('debug.rs.max-threads', 1) - - def teardown(self, android): - '''Reset the number of RS threads to the previous value.''' - android.pop_prop('debug.rs.max-threads') - - def test_source_thread_step_in_out(self): - self.try_command('language renderscript status', - ['Runtime Library discovered', - 'Runtime Driver discovered']) - - self.try_command('b -f scalars.rs -l 63', - ['(pending)']) - - self.try_command('process continue', - ['stopped', - 'stop reason = breakpoint', - 'scalars.rs:63']) - - # set the source mapping - self.set_src_map('scalars.rs', self.script_dir()) - - self.try_command('process status', - ['-> 63', - 'int i = in;']) - - #63 int i = in; - self.try_command('thread step-in', - ['-> 64']) - #64 float f = (float) i; - self.try_command('thread step-in', - ['-> 65']) - #49 modify_f(&f); - self.try_command('thread step-over', - ['-> 66']) - #50 modify_i(&i); - self.try_command('thread step-in', - ['-> 49']) - #49 int j = *i; - self.try_command('b -f scalars.rs -l 54', - ['librs.scalars.so`modify_i', - 'scalars.rs:54']) - self.try_command('c', - ['stop reason = breakpoint', - 'scalars.rs:54', - '-> 54']) - #54 set_i(i, 0); - # For the line number anything between #37 and #38 is fine - self.try_command('thread step-in', - [], - [r'-> 3[678]']) - #38 int tmp = b; - self.try_command('thread step-out', - ['-> 54']) - - @cpp_only_test() - @ordered_test('last') - def test_cpp_cleanup(self): - self.try_command('breakpoint delete 1', ['1 breakpoints deleted']) - - self.try_command('breakpoint delete 2', ['1 breakpoints deleted']) - - self.try_command('process continue', - ['exited with status = 0']) - diff --git a/tests/lldb/tests/testcases/test_write_global.py b/tests/lldb/tests/testcases/test_write_global.py deleted file mode 100644 index 1d8d3017..00000000 --- a/tests/lldb/tests/testcases/test_write_global.py +++ /dev/null @@ -1,230 +0,0 @@ -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -'''Module that contains the test TestWriteGlobal.''' - -from __future__ import absolute_import - -from harness.test_base_remote import TestBaseRemote -from harness.decorators import ( - wimpy, - ordered_test, - cpp_only_test, -) - - -class TestWriteGlobal(TestBaseRemote): - '''Tests modifying global variables of all types.''' - - bundle_target = { - 'java': 'KernelVariables', - 'jni': 'JNIKernelVariables', - 'cpp': 'CppKernelVariables' - } - - def _try_modifying_global(self, global_name, new_value, data_type_in, - expected_output, expected_output_regex=None): - '''Modify and then inspect a global and check for the output. - - Run the "expr" command to set a given global to a new value and - check that it is set afterwards by running the "target variable" - command. - - Args: - global_name: String which is the name of the global to modify. - new_value: A string that is the new value of the global. - data_type_in: A string containing a c-style parenthesised data type - representing the type of the global. - expected_output: List of strings that should be found in the output - of both commands. - expected_output_regex: List of regular expressions that should be - found in the output of the target variable - command. - - Raises: - TestFail: One of the lldb commands did not provide the expected - output. - ''' - self.try_command('expr %s = %s%s' % - (global_name, data_type_in, new_value), - expected_output, - expected_output_regex) - self.try_command('target variable ' + global_name, - expected_output, - expected_output_regex) - - @wimpy - @ordered_test(0) - def test_setup(self): - self.try_command('language renderscript status', - ['Runtime Library discovered', - 'Runtime Driver discovered']) - - self.try_command('b -f simple.rs -l 145', []) - - self.try_command('process continue', - ['resuming', - 'stopped', - 'stop reason = breakpoint']) - - @wimpy - def test_char_global(self): - self._try_modifying_global('char_global', '-2', - '(signed char)', ['\'\\xfe\''], - [r'\((signed )?char\)']) - - def test_write_primitive_types(self): - self._try_modifying_global('uchar_global', '22', - '(uchar)', ['(uchar)', '\'\\x16\'']) - - self._try_modifying_global('short_global', '-33', - '(short)', ['(short)', '-33']) - - self._try_modifying_global('ushort_global', '44', - '(ushort)', ['(ushort)', '44']) - - self._try_modifying_global('int_global', '-55', - '(int)', ['(int)', '-55']) - - self._try_modifying_global('uint_global', '66', - '(uint)', ['(uint)', '66']) - - self._try_modifying_global('float_global', '-7.5', - '(float)', ['(float)', '-7.5']) - - self._try_modifying_global('long_global', '-888888', - '(long long)', ['-888888'], - [r'\((long )?long\)']) - - self._try_modifying_global('ulong_global', '99999999', - '(ulong)', ['(ulong)', '99999999']) - - self._try_modifying_global('double_global', '-10101.5', - '(double)', ['(double)', '-10101.5']) - - self._try_modifying_global('char2_global', '{22, 4}', - '(char2)', ['(char2)', '(22, 4)']) - - @wimpy - def test_write_uchar2(self): - self._try_modifying_global('uchar2_global', '{44, 55}', - '(uchar2)', ['(uchar2)', '(0x2c, 0x37)']) - - def test_write_vec2(self): - self._try_modifying_global('short2_global', '{-66, 77}', - '(short2)', ['(short2)', '(-66, 77)']) - - self._try_modifying_global('ushort2_global', '{88, 99}', - '(ushort2)', ['(ushort2)', '(88, 99)']) - - self._try_modifying_global('int2_global', '{111, -222}', - '(int2)', ['(int2)', '(111, -222)']) - - self._try_modifying_global('uint2_global', '{333, 444}', - '(uint2)', ['(uint2)', '(333, 444)']) - - self._try_modifying_global('float2_global', '{-55.5f, 6.0}', - '(float2)', ['(float2)', '(-55.5, 6)']) - - self._try_modifying_global('long2_global', '{666666, -777777}', - '(long2)', ['(long2)', '(666666, -777777)']) - - self._try_modifying_global('ulong2_global', '{888888, 999999}', - '(ulong2)', ['(ulong2)', '(888888, 999999)']) - - self._try_modifying_global('double2_global', '{11.0000000, -0.0l}', - '(double2)', ['(double2)', '(11, -0)']) - - self._try_modifying_global('char3_global', '{2, -3, 4}', - '(char3)', ['(char3)', '(2, -3, 4,']) - - self._try_modifying_global('uchar3_global', '{\'a\', \'b\', \'c\'}', - '(uchar3)', ['(uchar3)', '(0x61, 0x62, 0x63,']) - - @wimpy - def test_write_short3(self): - self._try_modifying_global('short3_global', '{44, -55, 66}', - '(short3)', ['(short3)', '(44, -55, 66,']) - - def test_write_vec3(self): - self._try_modifying_global('ushort3_global', '{88, 99, 111}', - '(ushort3)', ['(ushort3)', '(88, 99, 111,']) - - self._try_modifying_global('int3_global', '{-111, 222, -333}', - '(int3)', ['(int3)', '(-111, 222, -333,']) - - self._try_modifying_global('uint3_global', '{444, 555, 666}', - '(uint3)', ['(uint3)', '(444, 555, 666,']) - - self._try_modifying_global('float3_global', '{7.5F, 0008.000, 9}', - '(float3)', ['(float3)', '(7.5, 8, 9,']) - - self._try_modifying_global('long3_global', '{111111, -22222222, 3333333}', - '(long3)', ['(long3)', '(111111, -22222222, 3333333,']) - - self._try_modifying_global('ulong3_global', '{4444444, 5555555, 66666666}', - '(ulong3)', ['(ulong3)', '(4444444, 5555555, 66666666,']) - - self._try_modifying_global('double3_global', '{7.5L, -0, 8.9e1}', - '(double3)', ['(double3)', '(7.5, 0, 89,']) - - self._try_modifying_global('char4_global', '{0x1, 0x2, 0x3, 0x4}', - '(char4)', - ['(char4)', '(1, 2, 3, 4)']) - - self._try_modifying_global('uchar4_global', '{0x5, 0x6, 0x7, 0x8}', - '(uchar4)', - ['(uchar4)', '(0x05, 0x06, 0x07, 0x08)']) - - self._try_modifying_global('short4_global', '{0x9, 0xa, 0xb, 0xc}', - '(short4)', - ['(short4)', '(9, 10, 11, 12)']) - - @wimpy - def test_write_ushort4(self): - self._try_modifying_global('ushort4_global', '{0xd, 0xe, 0xf, 0x10}', - '(ushort4)', - ['(ushort4)', '(13, 14, 15, 16)']) - - def test_write_vec4_global(self): - self._try_modifying_global('int4_global', '{0x11, 0x12, 0x13, 0x14}', - '(int4)', - ['(int4)', '(17, 18, 19, 20)']) - - self._try_modifying_global('uint4_global', '{0x15, 0x16, 0x17, 0x18}', - '(uint4)', - ['(uint4)', '(21, 22, 23, 24)']) - - self._try_modifying_global('float4_global', '{19.0, 20.5, -21, -22.5}', - '(float4)', - ['(float4)', '(19, 20.5, -21, -22.5)']) - - self._try_modifying_global('long4_global', '{0x1d, 0x1e, 0x1f, 0x20}', - '(long4)', - ['(long4)', '(29, 30, 31, 32)']) - - self._try_modifying_global('ulong4_global', '{0x21, 0x22, 0x23, 0x24}', - '(ulong4)', - ['(ulong4)', '(33, 34, 35, 36)']) - - self._try_modifying_global('double4_global', '{25.000, -26, -27.5, 28.0}', - '(double4)', - ['(double4)', '(25, -26, -27.5, 28)']) - - @ordered_test('last') - @cpp_only_test() - def test_cpp_cleanup(self): - self.try_command('breakpoint delete 1', ['1 breakpoints deleted']) - - self.try_command('process continue', ['exited with status = 0']) diff --git a/tests/lldb/tests/testcases/test_write_global_element.py b/tests/lldb/tests/testcases/test_write_global_element.py deleted file mode 100644 index 28882bdc..00000000 --- a/tests/lldb/tests/testcases/test_write_global_element.py +++ /dev/null @@ -1,292 +0,0 @@ -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -'''Module that contains the test TestWriteGlobalElement.''' - -from __future__ import absolute_import - -from harness.test_base_remote import TestBaseRemote -from harness.decorators import ( - ordered_test, - wimpy, - cpp_only_test -) - - -class TestWriteGlobalElement(TestBaseRemote): - '''Tests modifying elements of global variables of all types.''' - - bundle_target = { - 'java': 'KernelVariables', - 'jni': 'JNIKernelVariables', - 'cpp': 'CppKernelVariables' - } - - def _try_inspecting_global(self, global_name, expected_output): - '''Run the "expr" command on a given global and with a given output. - - Args: - global_name: String which is the name of the global to inspect. - expected_output: List of strings that should be found in the output. - - Raises: - TestFail: The lldb command did not provide the expected output. - ''' - self.try_command('expr ' + global_name, expected_output) - - def _try_modifying_global(self, global_name, new_value, expected_output, - expected_output_regex=None): - '''Modify and then inspect a global and check for the output. - - Run the "expr" command to set a given global to a new value and - check that it is set afterwards by running the "target variable" - command. - - Args: - global_name: String which is the name of the global to modify. - new_value: A string that is the new value of the global. - expected_output: List of strings that should be found in the output - of both commands. - expected_output_regex: List of regular expressions that should be - found in the output of the target variable - command. - - Raises: - TestFail: One of the lldb commands did not provide the expected - output. - ''' - self.try_command('expr %s = %s' % (global_name, new_value), - expected_output, - expected_output_regex) - self.try_command('target variable ' + global_name, - expected_output, - expected_output_regex) - - @wimpy - @ordered_test(0) - def test_setup(self): - self.try_command('language renderscript status', - ['Runtime Library discovered', - 'Runtime Driver discovered']) - - self.try_command('b -f simple.rs -l 145', []) - - self.try_command('process continue', - ['resuming', - 'stopped', - 'stop reason = breakpoint']) - - @wimpy - def test_modify_global(self): - self._try_modifying_global('char2_global[0]', '2', - ['\'\\x02\''], - [r'\((signed )?char\)']) - self._try_inspecting_global('char2_global', ['(char2)', '(2, -22)']) - - def test_vec2(self): - self._try_modifying_global('uchar2_global[1]', '3', - ['\'\\x03\''], - [r'\(u(nsigned )?char\)']) - self._try_inspecting_global('uchar2_global', - ['(uchar2)', '(0x21, 0x03)']) - - self._try_modifying_global('short2_global[0]', '-44', - ['(short)', '-44']) - self._try_inspecting_global('short2_global', - ['(short2)', '(-44, 666)']) - - self._try_modifying_global('ushort2_global[1]', '55', - ['55'], - [r'\(u(nsigned )?short\)']) - self._try_inspecting_global('ushort2_global', - ['(ushort2)', '(777, 55)']) - - self._try_modifying_global('int2_global[0]', '666', - ['(int)', '666']) - self._try_inspecting_global('int2_global', - ['(int2)', '(666, -1111)']) - - self._try_modifying_global('uint2_global[1]', '777', - ['777'], - [r'\(u(nsigned )?int\)']) - self._try_inspecting_global('uint2_global', - ['(uint2)', '(2222, 777)']) - - self._try_modifying_global('float2_global[0]', '-8.5', - ['(float)', '-8.5']) - self._try_inspecting_global('float2_global', - ['(float2)', '(-8.5, -5)']) - - self._try_modifying_global('long2_global[1]', '999999', - ['999999'], - [r'\((long )?long\)']) - self._try_inspecting_global('long2_global', - ['(long2)', '(-4444, 999999)']) - - self._try_modifying_global('ulong2_global[0]', '10101010101', - ['10101010101'], - [r'\(u(nsigned )?(long )?long\)']) - self._try_inspecting_global('ulong2_global', - ['(ulong2)', '(10101010101, 7777)']) - - self._try_modifying_global('double2_global[1]', '-11.000', - ['(double)', '-11']) - self._try_inspecting_global('double2_global', - ['(double2)', '(88.5, -11)']) - - self._try_modifying_global('char3_global[0]', '12', - ['\'\\f\''], - [r'\((signed )?char\)']) - self._try_inspecting_global('char3_global', - ['(char3)', - '(12, -22, -33,']) - - @wimpy - def test_uchar3(self): - self._try_modifying_global('uchar3_global[1]', '\'d\'', - ['\'d\''], - [r'\(u(nsigned )?char\)']) - self._try_inspecting_global('uchar3_global', - ['(uchar3)', - '(0x21, 0x64, 0x37,']) - - def test_vec3(self): - self._try_modifying_global('short3_global[2]', '-131', - ['(short)', '-131']) - self._try_inspecting_global('short3_global', - ['(short3)', - '(-555, 666, -131,']) - - self._try_modifying_global('ushort3_global[0]', '1414', - ['1414'], - [r'\(u(nsigned )?short\)']) - self._try_inspecting_global('ushort3_global', - ['(ushort3)', - '(1414, 888, 999,']) - - self._try_modifying_global('int3_global[0]', '151515', - ['(int)', '151515']) - self._try_inspecting_global('int3_global', - ['(int3)', - '(151515, -1111, 2222,']) - - self._try_modifying_global('uint3_global[1]', '161616', - ['161616'], - [r'\(u(nsigned )?int\)']) - self._try_inspecting_global('uint3_global', - ['(uint3)', - '(2222, 161616, 4444,']) - - self._try_modifying_global('float3_global[2]', '17.5', - ['(float)', '17.5']) - self._try_inspecting_global('float3_global', - ['(float3)', - '(4.5, -5, 17.5,']) - - self._try_modifying_global('long3_global[0]', '-181818181818', - ['-181818181818'], - [r'\((long )?long\)']) - self._try_inspecting_global('long3_global', - ['(long3)', - '(-181818181818, 5555, 6666,']) - - self._try_modifying_global('ulong3_global[1]', '191919191919', - ['191919191919'], - [r'\(u(nsigned )?(long )?long\)']) - self._try_inspecting_global('ulong3_global', - ['(ulong3)', - '(6666, 191919191919, 8888,']) - - self._try_modifying_global('double3_global[2]', '20.5', - ['(double)', '20.5']) - self._try_inspecting_global('double3_global', - ['(double3)', - '(88.5, -99, 20.5,']) - - self._try_modifying_global('char4_global[0]', '-21', - ['\'\\xeb\''], - [r'\((signed )?char\)']) - self._try_inspecting_global('char4_global', - ['(char4)', - '(-21, 11, -22, -33)']) - - self._try_modifying_global('uchar4_global[1]', '22', - ['\'\\x16\''], - [r'\(u(nsigned )?char\)']) - self._try_inspecting_global('uchar4_global', - ['(uchar4)', - '(0xde, 0x16, 0x2c, 0x37)']) - - @wimpy - def test_short4(self): - self._try_modifying_global('short4_global[2]', '23', - ['(short)', '23']) - self._try_inspecting_global('short4_global', - ['(short4)', - '(-444, -555, 23, 777)']) - - def test_vec4(self): - self._try_modifying_global('ushort4_global[3]', '24', - ['24'], - [r'\(u(nsigned )?short\)']) - self._try_inspecting_global('ushort4_global', - ['(ushort4)', - '(666, 777, 888, 24)']) - - self._try_modifying_global('int4_global[0]', '-2525', - ['(int)', '-2525']) - self._try_inspecting_global('int4_global', - ['(int4)', - '(-2525, 999, -1111, 2222)']) - - self._try_modifying_global('uint4_global[1]', '26262', - ['26262'], - [r'\(u(nsigned )?int\)']) - self._try_inspecting_global('uint4_global', - ['(uint4)', - '(1111, 26262, 3333, 4444)']) - - self._try_modifying_global('float4_global[2]', '27.0f', - ['(float)', '27']) - self._try_inspecting_global('float4_global', - ['(float4)', - '(3, 4.5, 27, -6.5)']) - - self._try_modifying_global('long4_global[3]', '-28282828282', - ['-28282828282'], - [r'\((long )?long\)']) - self._try_inspecting_global('long4_global', - ['(long4)', - '(-3333, -4444, 5555, -28282828282)']) - - self._try_modifying_global('ulong4_global[0]', '2929292929', - ['2929292929'], - [r'\(u(nsigned )?(long )?long\)']) - self._try_inspecting_global('ulong4_global', - ['(ulong4)', - '(2929292929, 6666, 7777, 8888)']) - - self._try_modifying_global('double4_global[1]', '30.5', - ['(double)', '30.5']) - self._try_inspecting_global('double4_global', - ['(double4)', - '(-77, 30.5, -99, 111.5)']) - - @cpp_only_test() - @ordered_test('last') - def test_cpp_cleanup(self): - self.try_command('breakpoint delete 1', ['1 breakpoints deleted']) - - self.try_command('process continue', - ['exited with status = 0']) diff --git a/tests/lldb/tests/testcases/test_write_local.py b/tests/lldb/tests/testcases/test_write_local.py deleted file mode 100644 index cd32ecc5..00000000 --- a/tests/lldb/tests/testcases/test_write_local.py +++ /dev/null @@ -1,223 +0,0 @@ -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -'''Module that contains the test TestWriteLocal.''' - -from __future__ import absolute_import - -from harness.test_base_remote import TestBaseRemote -from harness.decorators import ( - ordered_test, - wimpy -) - - -class TestWriteLocal(TestBaseRemote): - '''Tests modifying local variables of all types.''' - - bundle_target = { - 'java': 'KernelVariables', - 'jni': 'JNIKernelVariables', - 'cpp': 'CppKernelVariables' - } - - def _try_modifying_local(self, local_name, new_value, data_type_in, - expected_output, expected_output_regex=None): - '''Try getting lldb to modify a local and check the output. - - Run the "expr" command to set a given local to a new value and - check that it is set afterwards by running the "target variable" - command. - - Args: - local_name: String which is the name of the local to modify. - new_value: A string that is the new value of the local. - data_type_in: A string containing a c-style parenthesised data type - representing the type of the local. - expected_output: List of strings that should be found in the output - of both commands. - expected_output_regex: List of regular expressions that should be - found in the output of the target variable - command. - - Raises: - TestFail: One of the lldb commands did not provide the expected - output. - ''' - # pylint: disable=too-many-arguments - self.try_command('expr %s = %s%s' - % (local_name, data_type_in, new_value), - expected_output, - expected_output_regex) - self.try_command('frame variable ' + local_name, - expected_output, - expected_output_regex) - - @wimpy - @ordered_test(0) - def test_setup(self): - self.try_command('language renderscript status', - ['Runtime Library discovered', - 'Runtime Driver discovered']) - - self.try_command('b -f simple.rs -l 145', []) - - self.try_command('process continue', - ['resuming', - 'stopped', - 'stop reason = breakpoint']) - - @wimpy - def test_modify_char(self): - self._try_modifying_local('char_local', '-2', - '(signed char)', ['\'\\xfe\''], - [r'\((signed )?char\)']) - - def test_modify_primitive(self): - self._try_modifying_local('uchar_local', '22', - '(uchar)', ['(uchar)', '\'\\x16\'']) - - self._try_modifying_local('short_local', '-33', - '(short)', ['(short)', '-33']) - - self._try_modifying_local('ushort_local', '44', - '(ushort)', ['(ushort)', '44']) - - self._try_modifying_local('int_local', '-55', - '(int)', ['(int)', '-55']) - - self._try_modifying_local('uint_local', '66', - '(uint)', ['(uint)', '66']) - - self._try_modifying_local('float_local', '-7.5', - '(float)', ['(float)', '-7.5']) - - self._try_modifying_local('long_local', '-888888', - '(long long)', ['-888888'], - [r'\((long )?long\)']) - - self._try_modifying_local('ulong_local', '99999999', - '(ulong)', ['(ulong)', '99999999']) - - self._try_modifying_local('double_local', '-10101.5', - '(double)', ['(double)', '-10101.5']) - - self._try_modifying_local('char2_local', '{22, 4}', - '(char2)', ['(char2)', '(22, 4)']) - - @wimpy - def test_modify_uchar2(self): - self._try_modifying_local('uchar2_local', '{44, 55}', - '(uchar2)', ['(uchar2)', '(0x2c, 0x37)']) - - def test_modify_vec2(self): - self._try_modifying_local('short2_local', '{-66, 77}', - '(short2)', ['(short2)', '(-66, 77)']) - - self._try_modifying_local('ushort2_local', '{88, 99}', - '(ushort2)', ['(ushort2)', '(88, 99)']) - - self._try_modifying_local('int2_local', '{111, -222}', - '(int2)', ['(int2)', '(111, -222)']) - - self._try_modifying_local('uint2_local', '{333, 444}', - '(uint2)', ['(uint2)', '(333, 444)']) - - self._try_modifying_local('float2_local', '{-55.5f, 6.0}', - '(float2)', ['(float2)', '(-55.5, 6)']) - - self._try_modifying_local('long2_local', '{666666, -777777}', - '(long2)', ['(long2)', '(666666, -777777)']) - - self._try_modifying_local('ulong2_local', '{888888, 999999}', - '(ulong2)', ['(ulong2)', '(888888, 999999)']) - - self._try_modifying_local('double2_local', '{11.0000000, -0.0l}', - '(double2)', ['(double2)', '(11, -0)']) - - self._try_modifying_local('char3_local', '{2, -3, 4}', - '(char3)', ['(char3)', '(2, -3, 4,']) - - self._try_modifying_local('uchar3_local', '{\'a\', \'b\', \'c\'}', - '(uchar3)', ['(uchar3)', '(0x61, 0x62, 0x63,']) - - @wimpy - def test_modify_short3(self): - self._try_modifying_local('short3_local', '{44, -55, 66}', - '(short3)', ['(short3)', '(44, -55, 66,']) - - def test_modify_vec3(self): - self._try_modifying_local('ushort3_local', '{88, 99, 111}', - '(ushort3)', ['(ushort3)', '(88, 99, 111,']) - - self._try_modifying_local('int3_local', '{-111, 222, -333}', - '(int3)', ['(int3)', '(-111, 222, -333,']) - - self._try_modifying_local('uint3_local', '{444, 555, 666}', - '(uint3)', ['(uint3)', '(444, 555, 666,']) - - self._try_modifying_local('float3_local', '{7.5F, 0008.000, 9}', - '(float3)', ['(float3)', '(7.5, 8, 9,']) - - self._try_modifying_local('long3_local', '{111111, -22222222, 3333333}', - '(long3)', ['(long3)', '(111111, -22222222, 3333333,']) - - self._try_modifying_local('ulong3_local', '{4444444, 5555555, 66666666}', - '(ulong3)', ['(ulong3)', '(4444444, 5555555, 66666666,']) - - self._try_modifying_local('double3_local', '{7.5L, -0, 8.9e1}', - '(double3)', ['(double3)', '(7.5, 0, 89,']) - - self._try_modifying_local('char4_local', '{0x1, 0x2, 0x3, 0x4}', - '(char4)', - ['(char4)', '(1, 2, 3, 4)']) - - self._try_modifying_local('uchar4_local', '{0x5, 0x6, 0x7, 0x8}', - '(uchar4)', - ['(uchar4)', '(0x05, 0x06, 0x07, 0x08)']) - - self._try_modifying_local('short4_local', '{0x9, 0xa, 0xb, 0xc}', - '(short4)', - ['(short4)', '(9, 10, 11, 12)']) - - @wimpy - def test_modify_ushort4(self): - self._try_modifying_local('ushort4_local', '{0xd, 0xe, 0xf, 0x10}', - '(ushort4)', - ['(ushort4)', '(13, 14, 15, 16)']) - - def test_modify_vec4(self): - self._try_modifying_local('int4_local', '{0x11, 0x12, 0x13, 0x14}', - '(int4)', - ['(int4)', '(17, 18, 19, 20)']) - - self._try_modifying_local('uint4_local', '{0x15, 0x16, 0x17, 0x18}', - '(uint4)', - ['(uint4)', '(21, 22, 23, 24)']) - - self._try_modifying_local('float4_local', '{19.0, 20.5, -21, -22.5}', - '(float4)', - ['(float4)', '(19, 20.5, -21, -22.5)']) - - self._try_modifying_local('long4_local', '{0x1d, 0x1e, 0x1f, 0x20}', - '(long4)', - ['(long4)', '(29, 30, 31, 32)']) - - self._try_modifying_local('ulong4_local', '{0x21, 0x22, 0x23, 0x24}', - '(ulong4)', - ['(ulong4)', '(33, 34, 35, 36)']) - - self._try_modifying_local('double4_local', '{25.000, -26, -27.5, 28.0}', - '(double4)', - ['(double4)', '(25, -26, -27.5, 28)']) diff --git a/tests/lldb/tests/testcases/test_write_local_element.py b/tests/lldb/tests/testcases/test_write_local_element.py deleted file mode 100644 index 17e61216..00000000 --- a/tests/lldb/tests/testcases/test_write_local_element.py +++ /dev/null @@ -1,295 +0,0 @@ -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -'''Module that contains the test TestWriteLocalElement.''' - -from __future__ import absolute_import - -from harness.test_base_remote import TestBaseRemote -from harness.decorators import ( - wimpy, - ordered_test -) - - -class TestWriteLocalElement(TestBaseRemote): - '''Tests modifying elements of local variables of all types.''' - - bundle_target = { - 'java': 'KernelVariables', - 'jni': 'JNIKernelVariables', - 'cpp': 'CppKernelVariables' - } - - def _try_inspecting_local(self, local_name, expected_output): - '''Run the "expr" command on a given local and with a given output. - - Args: - local_name: String which is the name of the local to inspect. - expected_output: List of strings that should be found in the output. - - Raises: - TestFail: The lldb command did not provide the expected output. - ''' - self.try_command('expr ' + local_name, expected_output) - - def _try_modifying_local(self, local_name, new_value, expected_output, - expected_output_regex=None): - '''Modify and then inspect a local and check for the output. - - Run the "expr" command to set a given local to a new value and - check that it is set afterwards by running the "target variable" - command. - - Args: - local_name: String which is the name of the local to modify. - new_value: A string that is the new value of the local. - expected_output: List of strings that should be found in the output - of both commands. - expected_output_regex: List of regular expressions that should be - found in the output of the target variable - command. - - Raises: - TestFail: One of the lldb commands did not provide the expected - output. - ''' - self.try_command('expr %s = %s' % (local_name, new_value), - expected_output, - expected_output_regex) - self.try_command('frame variable ' + local_name, - expected_output, - expected_output_regex) - - @wimpy - @ordered_test(0) - def test_setup(self): - self.try_command('language renderscript status', - ['Runtime Library discovered', - 'Runtime Driver discovered']) - - self.try_command('b -f simple.rs -l 145', []) - - self.try_command('process continue', - ['resuming', - 'stopped', - 'stop reason = breakpoint']) - - @wimpy - def test_modify_char2(self): - self._try_modifying_local('char2_local[0]', '2', - ['2'], [r'\((signed )?char\)']) - self._try_inspecting_local('char2_local', - ['(char2)', '(2, -22)']) - - def test_modify_vec2(self): - self._try_modifying_local('uchar2_local[1]', '3', - ['3'], [r'\(u(nsigned )?char\)']) - self._try_inspecting_local('uchar2_local', - ['(uchar2)', '(0x21, 0x03)']) - - self._try_modifying_local('short2_local[0]', '-44', - ['(short)', '-44']) - self._try_inspecting_local('short2_local', - ['(short2)', '(-44, 666)']) - - self._try_modifying_local('ushort2_local[1]', '55', - ['55'], [r'\(u(nsigned )?short\)']) - self._try_inspecting_local('ushort2_local', - ['(ushort2)', '(777, 55)']) - - self._try_modifying_local('int2_local[0]', '666', - ['(int)', '666']) - self._try_inspecting_local('int2_local', - ['(int2)', '(666, -1111)']) - - self._try_modifying_local('uint2_local[1]', '777', - ['777'], [r'\(u(nsigned )?int\)']) - self._try_inspecting_local('uint2_local', - ['(uint2)', '(2222, 777)']) - - self._try_modifying_local('float2_local[0]', '-8.5', - ['(float)', '-8.5']) - self._try_inspecting_local('float2_local', - ['(float2)', '(-8.5, -5)']) - - self._try_modifying_local('long2_local[1]', '999999', - ['999999'], - [r'\((long )?long\)']) - self._try_inspecting_local('long2_local', - ['(long2)', '(-4444, 999999)']) - - self._try_modifying_local('ulong2_local[0]', '10101010101', - ['10101010101'], - [r'\(u(nsigned )?(long )?long\)']) - self._try_inspecting_local('ulong2_local', - ['(ulong2)', '(10101010101, 7777)']) - - self._try_modifying_local('double2_local[1]', '-11.000', - ['(double)', '-11']) - self._try_inspecting_local('double2_local', - ['(double2)', '(88.5, -11)']) - - # For some reason the result of some char and uchar expr is in hex - # and that of frame variable in decimal, so calling - # try_modifying_local doesn't work, because it reuses the expected - # output for both commands. - self.try_command('expr char3_local[0] = 12', - ['\'\\f\''], - [r'\((signed )?char\)']) - self.try_command('frame variable char3_local[0]', - ['12'], - [r'\((signed )?char\)']) - - self._try_inspecting_local('char3_local', - ['(char3)', - '(12, -22, -33,']) - - @wimpy - def test_modify_uchar3(self): - self.try_command('expr uchar3_local[1] = \'d\'', - ['\'d\''], - [r'\(u(nsigned )?char\)']) - self.try_command('frame variable uchar3_local[1]', - ['0x64'], - [r'\(u(nsigned )?char\)']) - - - def test_modify_vec3(self): - self._try_inspecting_local('uchar3_local', - ['(uchar3)', - '(0x21, 0x64, 0x37,']) - - self._try_modifying_local('short3_local[2]', '-131', - ['(short)', '-131']) - self._try_inspecting_local('short3_local', - ['(short3)', - '(-555, 666, -131,']) - - self._try_modifying_local('ushort3_local[0]', '1414', - ['1414'], [r'\(u(nsigned )?short\)']) - self._try_inspecting_local('ushort3_local', - ['(ushort3)', - '(1414, 888, 999,']) - - self._try_modifying_local('int3_local[0]', '151515', - ['(int)', '151515']) - self._try_inspecting_local('int3_local', - ['(int3)', - '(151515, -1111, 2222,']) - - self._try_modifying_local('uint3_local[1]', '161616', - ['161616'], [r'\(u(nsigned )?int\)']) - self._try_inspecting_local('uint3_local', - ['(uint3)', - '(2222, 161616, 4444,']) - - self._try_modifying_local('float3_local[2]', '17.5', - ['(float)', '17.5']) - self._try_inspecting_local('float3_local', - ['(float3)', - '(4.5, -5, 17.5,']) - - self._try_modifying_local('long3_local[0]', '-181818181818', - ['-181818181818'], [r'\((long )?long\)']) - self._try_inspecting_local('long3_local', - ['(long3)', - '(-181818181818, 5555, 6666,']) - - self._try_modifying_local('ulong3_local[1]', '191919191919', - ['191919191919'], - [r'\(u(nsigned )?(long )?long\)']) - self._try_inspecting_local('ulong3_local', - ['(ulong3)', - '(6666, 191919191919, 8888,']) - - self._try_modifying_local('double3_local[2]', '20.5', - ['(double)', '20.5']) - self._try_inspecting_local('double3_local', - ['(double3)', - '(88.5, -99, 20.5,']) - - self.try_command('expr char4_local[0] = -21', - ['\'\\xeb\''], - [r'\((signed )?char\)']) - self.try_command('frame variable char4_local[0]', - ['-21'], - [r'\((signed )?char\)']) - - self._try_inspecting_local('char4_local', - ['(char4)', - '(-21, 11, -22, -33)']) - - self.try_command('expr uchar4_local[1] = 22', - ['\'\\x16\''], - [r'\(u(nsigned )?char\)']) - self.try_command('frame variable uchar4_local[1]', - ['0x16'], - [r'\(u(nsigned )?char\)']) - - self._try_inspecting_local('uchar4_local', - ['(uchar4)', - '(0x16, 0x16, 0x2c, 0x37)']) - - @wimpy - def test_modify_short4(self): - self._try_modifying_local('short4_local[2]', '23', - ['(short)', '23']) - self._try_inspecting_local('short4_local', - ['(short4)', - '(-444, -555, 23, 777)']) - - def test_modify_vec4(self): - self._try_modifying_local('ushort4_local[3]', '24', - ['24'], [r'\(u(nsigned )?short\)']) - self._try_inspecting_local('ushort4_local', - ['(ushort4)', - '(666, 777, 888, 24)']) - - self._try_modifying_local('int4_local[0]', '-2525', - ['(int)', '-2525']) - self._try_inspecting_local('int4_local', - ['(int4)', - '(-2525, 999, -1111, 2222)']) - - self._try_modifying_local('uint4_local[1]', '26262', - ['26262'], [r'\(u(nsigned )?int\)']) - self._try_inspecting_local('uint4_local', - ['(uint4)', - '(1111, 26262, 3333, 4444)']) - - self._try_modifying_local('float4_local[2]', '27.0f', - ['(float)', '27']) - self._try_inspecting_local('float4_local', - ['(float4)', - '(3, 4.5, 27, -6.5)']) - - self._try_modifying_local('long4_local[3]', '-28282828282', - ['-28282828282'], [r'\((long )?long\)']) - self._try_inspecting_local('long4_local', - ['(long4)', - '(-3333, -4444, 5555, -28282828282)']) - - self._try_modifying_local('ulong4_local[0]', '2929292929', - ['2929292929'], - [r'\(u(nsigned )?(long )?long\)']) - self._try_inspecting_local('ulong4_local', - ['(ulong4)', - '(2929292929, 6666, 7777, 8888)']) - - self._try_modifying_local('double4_local[1]', '30.5', - ['(double)', '30.5']) - self._try_inspecting_local('double4_local', - ['(double4)', - '(-77, 30.5, -99, 111.5)']) |