summaryrefslogtreecommitdiff
path: root/test/178-app-image-native-method
diff options
context:
space:
mode:
Diffstat (limited to 'test/178-app-image-native-method')
-rw-r--r--[-rwxr-xr-x]test/178-app-image-native-method/build.py (renamed from test/178-app-image-native-method/check)17
-rw-r--r--test/178-app-image-native-method/run27
-rw-r--r--test/178-app-image-native-method/run.py33
-rw-r--r--test/178-app-image-native-method/src/Main.java2
-rw-r--r--test/178-app-image-native-method/test-metadata.json5
5 files changed, 46 insertions, 38 deletions
diff --git a/test/178-app-image-native-method/check b/test/178-app-image-native-method/build.py
index 45d365470c..7025b8150a 100755..100644
--- a/test/178-app-image-native-method/check
+++ b/test/178-app-image-native-method/build.py
@@ -1,12 +1,11 @@
-#!/bin/bash
#
-# Copyright (C) 2019 The Android Open Source Project
+# Copyright (C) 2022 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
+# 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,
@@ -14,12 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-# Inputs:
-# $1: Test's expected standard output
-# $2: Test's actual standard output
-# $3: Test's expected standard error
-# $4: Test's actual standard error
-# Filter out error messages for missing native methods.
-diff --strip-trailing-cr -q "$1" "$2" >/dev/null \
- && grep -v 'No implementation found for ' "$4" | diff -q "$3" - >/dev/null
+def build(ctx):
+ if ctx.jvm:
+ return # The test does not build on JVM
+ ctx.default_build()
diff --git a/test/178-app-image-native-method/run b/test/178-app-image-native-method/run
deleted file mode 100644
index 7cd0d57acc..0000000000
--- a/test/178-app-image-native-method/run
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/bin/bash
-#
-# Copyright (C) 2019 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.
-
-# Use a profile to put specific classes in the app image. Increase the large
-# method threshold to compile Main.$noinline$opt$testCriticalSignatures().
-${RUN} $@ --profile -Xcompiler-option --compiler-filter=speed-profile \
- -Xcompiler-option --large-method-max=2000
-return_status1=$?
-
-# Also run with the verify filter to avoid compiling JNI stubs.
-${RUN} ${@} --profile -Xcompiler-option --compiler-filter=verify
-return_status2=$?
-
-(exit ${return_status1}) && (exit ${return_status2})
diff --git a/test/178-app-image-native-method/run.py b/test/178-app-image-native-method/run.py
new file mode 100644
index 0000000000..5f8c50700b
--- /dev/null
+++ b/test/178-app-image-native-method/run.py
@@ -0,0 +1,33 @@
+#!/bin/bash
+#
+# Copyright (C) 2019 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.
+
+
+def run(ctx, args):
+ # Use a profile to put specific classes in the app image. Increase the large
+ # method threshold to compile Main.$noinline$opt$testCriticalSignatures().
+ ctx.default_run(
+ args,
+ profile=True,
+ Xcompiler_option=[
+ "--compiler-filter=speed-profile", "--large-method-max=2000"
+ ])
+
+ # Also run with the verify filter to avoid compiling JNI stubs.
+ ctx.default_run(
+ args, profile=True, Xcompiler_option=["--compiler-filter=verify"])
+
+ # Filter out error messages for missing native methods.
+ ctx.run(fr"sed -i '/No implementation found for/d' '{args.stderr_file}'")
diff --git a/test/178-app-image-native-method/src/Main.java b/test/178-app-image-native-method/src/Main.java
index 294ad4739b..877efa4be4 100644
--- a/test/178-app-image-native-method/src/Main.java
+++ b/test/178-app-image-native-method/src/Main.java
@@ -17,6 +17,8 @@
import dalvik.annotation.optimization.FastNative;
import dalvik.annotation.optimization.CriticalNative;
+// clang-format off
+
public class Main {
public static void main(String[] args) throws Exception {
diff --git a/test/178-app-image-native-method/test-metadata.json b/test/178-app-image-native-method/test-metadata.json
new file mode 100644
index 0000000000..75f6c0270f
--- /dev/null
+++ b/test/178-app-image-native-method/test-metadata.json
@@ -0,0 +1,5 @@
+{
+ "build-param": {
+ "jvm-supported": "false"
+ }
+}