Skip to content

Commit dbc4d87

Browse files
committed
[patch, test] md5 generates a different output to md5sum
Output of `md5sum somefile.txt`: ``` a4d518904c07e3e75fa612890e5c813 somefile.txt ``` Output of `md5 somefile.txt`: ``` MD5 (somefile.txt) = a4d518904c07e3e75fa612890e5c813 ``` The way the test works, is they take the first value from the file, which is not the hash value in case of `md5`. Fix is to run `md5 -r somefile.txt` which outputs: ``` a4d518904c07e3e75fa612890e5c813 somefile.txt ```
1 parent 8115bde commit dbc4d87

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

test/cli/index_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ struct index_test : public cli_test
1111
{
1212
if (std::system("echo foo | md5sum > /dev/null 2>&1") == 0)
1313
md5_cmd = "md5sum";
14-
else if (std::system("echo foo | md5 > /dev/null 2>&1") == 0)
15-
md5_cmd = "md5";
14+
else if (std::system("echo foo | md5 -r > /dev/null 2>&1") == 0)
15+
md5_cmd = "md5 -r";
1616

1717
ASSERT_FALSE(md5_cmd.empty());
1818
}

test/cli/search_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ struct search_test : public cli_test
1111
{
1212
if (std::system("echo foo | md5sum > /dev/null 2>&1") == 0)
1313
md5_cmd = "md5sum";
14-
else if (std::system("echo foo | md5 > /dev/null 2>&1") == 0)
15-
md5_cmd = "md5";
14+
else if (std::system("echo foo | md5 -r > /dev/null 2>&1") == 0)
15+
md5_cmd = "md5 -r";
1616

1717
ASSERT_FALSE(md5_cmd.empty());
1818
}

0 commit comments

Comments
 (0)