On Mon, 29 Jul 2024 at 17:02, Thomas Schwinge <tschwi...@baylibre.com> wrote: > > Hi Jonathan! > > On 2024-07-22T17:28:38+0100, Jonathan Wakely <jwak...@redhat.com> wrote: > > This adds a new dg-final action to compare two files after a test has > > run, [...] > > Nice! > > > --- a/libstdc++-v3/testsuite/lib/libstdc++.exp > > +++ b/libstdc++-v3/testsuite/lib/libstdc++.exp > > > +# Compare output file written by test to expected result. > > +# With two arguments the comparison is done via 'diff arg1 arg2'. > > +# With one argument the comparison is done via 'diff arg1.tst arg1.txt'. > > +proc file-io-diff { args } { > > + set nargs [llength $args] > > + if { $nargs < 1 } { > > + error "too few arguments to file-io-diff" > > + } > > + if { $nargs > 2 } { > > + error "too many arguments to file-io-diff" > > + } > > + if { $nargs == 1 } { > > + set file1 [lindex $args 0] > > + set file2 "${file1}.txt" > > + append file1 ".tst" > > + } else { > > + set file1 [lindex $args 0] > > + set file2 [lindex $args 1] > > + } > > + > > + spawn -noecho diff -u $file1 $file2 > > + expect { > > + -re ".+" { > > + set msg "files differ\n" > > + append msg $expect_out(0,string) > > + fail $msg > > + exp_continue > > + } > > + } > > + return > > +} > > Via "deficient" GCN and nvptx target testing of my WIP C++ enablement > trees, I ran into a minor nuisance here; OK to push the attached > "Polish libstdc++ 'dg-final' action 'file-io-diff'"?
This is an excellent improvement to my janky tcl code, making the output more conventional. OK for trunk, thanks. > > On a proper target, powerpc64le GNU/Linux, with: > > $ echo yo >> libstdc++-v3/testsuite/data/istream_extractor_other-2.tst > > ... injected just for demonstration purposes (triggering for > '27_io/basic_istream/extractors_other/char/2.cc' one instance of > 'FAIL: files differ'), my patch changes 'libstdc++.sum' as follows: > > --- > build-gcc/powerpc64le-unknown-linux-gnu/libstdc++-v3/testsuite/libstdc++.sum > 2024-07-29 17:11:42.333879749 +0200 > +++ > build-gcc/powerpc64le-unknown-linux-gnu/libstdc++-v3/testsuite/libstdc++.sum > 2024-07-29 15:46:27.528214632 +0200 > @@ -1,2 +1,2 @@ > -Test run by tschwinge on Mon Jul 29 16:53:34 2024 > +Test run by tschwinge on Mon Jul 29 15:28:20 2024 > Native configuration is powerpc64le-unknown-linux-gnu > @@ -11075,2 +11075,3 @@ > PASS: 27_io/basic_filebuf/close/12790-1.cc -std=gnu++17 execution test > +PASS: 27_io/basic_filebuf/close/char/1.cc -std=gnu++17 file-io-diff > filebuf_members-1 > PASS: 27_io/basic_filebuf/close/char/1.cc -std=gnu++17 (test for excess > errors) > @@ -11722,2 +11723,4 @@ > PASS: 27_io/basic_istream/extractors_other/char/1.cc -std=gnu++17 > execution test > +PASS: 27_io/basic_istream/extractors_other/char/2.cc -std=gnu++17 > file-io-diff istream_extractor_other-1 > +FAIL: 27_io/basic_istream/extractors_other/char/2.cc -std=gnu++17 > file-io-diff istream_extractor_other-2 > PASS: 27_io/basic_istream/extractors_other/char/2.cc -std=gnu++17 (test > for excess errors) > @@ -11748,2 +11751,4 @@ > PASS: 27_io/basic_istream/extractors_other/wchar_t/1.cc -std=gnu++17 > execution test > +PASS: 27_io/basic_istream/extractors_other/wchar_t/2.cc -std=gnu++17 > file-io-diff wistream_extractor_other-1 > +PASS: 27_io/basic_istream/extractors_other/wchar_t/2.cc -std=gnu++17 > file-io-diff wistream_extractor_other-2 > PASS: 27_io/basic_istream/extractors_other/wchar_t/2.cc -std=gnu++17 > (test for excess errors) > @@ -11772,2 +11777,3 @@ > PASS: 27_io/basic_istream/get/char/1.cc -std=gnu++17 execution test > +PASS: 27_io/basic_istream/get/char/2.cc -std=gnu++17 file-io-diff > istream_unformatted-1 > PASS: 27_io/basic_istream/get/char/2.cc -std=gnu++17 (test for excess > errors) > @@ -11779,2 +11785,3 @@ > PASS: 27_io/basic_istream/get/wchar_t/1.cc -std=gnu++17 execution test > +PASS: 27_io/basic_istream/get/wchar_t/2.cc -std=gnu++17 file-io-diff > istream_unformatted-1 > PASS: 27_io/basic_istream/get/wchar_t/2.cc -std=gnu++17 (test for > excess errors) > @@ -11812,2 +11819,3 @@ > PASS: 27_io/basic_istream/ignore/char/2.cc -std=gnu++17 execution test > +PASS: 27_io/basic_istream/ignore/char/3.cc -std=gnu++17 file-io-diff > istream_unformatted-1 > PASS: 27_io/basic_istream/ignore/char/3.cc -std=gnu++17 (test for > excess errors) > @@ -11828,2 +11836,3 @@ > PASS: 27_io/basic_istream/ignore/wchar_t/2.cc -std=gnu++17 execution > test > +PASS: 27_io/basic_istream/ignore/wchar_t/3.cc -std=gnu++17 > file-io-diff istream_unformatted-1 > PASS: 27_io/basic_istream/ignore/wchar_t/3.cc -std=gnu++17 (test for > excess errors) > @@ -11844,2 +11853,3 @@ > PASS: 27_io/basic_istream/peek/char/12296.cc -std=gnu++17 execution test > +PASS: 27_io/basic_istream/peek/char/6414.cc -std=gnu++17 file-io-diff > istream_seeks-1 > PASS: 27_io/basic_istream/peek/char/6414.cc -std=gnu++17 (test for > excess errors) > @@ -11850,2 +11860,3 @@ > PASS: 27_io/basic_istream/peek/wchar_t/12296.cc -std=gnu++17 execution > test > +PASS: 27_io/basic_istream/peek/wchar_t/6414.cc -std=gnu++17 > file-io-diff wistream_seeks-1 > PASS: 27_io/basic_istream/peek/wchar_t/6414.cc -std=gnu++17 (test for > excess errors) > @@ -11893,2 +11904,4 @@ > PASS: 27_io/basic_istream/seekg/char/exceptions_badbit_throw.cc > -std=gnu++17 execution test > +PASS: 27_io/basic_istream/seekg/char/fstream.cc -std=gnu++17 > file-io-diff istream_seeks-1 > +PASS: 27_io/basic_istream/seekg/char/fstream.cc -std=gnu++17 > file-io-diff istream_seeks-2 > PASS: 27_io/basic_istream/seekg/char/fstream.cc -std=gnu++17 (test for > excess errors) > @@ -11907,2 +11920,4 @@ > PASS: 27_io/basic_istream/seekg/wchar_t/exceptions_badbit_throw.cc > -std=gnu++17 execution test > +PASS: 27_io/basic_istream/seekg/wchar_t/fstream.cc -std=gnu++17 > file-io-diff wistream_seeks-1 > +PASS: 27_io/basic_istream/seekg/wchar_t/fstream.cc -std=gnu++17 > file-io-diff wistream_seeks-2 > PASS: 27_io/basic_istream/seekg/wchar_t/fstream.cc -std=gnu++17 (test > for excess errors) > @@ -11941,2 +11956,4 @@ > PASS: 27_io/basic_istream/tellg/char/exceptions_badbit_throw.cc > -std=gnu++17 execution test > +PASS: 27_io/basic_istream/tellg/char/fstream.cc -std=gnu++17 > file-io-diff istream_seeks-1 > +PASS: 27_io/basic_istream/tellg/char/fstream.cc -std=gnu++17 > file-io-diff istream_seeks-2 > PASS: 27_io/basic_istream/tellg/char/fstream.cc -std=gnu++17 (test for > excess errors) > @@ -11955,2 +11972,4 @@ > PASS: 27_io/basic_istream/tellg/wchar_t/exceptions_badbit_throw.cc > -std=gnu++17 execution test > +PASS: 27_io/basic_istream/tellg/wchar_t/fstream.cc -std=gnu++17 > file-io-diff wistream_seeks-1 > +PASS: 27_io/basic_istream/tellg/wchar_t/fstream.cc -std=gnu++17 > file-io-diff wistream_seeks-2 > PASS: 27_io/basic_istream/tellg/wchar_t/fstream.cc -std=gnu++17 (test > for excess errors) > @@ -12026,2 +12045,3 @@ > PASS: 27_io/basic_ofstream/native_handle/wchar_t/1.cc -std=gnu++26 > execution test > +PASS: 27_io/basic_ofstream/open/char/1.cc -std=gnu++17 file-io-diff > ofstream_members-1 > PASS: 27_io/basic_ofstream/open/char/1.cc -std=gnu++17 (test for excess > errors) > @@ -12221,4 +12241,7 @@ > PASS: 27_io/basic_ostream/inserters_character/wchar_t/deleted.cc > -std=gnu++26 (test for excess errors) > +PASS: 27_io/basic_ostream/inserters_other/char/1.cc -std=gnu++17 > file-io-diff ostream_inserter_other-1 > +PASS: 27_io/basic_ostream/inserters_other/char/1.cc -std=gnu++17 > file-io-diff ostream_inserter_other-2 > PASS: 27_io/basic_ostream/inserters_other/char/1.cc -std=gnu++17 (test > for excess errors) > PASS: 27_io/basic_ostream/inserters_other/char/1.cc -std=gnu++17 > execution test > +PASS: 27_io/basic_ostream/inserters_other/char/2.cc -std=gnu++17 > file-io-diff ostream_inserter_other_in ostream_inserter_other_out > PASS: 27_io/basic_ostream/inserters_other/char/2.cc -std=gnu++17 (test > for excess errors) > @@ -12255,4 +12278,7 @@ > PASS: 27_io/basic_ostream/inserters_other/char/volatile_ptr.cc > -std=gnu++26 execution test > +PASS: 27_io/basic_ostream/inserters_other/wchar_t/1.cc -std=gnu++17 > file-io-diff wostream_inserter_other-1 > +PASS: 27_io/basic_ostream/inserters_other/wchar_t/1.cc -std=gnu++17 > file-io-diff wostream_inserter_other-2 > PASS: 27_io/basic_ostream/inserters_other/wchar_t/1.cc -std=gnu++17 > (test for excess errors) > PASS: 27_io/basic_ostream/inserters_other/wchar_t/1.cc -std=gnu++17 > execution test > +PASS: 27_io/basic_ostream/inserters_other/wchar_t/2.cc -std=gnu++17 > file-io-diff wostream_inserter_other_in.txt wostream_inserter_other_out.txt > PASS: 27_io/basic_ostream/inserters_other/wchar_t/2.cc -std=gnu++17 > (test for excess errors) > @@ -13103,2 +13129,3 @@ > PASS: 27_io/ios_base/storage/68197.cc -std=gnu++17 execution test > +PASS: 27_io/ios_base/sync_with_stdio/1.cc -std=gnu++17 file-io-diff > ios_base_members_static-1 > PASS: 27_io/ios_base/sync_with_stdio/1.cc -std=gnu++17 (test for excess > errors) > @@ -16601,3 +16628,2 @@ > PASS: ext/vstring/types/23767.cc -std=gnu++17 (test for excess errors) > -FAIL: files differ > PASS: special_functions/01_assoc_laguerre/check_nan.cc -std=gnu++17 > (test for excess errors) > @@ -19501,3 +19527,3 @@ > > -# of expected passes 18615 > +# of expected passes 18641 > # of unexpected failures 1 > > Note several instances of 'PASS: [...] file-io-diff [...]' appear, and > the unspecific 'FAIL: files differ' (near the end) turn into specific: > > FAIL: 27_io/basic_istream/extractors_other/char/2.cc -std=gnu++17 > file-io-diff istream_extractor_other-2 > > (Again, that FAIL's injected for demonstration purposes only.) > The '*.log' and '*.sum' files also look as expected. > > > Grüße > Thomas > >