Revert "Revert "Full-stack integrity: check vdex contents.""

bug: 30972906

Initial revert due to 'check' file of the test needing updating for target tests.

This reverts commit a19b7649faf8780737be7ce3ec48a12d81c6d69f.

Change-Id: I455780bd88cd89ff80c9084d399e2beeb819b95f
diff --git a/test/677-fsi/build b/test/677-fsi/build
new file mode 100755
index 0000000..b90b408
--- /dev/null
+++ b/test/677-fsi/build
@@ -0,0 +1,17 @@
+#!/bin/bash
+#
+# Copyright 2018 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.
+
+./default-build "$@" --zip-compression-method store --zip-align 4
diff --git a/test/677-fsi/check b/test/677-fsi/check
new file mode 100644
index 0000000..a84cf65
--- /dev/null
+++ b/test/677-fsi/check
@@ -0,0 +1,23 @@
+#!/bin/bash
+#
+# 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.
+
+# Remove part of message containing the JDWP log (only on target)
+sed -s '/^.*JDWP support\./d' "$2" > "$2.tmp"
+
+# Remove part of message containing filename.
+sed -s 's/^.*: //' "$2.tmp" > "$2.tmp2"
+
+diff --strip-trailing-cr -q "$1" "$2.tmp2" >/dev/null
diff --git a/test/677-fsi/expected.txt b/test/677-fsi/expected.txt
new file mode 100644
index 0000000..c7fb8fe
--- /dev/null
+++ b/test/677-fsi/expected.txt
@@ -0,0 +1,3 @@
+oat file has dex code, but APK has uncompressed dex code
+oat file has dex code, but APK has uncompressed dex code
+Hello World
diff --git a/test/677-fsi/info.txt b/test/677-fsi/info.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/677-fsi/info.txt
diff --git a/test/677-fsi/run b/test/677-fsi/run
new file mode 100644
index 0000000..30d925e
--- /dev/null
+++ b/test/677-fsi/run
@@ -0,0 +1,19 @@
+#!/bin/bash
+#
+# Copyright (C) 2018 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 logger to stderr, as the test relies on error
+# messages being printed there.
+exec ${RUN} $@ -Xcompiler-option --copy-dex-files=always --runtime-option -Xonly-use-system-oat-files --runtime-option -Xuse-stderr-logger
diff --git a/test/677-fsi/src/Main.java b/test/677-fsi/src/Main.java
new file mode 100644
index 0000000..834075f
--- /dev/null
+++ b/test/677-fsi/src/Main.java
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2018 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.
+ */
+
+public class Main {
+  public static void main(String[] args) {
+    System.out.println("Hello World");
+  }
+}
diff --git a/test/knownfailures.json b/test/knownfailures.json
index cc3d200..8426a14 100644
--- a/test/knownfailures.json
+++ b/test/knownfailures.json
@@ -970,7 +970,10 @@
         "variant": "jvm",
         "bug": "b/73888836",
         "description": ["Failing on JVM. Needs further investigating."]
+    },
+    {
+        "tests": "677-fsi",
+        "variant": "no-dex2oat | no-image | no-prebuild | relocate-npatchoat",
+        "description": ["Test requires a successful dex2oat invocation"]
     }
-
-
 ]