upload android base code part1
This commit is contained in:
parent
e02f198e2d
commit
0a1de6c4b3
48159 changed files with 9071466 additions and 0 deletions
108
android/frameworks/rs/tests/java_api/RSTestBackward19/Android.mk
Normal file
108
android/frameworks/rs/tests/java_api/RSTestBackward19/Android.mk
Normal file
|
@ -0,0 +1,108 @@
|
|||
#
|
||||
# Copyright (C) 2017 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 is auto-generated by frameworks/rs/tests/java_api/RSUnitTests/RSUnitTests.py.
|
||||
# To change unit tests version, please run the Python script above.
|
||||
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE_TAGS := tests
|
||||
LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
|
||||
LOCAL_COMPATIBILITY_SUITE := device-tests
|
||||
LOCAL_RENDERSCRIPT_TARGET_API := 19
|
||||
LOCAL_MIN_SDK_VERSION := 17
|
||||
LOCAL_PACKAGE_NAME := RSTestBackward19
|
||||
my_rs_unit_tests_path := ../RSUnitTests/src/com/android/rs/unittest
|
||||
LOCAL_SRC_FILES := $(call all-java-files-under,src)\
|
||||
$(my_rs_unit_tests_path)/UnitTest.java\
|
||||
$(my_rs_unit_tests_path)/UT_alloc.java\
|
||||
$(my_rs_unit_tests_path)/alloc.rs\
|
||||
$(my_rs_unit_tests_path)/UT_array_alloc.java\
|
||||
$(my_rs_unit_tests_path)/array_alloc.rs\
|
||||
$(my_rs_unit_tests_path)/UT_array_init.java\
|
||||
$(my_rs_unit_tests_path)/array_init.rs\
|
||||
$(my_rs_unit_tests_path)/UT_atomic.java\
|
||||
$(my_rs_unit_tests_path)/atomic.rs\
|
||||
$(my_rs_unit_tests_path)/UT_bitfield.java\
|
||||
$(my_rs_unit_tests_path)/bitfield.rs\
|
||||
$(my_rs_unit_tests_path)/UT_bug_char.java\
|
||||
$(my_rs_unit_tests_path)/bug_char.rs\
|
||||
$(my_rs_unit_tests_path)/UT_check_dims.java\
|
||||
$(my_rs_unit_tests_path)/check_dims.rs\
|
||||
$(my_rs_unit_tests_path)/UT_clamp.java\
|
||||
$(my_rs_unit_tests_path)/clamp.rs\
|
||||
$(my_rs_unit_tests_path)/UT_clamp_relaxed.java\
|
||||
$(my_rs_unit_tests_path)/clamp_relaxed.rs\
|
||||
$(my_rs_unit_tests_path)/UT_constant.java\
|
||||
$(my_rs_unit_tests_path)/constant.rs\
|
||||
$(my_rs_unit_tests_path)/UT_convert.java\
|
||||
$(my_rs_unit_tests_path)/convert.rs\
|
||||
$(my_rs_unit_tests_path)/UT_convert_relaxed.java\
|
||||
$(my_rs_unit_tests_path)/convert_relaxed.rs\
|
||||
$(my_rs_unit_tests_path)/UT_copy_test.java\
|
||||
$(my_rs_unit_tests_path)/copy_test.rs\
|
||||
$(my_rs_unit_tests_path)/UT_element.java\
|
||||
$(my_rs_unit_tests_path)/element.rs\
|
||||
$(my_rs_unit_tests_path)/UT_foreach.java\
|
||||
$(my_rs_unit_tests_path)/foreach.rs\
|
||||
$(my_rs_unit_tests_path)/UT_foreach_bounds.java\
|
||||
$(my_rs_unit_tests_path)/foreach_bounds.rs\
|
||||
$(my_rs_unit_tests_path)/UT_fp_mad.java\
|
||||
$(my_rs_unit_tests_path)/fp_mad.rs\
|
||||
$(my_rs_unit_tests_path)/UT_instance.java\
|
||||
$(my_rs_unit_tests_path)/instance.rs\
|
||||
$(my_rs_unit_tests_path)/UT_int4.java\
|
||||
$(my_rs_unit_tests_path)/int4.rs\
|
||||
$(my_rs_unit_tests_path)/UT_kernel.java\
|
||||
$(my_rs_unit_tests_path)/kernel.rs\
|
||||
$(my_rs_unit_tests_path)/UT_kernel_struct.java\
|
||||
$(my_rs_unit_tests_path)/kernel_struct.rs\
|
||||
$(my_rs_unit_tests_path)/UT_math.java\
|
||||
$(my_rs_unit_tests_path)/math.rs\
|
||||
$(my_rs_unit_tests_path)/UT_min.java\
|
||||
$(my_rs_unit_tests_path)/min.rs\
|
||||
$(my_rs_unit_tests_path)/UT_noroot.java\
|
||||
$(my_rs_unit_tests_path)/noroot.rs\
|
||||
$(my_rs_unit_tests_path)/UT_primitives.java\
|
||||
$(my_rs_unit_tests_path)/primitives.rs\
|
||||
$(my_rs_unit_tests_path)/UT_refcount.java\
|
||||
$(my_rs_unit_tests_path)/refcount.rs\
|
||||
$(my_rs_unit_tests_path)/UT_reflection3264.java\
|
||||
$(my_rs_unit_tests_path)/reflection3264.rs\
|
||||
$(my_rs_unit_tests_path)/UT_rsdebug.java\
|
||||
$(my_rs_unit_tests_path)/rsdebug.rs\
|
||||
$(my_rs_unit_tests_path)/UT_rstime.java\
|
||||
$(my_rs_unit_tests_path)/rstime.rs\
|
||||
$(my_rs_unit_tests_path)/UT_rstypes.java\
|
||||
$(my_rs_unit_tests_path)/rstypes.rs\
|
||||
$(my_rs_unit_tests_path)/UT_sampler.java\
|
||||
$(my_rs_unit_tests_path)/sampler.rs\
|
||||
$(my_rs_unit_tests_path)/UT_static_globals.java\
|
||||
$(my_rs_unit_tests_path)/static_globals.rs\
|
||||
$(my_rs_unit_tests_path)/UT_struct.java\
|
||||
$(my_rs_unit_tests_path)/struct.rs\
|
||||
$(my_rs_unit_tests_path)/UT_struct_field_simple.java\
|
||||
$(my_rs_unit_tests_path)/struct_field_simple.rs\
|
||||
$(my_rs_unit_tests_path)/UT_unsigned.java\
|
||||
$(my_rs_unit_tests_path)/unsigned.rs\
|
||||
$(my_rs_unit_tests_path)/UT_vector.java\
|
||||
$(my_rs_unit_tests_path)/vector.rs\
|
||||
|
||||
include $(BUILD_PACKAGE)
|
||||
|
||||
my_rs_unit_tests_path :=
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2017 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.
|
||||
-->
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.android.rs.testbackward19">
|
||||
<uses-sdk
|
||||
android:minSdkVersion="17"
|
||||
android:targetSdkVersion="19" />
|
||||
|
||||
<application
|
||||
android:label="RSTestBackward19">
|
||||
<uses-library android:name="android.test.runner" />
|
||||
</application>
|
||||
|
||||
<instrumentation
|
||||
android:name="android.support.test.runner.AndroidJUnitRunner"
|
||||
android:targetPackage="com.android.rs.testbackward19"
|
||||
android:label="RenderScript Backward Compatibility Tests (19)" />
|
||||
</manifest>
|
|
@ -0,0 +1,101 @@
|
|||
/*
|
||||
* Copyright (C) 2017 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.testbackward19;
|
||||
|
||||
import com.android.rs.unittest.*;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.test.InstrumentationRegistry;
|
||||
import android.support.test.filters.MediumTest;
|
||||
import android.util.Log;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import org.junit.runners.Parameterized.Parameter;
|
||||
import org.junit.runners.Parameterized.Parameters;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* RSTestBackward19, functional test for platform RenderScript APIs.
|
||||
*
|
||||
* RSTestBackward19 is necessary in addition to RSTestBackward because setting the target api
|
||||
* to anything above 19 causes all tests to fail on API 19 and below
|
||||
*
|
||||
* However, setting the target api to 19 causes many tests to fail to compile, so backward
|
||||
* compatibility testing needs to be separated to pre-19 and post-19 API versions
|
||||
*
|
||||
* To run the test, please use command
|
||||
*
|
||||
* adb shell am instrument -w com.android.rs.testbackward19/android.support.test.runner.AndroidJUnitRunner
|
||||
*/
|
||||
@RunWith(Parameterized.class)
|
||||
public class RSBackward19CompatibilityTests {
|
||||
private static final String TAG = RSBackward19CompatibilityTests.class.getSimpleName();
|
||||
|
||||
/**
|
||||
* Returns the list of subclasses of UnitTest to run.
|
||||
*/
|
||||
@Parameters(name = "{0}")
|
||||
public static Iterable<?> getParams() throws Exception {
|
||||
int thisApiVersion = android.os.Build.VERSION.SDK_INT;
|
||||
|
||||
int minApiVersion = 17;
|
||||
if (thisApiVersion < minApiVersion) {
|
||||
Log.w(TAG,
|
||||
String.format("API version is less than %d, no tests running", minApiVersion));
|
||||
}
|
||||
|
||||
int maxApiVersion = 19;
|
||||
if (thisApiVersion > maxApiVersion) {
|
||||
Log.w(TAG,
|
||||
String.format("API version is greater than %d, please use RSTestBackward",
|
||||
maxApiVersion));
|
||||
}
|
||||
|
||||
Context ctx = InstrumentationRegistry.getTargetContext();
|
||||
|
||||
List<UnitTest> validUnitTests = new ArrayList<>();
|
||||
|
||||
Iterable<Class<? extends UnitTest>> testClasses =
|
||||
RSTests.getTestClassesForCurrentAPIVersion();
|
||||
for (Class<? extends UnitTest> testClass : testClasses) {
|
||||
UnitTest test = testClass.getDeclaredConstructor(Context.class).newInstance(ctx);
|
||||
validUnitTests.add(test);
|
||||
}
|
||||
|
||||
UnitTest.checkDuplicateNames(validUnitTests);
|
||||
|
||||
return validUnitTests;
|
||||
}
|
||||
|
||||
|
||||
@Parameter(0)
|
||||
public UnitTest mTest;
|
||||
|
||||
@Test
|
||||
@MediumTest
|
||||
public void testRSUnitTest() throws Exception {
|
||||
mTest.logStart(TAG, "RenderScript Backward Compatibility 19 Testing");
|
||||
mTest.runTest();
|
||||
mTest.logEnd(TAG);
|
||||
Assert.assertTrue(mTest.getSuccess());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
* Copyright (C) 2017 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.testbackward19;
|
||||
|
||||
import com.android.rs.unittest.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* This class is auto-generated by frameworks/rs/tests/java_api/RSUnitTests/RSUnitTests.py.
|
||||
* To change unit tests version, please run the Python script above.
|
||||
*/
|
||||
public class RSTests {
|
||||
public static Iterable<Class<? extends UnitTest>> getTestClassesForCurrentAPIVersion() {
|
||||
int thisApiVersion = android.os.Build.VERSION.SDK_INT;
|
||||
|
||||
ArrayList<Class<? extends UnitTest>> validClasses = new ArrayList<>();
|
||||
|
||||
if (thisApiVersion >= 19) {
|
||||
validClasses.add(UT_alloc.class);
|
||||
validClasses.add(UT_array_alloc.class);
|
||||
validClasses.add(UT_array_init.class);
|
||||
validClasses.add(UT_atomic.class);
|
||||
validClasses.add(UT_bitfield.class);
|
||||
validClasses.add(UT_bug_char.class);
|
||||
validClasses.add(UT_check_dims.class);
|
||||
validClasses.add(UT_clamp.class);
|
||||
validClasses.add(UT_clamp_relaxed.class);
|
||||
validClasses.add(UT_constant.class);
|
||||
validClasses.add(UT_convert.class);
|
||||
validClasses.add(UT_convert_relaxed.class);
|
||||
validClasses.add(UT_copy_test.class);
|
||||
validClasses.add(UT_element.class);
|
||||
validClasses.add(UT_foreach.class);
|
||||
validClasses.add(UT_foreach_bounds.class);
|
||||
validClasses.add(UT_fp_mad.class);
|
||||
validClasses.add(UT_instance.class);
|
||||
validClasses.add(UT_int4.class);
|
||||
validClasses.add(UT_kernel.class);
|
||||
validClasses.add(UT_kernel_struct.class);
|
||||
validClasses.add(UT_math.class);
|
||||
validClasses.add(UT_min.class);
|
||||
validClasses.add(UT_noroot.class);
|
||||
validClasses.add(UT_primitives.class);
|
||||
validClasses.add(UT_refcount.class);
|
||||
validClasses.add(UT_reflection3264.class);
|
||||
validClasses.add(UT_rsdebug.class);
|
||||
validClasses.add(UT_rstime.class);
|
||||
validClasses.add(UT_rstypes.class);
|
||||
validClasses.add(UT_sampler.class);
|
||||
validClasses.add(UT_static_globals.class);
|
||||
validClasses.add(UT_struct.class);
|
||||
validClasses.add(UT_struct_field_simple.class);
|
||||
validClasses.add(UT_unsigned.class);
|
||||
validClasses.add(UT_vector.class);
|
||||
}
|
||||
|
||||
return validClasses;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue