Re: [PATCH 07/15] remote-mediawiki tests: guard test_cmp with test_path_is_file
From: Đoàn Trần Công Danh <hidden>
Date: 2020-09-16 20:47:02
On 2020-09-16 12:29:10+0200, Ævar Arnfjörð Bjarmason [off-list ref] wrote:
Change a test that used a plain test_cmp to first check the file(s) using test_path_is_file. If some of these file(s) don't exist (as happened to me during debugging), test_cmp will emit a way less useful message about the failure.
IIRC, [ref] was meant to solve this problem. The version you're using (v2.28.0-297-g1956fa8f8d) should have it integrated already. The test should barf with: error: bug in the test script: test_cmp '<file-name>' missing Am I missed anything? -- Danh
quoted hunk ↗ jump to hunk
Signed-off-by: Ævar Arnfjörð Bjarmason <redacted> --- contrib/mw-to-git/t/t9363-mw-to-git-export-import.sh | 7 +++++++ 1 file changed, 7 insertions(+)diff --git a/contrib/mw-to-git/t/t9363-mw-to-git-export-import.sh b/contrib/mw-to-git/t/t9363-mw-to-git-export-import.sh index 43580af3cf..d3de6c204a 100755 --- a/contrib/mw-to-git/t/t9363-mw-to-git-export-import.sh +++ b/contrib/mw-to-git/t/t9363-mw-to-git-export-import.sh@@ -52,9 +52,13 @@ test_expect_success 'git clone works on previously created wiki with media files test_when_finished "rm -rf mw_dir mw_dir_clone" && git clone -c remote.origin.mediaimport=true \ mediawiki::'"$WIKI_URL"' mw_dir_clone && + test_path_is_file mw_dir_clone/Foo.txt && + test_path_is_file mw_dir/Foo.txt && test_cmp mw_dir_clone/Foo.txt mw_dir/Foo.txt && (cd mw_dir_clone && git checkout HEAD^) && (cd mw_dir && git checkout HEAD^) && + test_path_is_file mw_dir_clone/Foo.txt && + test_path_is_file mw_dir/Foo.txt && test_cmp mw_dir_clone/Foo.txt mw_dir/Foo.txt '@@ -74,6 +78,8 @@ test_expect_success 'git clone works on previously created wiki with media files test_when_finished "rm -rf mw_dir mw_dir_clone" && git clone -c remote.origin.mediaimport=true \ mediawiki::'"$WIKI_URL"' mw_dir_clone && + test_path_is_file mw_dir_clone/Bar.txt && + test_path_is_file mw_dir/Bar.txt && test_cmp mw_dir_clone/Bar.txt mw_dir/Bar.txt '@@ -90,6 +96,7 @@ test_expect_success 'git push & pull work with locally renamed media files' ' git commit -m "Rename a file" && test_git_reimport && echo "A File" >expect && + test_path_is_file Bar.txt && test_cmp expect Bar.txt && test_path_is_missing Foo.txt )-- 2.28.0.297.g1956fa8f8d
-- Danh