@@ -238,6 +238,34 @@ test_expect_success 'subtest: --verbose option' '
EOF
'
+test_expect_success 'subtest: --write-junit-xml option' '
+ # both --write-junit-xml and lib-subtest.sh expect to use "out"
+ GIT_TEST_JUNIT_DIRECTORY=.junit-xml &&
+ export GIT_TEST_JUNIT_DIRECTORY &&
+
+ write_and_run_sub_test_lib_test_err write-junit-xml \
+ --write-junit-xml <<-\EOF &&
+ test_expect_success "--true <>" "true"
+ test_expect_success "--false <>" "false"
+ test_done
+ EOF
+ test_must_be_empty write-junit-xml/err &&
+
+ sed -e "s/^> //" -e "s/time[^>]*/.../g" >expect <<-\EOF &&
+ > <testsuites>
+ > <testsuite name="write-junit-xml" ...>
+ > <testcase name="write.1 --true <>" classname="write" ...>
+ > </testcase>
+ > <testcase name="write.2 --false <>" classname="write" ...>
+ > <failure message="not ok 2 - --false <>"> false
</failure>
+ > </testcase>
+ > </testsuite>
+ > </testsuites>
+ EOF
+ sed -e "s/time[^>]*/.../g" <write-junit-xml/.junit-xml/TEST-write-junit-xml.xml >actual &&
+ test_cmp expect actual
+'
+
test_expect_success 'subtest: --verbose-only option' '
run_sub_test_lib_test_err \
t1234-verbose \
@@ -22,7 +22,7 @@
# that are are called at the appropriate times during the test runs.
start_test_output () {
- junit_xml_dir="$TEST_OUTPUT_DIRECTORY/out"
+ junit_xml_dir="$TEST_OUTPUT_DIRECTORY/${GIT_TEST_JUNIT_DIRECTORY:-out}"
mkdir -p "$junit_xml_dir"
junit_xml_base=${1##*/}
junit_xml_path="$junit_xml_dir/TEST-${junit_xml_base%.sh}.xml"