in
List.iter (generate_test_command_call test_name) seq;
generate_test_command_call ~test test_name last
+ | TestOutputDevice (seq, expected) ->
+ pr " /* TestOutputDevice for %s (%d) */\n" name i;
+ pr " const char *expected = \"%s\";\n" (c_quote expected);
+ let seq, last = get_seq_last seq in
+ let test () =
+ pr " r[5] = 's';\n";
+ pr " if (STRNEQ (r, expected)) {\n";
+ pr " fprintf (stderr, \"%s: expected \\\"%%s\\\" but got \\\"%%s\\\"\\n\", expected, r);\n" test_name;
+ pr " return -1;\n";
+ pr " }\n"
+ in
+ List.iter (generate_test_command_call test_name) seq;
+ generate_test_command_call ~test test_name last
| TestLastFail seq ->
pr " /* TestLastFail for %s (%d) */\n" name i;
let seq, last = get_seq_last seq in
*)
| TestOutputFileMD5 of seq * string
+ (* Run the command sequence and expect the output of the final
+ * command to be a string which is a block device name (we don't
+ * check the 5th character of the string, so "/dev/sda" == "/dev/vda").
+ *)
+ | TestOutputDevice of seq * string
+
(* Run the command sequence and expect the final command (only)
* to fail.
*)
| TestOutputLength (s, _) | TestOutputBuffer (s, _)
| TestOutputStruct (s, _)
| TestOutputFileMD5 (s, _)
+ | TestOutputDevice (s, _)
| TestLastFail s -> s
let c_quote str =