Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tsort: GNU test cases fail even though our output is still valid #7094

Open
jfinkels opened this issue Jan 8, 2025 · 0 comments
Open

tsort: GNU test cases fail even though our output is still valid #7094

jfinkels opened this issue Jan 8, 2025 · 0 comments

Comments

@jfinkels
Copy link
Collaborator

jfinkels commented Jan 8, 2025

For the test cases named tree-1 and tree-2 in the GNU test file tests/misc/tsort.pl, our implementation of tsort produces an output different from GNU tsort but still valid. (In general, there may be more than one valid topological ordering for a given directed acyclic graph.) The test cases will fail due to this difference.

One option is to use our build-gnu.sh script to modify the GNU test cases as follows:

diff --git a/tests/misc/tsort.pl b/tests/misc/tsort.pl
index f1ca28a08..1fb256139 100755
--- a/tests/misc/tsort.pl
+++ b/tests/misc/tsort.pl
@@ -41,9 +41,9 @@ my @Tests =
     {OUT => "a\nb\nc\nd\ne\nf\ng\n"}],
 
    ['tree-1', {IN => "a b b c c d d e e f f g\nc x x y y z\n"},
-    {OUT => "a\nb\nc\nx\nd\ny\ne\nz\nf\ng\n"}],
+    {OUT => "a\nb\nc\nd\nx\ne\ny\nf\nz\ng\n"}],
    ['tree-2', {IN => "a b b c c d d e e f f g\nc x x y y z\nf r r s s t\n"},
-    {OUT => "a\nb\nc\nx\nd\ny\ne\nz\nf\nr\ng\ns\nt\n"}],
+    {OUT => "a\nb\nc\nd\nx\ne\ny\nf\nz\ng\nr\ns\nt\n"}],
 
    # Before coreutils-5.0.1, given an odd number of input tokens,
    # tsort would accept that and treat the input as if an additional

Maybe there are other solutions as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant