Merge "Added data consistency check for single source"
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/SingleSourceForEachTest.java b/tests/tests/renderscript/src/android/renderscript/cts/SingleSourceForEachTest.java
index 06eb606..5f17655 100644
--- a/tests/tests/renderscript/src/android/renderscript/cts/SingleSourceForEachTest.java
+++ b/tests/tests/renderscript/src/android/renderscript/cts/SingleSourceForEachTest.java
@@ -125,4 +125,11 @@
baselineOutputAlloc.copyTo(baselineOutputArray);
checkArray(baselineOutputArray, testOutputArray, Y, X, X);
}
+
+ public void testConsistency() {
+ s.invoke_testConsistency(testInputAlloc, testOutputAlloc);
+ mRS.finish();
+ waitForMessage();
+ checkForErrors();
+ }
}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/single_source_script.rs b/tests/tests/renderscript/src/android/renderscript/cts/single_source_script.rs
index 5e35aa3..c3e322b 100644
--- a/tests/tests/renderscript/src/android/renderscript/cts/single_source_script.rs
+++ b/tests/tests/renderscript/src/android/renderscript/cts/single_source_script.rs
@@ -27,9 +27,9 @@
}
void RS_KERNEL bar(int x, int y) {
- int a = rsGetElementAt_int(gAllocOut, x, y);
- a++;
- rsSetElementAt_int(gAllocOut, a, x, y);
+ int a = rsGetElementAt_int(gAllocOut, x, y);
+ a++;
+ rsSetElementAt_int(gAllocOut, a, x, y);
}
void testSingleInput(rs_allocation in, rs_allocation out) {
@@ -58,3 +58,19 @@
opts.yEnd = dimY;
rsForEachWithOptions(bar, &opts);
}
+
+void testConsistency(rs_allocation in, rs_allocation out) {
+ rsForEach(foo, in, out);
+ const uint32_t dimX = rsAllocationGetDimX(in);
+ const uint32_t dimY = rsAllocationGetDimY(in);
+ for (int i = 0; i < dimX; i++) {
+ for (int j = 0; j < dimY; j++) {
+ if (rsGetElementAt_int(out, i, j) != 2 * rsGetElementAt_int(in, i, j)) {
+ rsSendToClientBlocking(RS_MSG_TEST_FAILED);
+ return;
+ }
+ }
+ }
+ rsSendToClientBlocking(RS_MSG_TEST_PASSED);
+}
+