+ # Make sure we print only the lines with blobs.
+ test="only blob"
+ odd=:
+ for string in \
+ "= {
+1, 0x2, 03, L'\x4'
+}" \
+ "1, 0x2, 03, L'\x4'" \
+\
+ "=
+{
+ '\\x1', '\\002'
+ ,
+ {
+ { \"\\x3\", },
+ \"\\004\"
+ },
+};" \
+ " '\\x1', '\\002'
+ ,
+ {
+ { \"\\x3\", },
+ \"\\004\"" \
+\
+ ".long 1,2
+ .long \$3,\$4" \
+ ".long 1,2
+ .long \$3,\$4" \
+\
+ "#define X { 1, 2, \\
+ 3, 4, /* comment */ \\
+ }" \
+ "#define X { 1, 2, \\
+ 3, 4, /* comment */ \\" \
+\
+ "= {
+/*
+ * multi-line
+ * comment
+ */
+ {
+ 0x4c00c000, 0x00000000, 0x00060000, 0x00000000,
+ },
+}" \
+ " 0x4c00c000, 0x00000000, 0x00060000, 0x00000000," \
+\
+ "MODULE_FIRMWARE(x);
+MODULE_FIRMWARE(y);
+1, 2, 3, 4; 5, 6, 7, 8;
+9, 10, 11" \
+ "MODULE_FIRMWARE(x);
+MODULE_FIRMWARE(y);
+::: - :::
+1, 2, 3, 4; 5, 6, 7, 8;" \
+\
+ "= {
+blob()
+accept()
+1, 2, 3, 4
+}" \
+ "blob()
+::: - :::
+1, 2, 3, 4" \
+\
+ "a blobeol y
+x" \
+ "a blobeol y
+x" \
+\
+ ; do
+ if $odd; then
+ input=$string odd=false
+ continue
+ fi
+ case `echo "$input" | $0 $targs -B` in
+ "::: - :::
+$string") ;;
+ *)
+ echo "failed $test test for:
+$input" >&2
+ pass=false
+ ;;
+ esac
+ odd=:
+ done
+ $odd || { echo "internal testsuite failure in $test" >&2; }
+
+ # Make sure we deblob only the blobs.
+ test="deblobs"
+ odd=:
+ for string in \
+ "= { 1, 0x2, 03, L'\x4' }" \
+ "= { /*(DEBLOBBED)*/' }" \
+\
+ "=
+{
+ '\\x1', '\\002'
+ ,
+ {
+ { \"\\x3\", },
+ \"\\004\"
+ },
+};" \
+ " '\\x/*(DEBLOBBED)*/\"" \
+\
+ ".long 1,2
+ .long \$3,\$4" \
+ ".long /*(DEBLOBBED)*/" \
+\
+ "#define X { 1, 2, \\
+ 3, 4, /* comment */ \\
+ }" \
+ "#define X { /*(DEBLOBBED)*/, /* comment */ \\" \
+\
+ "= {
+/*
+ * multi-line
+ * comment
+ */
+ {
+ 0x4c00c000, 0x00000000, 0x00060000, 0x00000000,
+ },
+}" \
+ " /*(DEBLOBBED)*/," \
+\
+ "MODULE_FIRMWARE(x);
+MODULE_FIRMWARE(y);
+1, 2, 3, 4; 5, 6; 7, 8, 9, 10;
+9, 10, 11" \
+ "/*(DEBLOBBED)*/
+::: - :::
+/*(DEBLOBBED)*/; 5, 6; /*(DEBLOBBED)*/;" \
+\
+ "= {
+accept() blob() x blob(
+) y
+}" \
+ "accept() /*(DEBLOBBED)*/ x /*(DEBLOBBED)*/ y" \
+\
+ "= {
+accept() blob() x blob(
+w) y
+}" \
+ "accept() /*(DEBLOBBED)*/ x /*(DEBLOBBED)*/ y" \
+\
+ "a blobeol y
+x" \
+ "a /*(DEBLOBBED)*/x" \
+\
+ ; do
+ if $odd; then
+ input=$string odd=false
+ continue
+ fi
+ case `echo "$input" | $0 $targs -b` in
+ "::: - :::
+$string") ;;
+ *)
+ echo "failed $test test for:
+$input" >&2
+ pass=false
+ ;;
+ esac
+ odd=:
+ done
+ $odd || { echo "internal testsuite failure in $test" >&2; }
+