Merge "libeffects: Added support to test effects using 32 and 64 bit binaries" into qt-dev
am: 7ec75ad4ad

Change-Id: I6ff75f3c300977e8526d273c3473aedcf22df8b9
diff --git a/media/libeffects/lvm/tests/build_and_run_all_unit_tests.sh b/media/libeffects/lvm/tests/build_and_run_all_unit_tests.sh
index 5079634..a97acc9 100755
--- a/media/libeffects/lvm/tests/build_and_run_all_unit_tests.sh
+++ b/media/libeffects/lvm/tests/build_and_run_all_unit_tests.sh
@@ -24,9 +24,32 @@
 echo "testing lvm"
 adb shell mkdir -p $testdir
 adb push $ANDROID_BUILD_TOP/cts/tests/tests/media/res/raw/sinesweepraw.raw $testdir
-adb push $OUT/testcases/lvmtest/arm64/lvmtest $testdir
 adb push $OUT/testcases/snr/arm64/snr $testdir
 
+E_VAL=1
+if [ -z "$1" ]
+then
+    cmds=("adb push $OUT/testcases/lvmtest/arm64/lvmtest $testdir"
+          "adb push $OUT/testcases/lvmtest/arm/lvmtest $testdir"
+         )
+elif [ "$1" == "32" ]
+then
+    cmds="adb push $OUT/testcases/lvmtest/arm/lvmtest $testdir"
+elif [ "$1" == "64" ]
+then
+    cmds="adb push $OUT/testcases/lvmtest/arm64/lvmtest $testdir"
+else
+    echo ""
+    echo "Invalid \"val\""
+    echo "Usage:"
+    echo "      "$0" [val]"
+    echo "      where, val can be either 32 or 64."
+    echo ""
+    echo "      If val is not specified then both 32 bit and 64 bit binaries"
+    echo "      are tested."
+    exit $E_VAL
+fi
+
 flags_arr=(
     "-csE"
     "-eqE"
@@ -61,42 +84,45 @@
 # run multichannel effects at different configs, saving only the stereo channel
 # pair.
 error_count=0
-for flags in "${flags_arr[@]}"
+for cmd in "${cmds[@]}"
 do
-    for fs in ${fs_arr[*]}
+    $cmd
+    for flags in "${flags_arr[@]}"
     do
-        for chMask in {0..22}
+        for fs in ${fs_arr[*]}
         do
-            adb shell $testdir/lvmtest -i:$testdir/sinesweepraw.raw \
-                -o:$testdir/sinesweep_$((chMask))_$((fs)).raw -chMask:$chMask -fs:$fs $flags
+            for chMask in {0..22}
+            do
+                adb shell $testdir/lvmtest -i:$testdir/sinesweepraw.raw \
+                    -o:$testdir/sinesweep_$((chMask))_$((fs)).raw -chMask:$chMask -fs:$fs $flags
 
-            shell_ret=$?
-            if [ $shell_ret -ne 0 ]; then
-                echo "error: $shell_ret"
-                ((++error_count))
-            fi
+                shell_ret=$?
+                if [ $shell_ret -ne 0 ]; then
+                    echo "error: $shell_ret"
+                    ((++error_count))
+                fi
 
 
-            # two channel files should be identical to higher channel
-            # computation (first 2 channels).
-            # Do not compare cases where -bE is in flags (due to mono computation)
-            if [[ $flags != *"-bE"* ]] && [[ "$chMask" -gt 1 ]]
-            then
-                adb shell cmp $testdir/sinesweep_1_$((fs)).raw \
-                    $testdir/sinesweep_$((chMask))_$((fs)).raw
-            elif [[ $flags == *"-bE"* ]] && [[ "$chMask" -gt 1 ]]
-            then
-                adb shell $testdir/snr $testdir/sinesweep_1_$((fs)).raw \
-                    $testdir/sinesweep_$((chMask))_$((fs)).raw -thr:90.308998
-            fi
+                # two channel files should be identical to higher channel
+                # computation (first 2 channels).
+                # Do not compare cases where -bE is in flags (due to mono computation)
+                if [[ $flags != *"-bE"* ]] && [[ "$chMask" -gt 1 ]]
+                then
+                    adb shell cmp $testdir/sinesweep_1_$((fs)).raw \
+                        $testdir/sinesweep_$((chMask))_$((fs)).raw
+                elif [[ $flags == *"-bE"* ]] && [[ "$chMask" -gt 1 ]]
+                then
+                    adb shell $testdir/snr $testdir/sinesweep_1_$((fs)).raw \
+                        $testdir/sinesweep_$((chMask))_$((fs)).raw -thr:90.308998
+                fi
 
-            # both cmp and snr return EXIT_FAILURE on mismatch.
-            shell_ret=$?
-            if [ $shell_ret -ne 0 ]; then
-                echo "error: $shell_ret"
-                ((++error_count))
-            fi
-
+                # both cmp and snr return EXIT_FAILURE on mismatch.
+                shell_ret=$?
+                if [ $shell_ret -ne 0 ]; then
+                    echo "error: $shell_ret"
+                    ((++error_count))
+                fi
+            done
         done
     done
 done