OSDN Git Service

Fix failure in --no-dex2oat invocation of 425-invokesuper.
authorNicolas Geoffray <ngeoffray@google.com>
Thu, 13 Nov 2014 15:15:39 +0000 (15:15 +0000)
committerNicolas Geoffray <ngeoffray@google.com>
Mon, 17 Nov 2014 09:13:29 +0000 (09:13 +0000)
We had two issues:
- dexmerger is broken and sometimes produces invalid dex files,
  thus the test was always failing. b/18051191.
- The reason only no-dex2oat caught it is because it doesn't prebuild,
  and our scripts just do not report an error when the prebuild failed.

I also gave up trying to emit the dex2oat error output in the console.
I clearly don't speak bash.

Change-Id: I34c40902855452ea0f3e0d4733e4149c87236cfe

test/425-invoke-super/expected.txt
test/425-invoke-super/src/Main.java
test/run-test

index 1fb62d0..f3166fd 100644 (file)
@@ -39,6 +39,8 @@ public class Main {
   }
 
   public static void main(String[] args) throws Exception {
+    // Workaround for b/18051191.
+    System.out.println("Test started");
     assertEquals(1, new B().$opt$bar());
     assertEquals(1, new C().$opt$bar());
     assertEquals(1, new D().$opt$bar());
index b43668d..843714b 100755 (executable)
@@ -501,6 +501,8 @@ if ! ulimit -S "$file_size_limit"; then
 fi
 
 good="no"
+good_build="yes"
+good_run="yes"
 if [ "$dev_mode" = "yes" ]; then
     "./${build}" 2>&1
     build_exit="$?"
@@ -548,7 +550,15 @@ else
     if [ "$build_exit" = '0' ]; then
         echo "${test_dir}: running..." 1>&2
         "./${run}" $run_args "$@" >"$output" 2>&1
+        run_exit="$?"
+        if [ "$run_exit" != "0" ]; then
+            echo "run exit status: $run_exit" 1>&2
+            good_run="no"
+        else
+            good_run="yes"
+        fi
     else
+        good_build="no"
         cp "$build_output" "$output"
         echo "Failed to build in tmpdir=${tmp_dir} from oldwd=${oldwd} and cwd=`pwd`" >> "$output"
         echo "Non-canonical tmpdir was ${noncanonical_tmp_dir}" >> "$output"
@@ -561,9 +571,11 @@ else
     fi
     ./$check_cmd "$expected" "$output"
     if [ "$?" = "0" ]; then
-        # output == expected
-        good="yes"
-        echo "${test_dir}: succeeded!" 1>&2
+        if [ "$good_build" = "no" -o "$good_run" = "yes" ]; then
+          # output == expected
+          good="yes"
+          echo "${test_dir}: succeeded!" 1>&2
+        fi
     fi
 fi