test_{dwebp,lossless}.sh: add --extra_args

allows for arbitrary dwebp options to be passed in from the command line

Change-Id: I9e9c6fb98fb0c0b054466784665a75ccddb3053e
diff --git a/test_dwebp.sh b/test_dwebp.sh
index ce0d41b..a1deddf 100755
--- a/test_dwebp.sh
+++ b/test_dwebp.sh
@@ -21,6 +21,7 @@
   --exec=/path/to/dwebp
   --md5exec=</path/to/md5sum/replacement> (must support '-c')
   --mt
+  --extra_args=<dwebp args>
   --formats=format_list (default: $formats)
   --dump-md5s
 EOT
@@ -33,7 +34,8 @@
     shift
     # Decode the file to the requested formats.
     for fmt in $formats; do
-      eval ${executable} ${mt} -${fmt} "$@" -o "${f}.${fmt}" "$f" ${devnull}
+      eval ${executable} ${mt} -${fmt} ${extra_args} "$@" \
+        -o "${f}.${fmt}" "$f" ${devnull}
     done
 
     if [ "$dump_md5s" = "true" ]; then
@@ -65,6 +67,7 @@
         --formats=*) formats="${optval}";;
         --dump-md5s) dump_md5s="true";;
         --mt) mt="-mt";;
+        --extra_args=*) extra_args="${optval}";;
         -v) devnull="";;
         -*) usage;;
         *) [ -z "$tests" ] || usage; tests="$opt";;
diff --git a/test_lossless.sh b/test_lossless.sh
index 09ec281..ec04893 100755
--- a/test_lossless.sh
+++ b/test_lossless.sh
@@ -17,6 +17,7 @@
 
 Options:
   --exec=/path/to/dwebp
+  --extra_args=<dwebp args>
   --formats=format_list (default: $formats)
 EOT
     exit 1
@@ -29,7 +30,7 @@
     local reffile="$2"
     local outfile="$infile.${reffile##*.}"
     shift 2
-    eval ${executable} "$infile" -o "$outfile" "$@" ${devnull}
+    eval ${executable} "$infile" ${extra_args} -o "$outfile" "$@" ${devnull}
     diff -q -s "$outfile" "$reffile"
     rm -f "$outfile"
 }
@@ -41,6 +42,7 @@
     optval=${opt#*=}
     case ${opt} in
         --exec=*) executable="${optval}";;
+        --extra_args=*) extra_args="${optval}";;
         --formats=*) formats="${optval}";;
         -v) devnull="";;
         *) usage;;