Skip to content

Commit 4a675b6

Browse files
committed
ts: sort modules in JSON output as done on regular output
Signed-off-by: Xavier Delaruelle <[email protected]>
1 parent 93c22f3 commit 4a675b6

File tree

5 files changed

+2545
-2621
lines changed

5 files changed

+2545
-2621
lines changed

testsuite/config/base-config.exp

Lines changed: 0 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -813,63 +813,6 @@ proc _test_err {test_shell cmd answer failcmd} {
813813
}
814814
}
815815

816-
proc _test_err_json {test_shell cmd answer failcmd} {
817-
global comp_error
818-
global verbose
819-
set errdiff 0
820-
821-
# newline is expected at end of answer
822-
if {$answer ne {}} {
823-
append answer \n
824-
}
825-
826-
set comp_error_list [split $comp_error \n]
827-
set answer_list [split $answer \n]
828-
829-
# compare start and end structure of the document
830-
if {[lindex $comp_error_list 0] ne [lindex $answer_list 0]} {
831-
set errdiff 1
832-
}
833-
if {[lindex $comp_error_list end] ne [lindex $answer_list end]} {
834-
set errdiff 1
835-
}
836-
# sort document core content to compare it
837-
set comp_last_entry [lindex $comp_error_list end-2]
838-
set answer_last_entry [lindex $answer_list end-2]
839-
if {[string range $comp_last_entry end-2 end] ne [string range\
840-
$answer_last_entry end-2 end]} {
841-
set errdiff 1
842-
}
843-
# make last content line with same structure as other lines (finishing by "\},")
844-
if {[string index $comp_last_entry end] eq "\}"} {
845-
append comp_last_entry ,
846-
append answer_last_entry ,
847-
} else {
848-
set comp_last_entry [string replace $comp_last_entry end-1 end ,]
849-
set answer_last_entry [string replace $answer_last_entry end-1 end ,]
850-
}
851-
set comp_error_list [lreplace $comp_error_list end-2 end-2 $comp_last_entry]
852-
set answer_list [lreplace $answer_list end-2 end-2 $answer_last_entry]
853-
854-
set comp_error_sort [join [lsort $comp_error_list] \n]
855-
set answer_sort [join [lsort $answer_list] \n]
856-
857-
if {$comp_error_sort ne $answer_sort} {
858-
set errdiff 1
859-
}
860-
861-
if {$errdiff} {
862-
$failcmd "$cmd ($test_shell)"
863-
set ol [string length $comp_error_sort]
864-
set oe [string length $answer_sort]
865-
send_user "ERR\[$ol\]: '$comp_error_sort'#>\n"
866-
send_user "EXP\[$oe\]: '$answer_sort'#>\n"
867-
return 0;
868-
} else {
869-
return 1;
870-
}
871-
}
872-
873816
proc _test_err_re {test_shell cmd answer force_nl failcmd} {
874817
global comp_error
875818
global verbose
@@ -1175,25 +1118,6 @@ proc testouterr_cmd {test_shell cmd answer anserr {failcmd {fail}}} {
11751118
}
11761119
}
11771120

1178-
#
1179-
# Test procedure for full text matching with the stdout and json stderr
1180-
#
1181-
1182-
proc testouterrjson_cmd {test_shell cmd answer anserr {failcmd {fail}}} {
1183-
if {$test_shell eq "ALL"} {
1184-
global supported_shells
1185-
foreach shell $supported_shells {
1186-
testouterrjson_cmd $shell $cmd $answer $anserr
1187-
}
1188-
} else {
1189-
_test_sub $test_shell "$cmd"
1190-
if { [_test_out $test_shell "$cmd" "$answer" $failcmd]
1191-
&& [_test_err_json $test_shell "$cmd" "$anserr" $failcmd] } {
1192-
_test_ok $test_shell "$cmd"
1193-
}
1194-
}
1195-
}
1196-
11971121
#
11981122
# Test procedure for full text matching with stdout and specified file
11991123
#

testsuite/modules.51-scan/020-avail_output-variant.exp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -377,20 +377,20 @@ testouterr_cmd sh {avail -t --no-indepth variant/} OK $tserr
377377
setenv_var TESTSUITE_VARIANT 13
378378

379379
set tserr "{\"$mp\": {
380-
\"variant/6.0\": { \"name\": \"variant/6.0\", \"type\": \"modulefile\", \"symbols\": \[\], \"tags\": \[\], \"pathname\": \"$mp/variant/6.0\", \"via\": \"\"},
381-
\"variant/5.1\": { \"name\": \"variant/5.1\", \"type\": \"modulefile\", \"symbols\": \[\], \"tags\": \[\], \"pathname\": \"$mp/variant/5.1\", \"via\": \"\"},
382-
\"variant/7.0\": { \"name\": \"variant/7.0\", \"type\": \"modulefile\", \"symbols\": \[\], \"tags\": \[\], \"pathname\": \"$mp/variant/7.0\", \"via\": \"\"},
383-
\"variant/7.1\": { \"name\": \"variant/7.1\", \"type\": \"modulefile\", \"symbols\": \[\], \"tags\": \[\], \"pathname\": \"$mp/variant/7.1\", \"via\": \"\"},
384-
\"variant/8.0\": { \"name\": \"variant/8.0\", \"type\": \"modulefile\", \"symbols\": \[\], \"tags\": \[\], \"pathname\": \"$mp/variant/8.0\", \"via\": \"\"},
385-
\"variant/w s\": { \"name\": \"variant/w s\", \"type\": \"modulefile\", \"symbols\": \[\], \"tags\": \[\], \"pathname\": \"$mp/variant/w s\", \"via\": \"\"},
386380
\"variant/1.0\": { \"name\": \"variant/1.0\", \"type\": \"modulefile\", \"symbols\": \[\], \"tags\": \[\], \"pathname\": \"$mp/variant/1.0\", \"via\": \"\"},
387381
\"variant/2.0\": { \"name\": \"variant/2.0\", \"type\": \"modulefile\", \"symbols\": \[\], \"tags\": \[\], \"pathname\": \"$mp/variant/2.0\", \"via\": \"\"},
388-
\"variant/3.0\": { \"name\": \"variant/3.0\", \"type\": \"modulefile\", \"symbols\": \[\], \"tags\": \[\], \"pathname\": \"$mp/variant/3.0\", \"via\": \"\"},
389382
\"variant/2.1/2/1\": { \"name\": \"variant/2.1/2/1\", \"type\": \"modulefile\", \"symbols\": \[\], \"tags\": \[\], \"pathname\": \"$mp/variant/2.1/2/1\", \"via\": \"\"},
383+
\"variant/3.0\": { \"name\": \"variant/3.0\", \"type\": \"modulefile\", \"symbols\": \[\], \"tags\": \[\], \"pathname\": \"$mp/variant/3.0\", \"via\": \"\"},
390384
\"variant/4.0\": { \"name\": \"variant/4.0\", \"type\": \"modulefile\", \"symbols\": \[\], \"tags\": \[\], \"pathname\": \"$mp/variant/4.0\", \"via\": \"\"},
391-
\"variant/5.0\": { \"name\": \"variant/5.0\", \"type\": \"modulefile\", \"symbols\": \[\], \"tags\": \[\], \"pathname\": \"$mp/variant/5.0\", \"via\": \"\"}
385+
\"variant/5.0\": { \"name\": \"variant/5.0\", \"type\": \"modulefile\", \"symbols\": \[\], \"tags\": \[\], \"pathname\": \"$mp/variant/5.0\", \"via\": \"\"},
386+
\"variant/5.1\": { \"name\": \"variant/5.1\", \"type\": \"modulefile\", \"symbols\": \[\], \"tags\": \[\], \"pathname\": \"$mp/variant/5.1\", \"via\": \"\"},
387+
\"variant/6.0\": { \"name\": \"variant/6.0\", \"type\": \"modulefile\", \"symbols\": \[\], \"tags\": \[\], \"pathname\": \"$mp/variant/6.0\", \"via\": \"\"},
388+
\"variant/7.0\": { \"name\": \"variant/7.0\", \"type\": \"modulefile\", \"symbols\": \[\], \"tags\": \[\], \"pathname\": \"$mp/variant/7.0\", \"via\": \"\"},
389+
\"variant/7.1\": { \"name\": \"variant/7.1\", \"type\": \"modulefile\", \"symbols\": \[\], \"tags\": \[\], \"pathname\": \"$mp/variant/7.1\", \"via\": \"\"},
390+
\"variant/8.0\": { \"name\": \"variant/8.0\", \"type\": \"modulefile\", \"symbols\": \[\], \"tags\": \[\], \"pathname\": \"$mp/variant/8.0\", \"via\": \"\"},
391+
\"variant/w s\": { \"name\": \"variant/w s\", \"type\": \"modulefile\", \"symbols\": \[\], \"tags\": \[\], \"pathname\": \"$mp/variant/w s\", \"via\": \"\"}
392392
}}"
393-
testouterrjson_cmd sh {avail -j variant} OK $tserr
393+
testouterr_cmd sh {avail -j variant} OK $tserr
394394

395395
set tserr "{\"errors\": \[
396396
{ \"severity\": \"ERROR\", \"message\": \[ \"Unsupported option '-o' on json output mode\" \] } \]

0 commit comments

Comments
 (0)