From 4a08c0300cf6b0ee3bb5f755007641635ba21f9d Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sat, 21 Oct 2017 16:02:30 -0400 Subject: parse: Keep track of what files are already open Fixes #22 --- tests.sh | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'tests.sh') diff --git a/tests.sh b/tests.sh index 0f52581..9775292 100755 --- a/tests.sh +++ b/tests.sh @@ -330,6 +330,7 @@ gnu_tests=( test_flag_weird_names test_follow_comma test_fprint + test_fprint_duplicate test_double_dash test_flag_double_dash test_ignore_readdir_race @@ -931,16 +932,31 @@ function test_follow_comma() { } function test_fprint() { + invoke_bfs basic -fprint scratch/test_fprint.out + sort -o scratch/test_fprint.out scratch/test_fprint.out + if [ "$UPDATE" ]; then - invoke_bfs basic -fprint "$TESTS/test_fprint.out" - sort -o "$TESTS/test_fprint.out" "$TESTS/test_fprint.out" + cp scratch/test_fprint.out "$TESTS/test_fprint.out" else - invoke_bfs basic -fprint scratch/test_fprint.out - sort -o scratch/test_fprint.out scratch/test_fprint.out diff -u scratch/test_fprint.out "$TESTS/test_fprint.out" fi } +function test_fprint_duplicate() { + touchp scratch/test_fprint_duplicate.out + ln scratch/test_fprint_duplicate.out scratch/test_fprint_duplicate.hard + ln -s test_fprint_duplicate.out scratch/test_fprint_duplicate.soft + + invoke_bfs basic -fprint scratch/test_fprint_duplicate.out -fprint scratch/test_fprint_duplicate.hard -fprint scratch/test_fprint_duplicate.soft + sort -o scratch/test_fprint_duplicate.out scratch/test_fprint_duplicate.out + + if [ "$UPDATE" ]; then + cp scratch/test_fprint_duplicate.out "$TESTS/test_fprint_duplicate.out" + else + diff -u scratch/test_fprint_duplicate.out "$TESTS/test_fprint_duplicate.out" + fi +} + function test_double_dash() { cd basic bfs_diff -- . -type f -- cgit v1.2.3