search for: bracket_tmpfile

Displaying 4 results from an estimated 4 matches for "bracket_tmpfile".

2017 Jun 20
2
[PATCH v2 1/2] mllib: add new Common_utils.run_commands
...quot;] (String.lines_split "A\\\nB\n"); assert_equal_stringlist ["A\nB\n"] (String.lines_split "A\\\nB\\\n") +(* Test Common_utils.run_command. *) +let test_run_command ctx = + assert_equal_int 0 (run_command ["true"]); + begin + let tmpfile, chan = bracket_tmpfile ctx in + let res = run_command ["echo"; "this is a test"] ~stdout_chan:(Unix.descr_of_out_channel chan) in + assert_equal_int 0 res; + let content = read_whole_file tmpfile in + assert_equal_string "this is a test\n" content + end; + begin + let tmpfil...
2017 Apr 07
1
[PATCH 1/2] mllib: add new Common_utils.run_commands
...(["true"], None, None); (["false"], None, None)] in + assert_equal_intlist [0; 1] res + end; + begin + let res = run_commands [(["this-command-does-not-really-exist"], None, None)] in + assert_equal_intlist [127] res + end; + begin + let tmpfile, chan = bracket_tmpfile ctx in + let res = run_commands [(["echo"; "this is a test"], Some (Unix.descr_of_out_channel chan), None)] in + assert_equal_intlist [0] res; + let content = read_whole_file tmpfile in + assert_equal_string "this is a test\n" content + end; + begin +...
2018 Aug 23
2
[PATCH 1/2] mltools: JSON: add json_parser_tree_parse_file
.../mltools/JSON_parser_tests.ml +++ b/common/mltools/JSON_parser_tests.ml @@ -122,6 +122,28 @@ let test_tree_parse_inspect ctx = assert_is_number 10_L (List.nth a 2); assert_is_number 2_L (List.assoc "second" l) +let test_tree_parse_file_basic ctx = + begin + let tmpfile, chan = bracket_tmpfile ctx in + output_string chan "{}\n"; + flush chan; + close_out chan; + let value = json_parser_tree_parse_file tmpfile in + assert_is_object value + end; + begin + let tmpfile, chan = bracket_tmpfile ctx in + output_string chan "{\"foo\":5}\n"; +...
2018 Aug 17
8
[PATCH v3 4/4] v2v: Add --print-estimate option to print copy size
I rethought this again, as I think that it's a dangerous assumption to bake qemu-img measure output into our API. This patch series runs qemu-img measure behind the scenes, but then parses the output and sums it to a single number which we print. Doing that required a bit of reworking, moving the Jansson [JSON parser] bindings from virt-builder into the common directory and a couple of other