Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/freebsd/poudriere.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan Drewery <bryan@shatow.net>2022-11-04 22:38:07 +0300
committerBryan Drewery <bryan@shatow.net>2022-11-05 18:45:14 +0300
commitd39e50622bb73b274e905a7fb12a909ee4435690 (patch)
tree384055c5cc1313554dd10365f7e792ddd65e99a1
parent4c3635fc07a5724bf5991997a04d55cc61e0f083 (diff)
bulk tests: Auto sort the expected lists
-rw-r--r--test/common.bulk.sh31
1 files changed, 19 insertions, 12 deletions
diff --git a/test/common.bulk.sh b/test/common.bulk.sh
index b75cd3df..f0774126 100644
--- a/test/common.bulk.sh
+++ b/test/common.bulk.sh
@@ -449,6 +449,14 @@ do_bulk() {
"$@"
}
+sorted() {
+ if [ "$#" -eq 0 ]; then
+ echo
+ return 0
+ fi
+ echo "$@" | tr ' ' '\n' | LC_ALL=C sort | paste -s -d ' ' -
+}
+
assert_bulk_queue_and_stats() {
local expanded_LISTPORTS_NOIGNORED
local EXPECTED_LISTPORTS_IGNORED EXPECTED_LISTPORTS_NOIGNORED
@@ -480,24 +488,26 @@ assert_bulk_queue_and_stats() {
# Assert the listed which are ignored is right
# This is testing the test framework
- assert "${EXPECTED_LISTPORTS_IGNORED}" \
- "${LISTPORTS_IGNORED-null}" \
+ assert "$(sorted ${EXPECTED_LISTPORTS_IGNORED})" \
+ "$(sorted ${LISTPORTS_IGNORED-null})" \
"LISTPORTS_IGNORED should match"
# Assert the non-ignored ports list is right
# This is testing the test framework
- assert "${EXPECTED_LISTPORTS_NOIGNORED}" \
- "${LISTPORTS_NOIGNORED-null}" \
+ assert "$(sorted ${EXPECTED_LISTPORTS_NOIGNORED})" \
+ "$(sorted ${LISTPORTS_NOIGNORED-null})" \
"LISTPORTS_NOIGNORED should match"
# Assert that IGNOREDPORTS was populated by the framework right.
# This is testing the test framework
- assert "${EXPECTED_IGNORED-}" "${IGNOREDPORTS-null}" \
+ assert "$(sorted ${EXPECTED_IGNORED-})" \
+ "$(sorted ${IGNOREDPORTS-null})" \
"IGNOREDPORTS should match"
# Assert that skipped ports are right
# This is testing the test framework
- assert "${EXPECTED_SKIPPED-}" "${SKIPPEDPORTS-null}" \
+ assert "$(sorted ${EXPECTED_SKIPPED-})" \
+ "$(sorted ${SKIPPEDPORTS-null})" \
"SKIPPEDPORTS should match"
### Now do tests against the output of the bulk run. ###
@@ -708,8 +718,7 @@ ALL_ORIGINS=
if [ ${ALL} -eq 1 ]; then
LISTPORTS="$(listed_ports | paste -s -d ' ' -)"
fi
-LISTPORTS="$(echo "${LISTPORTS}" | tr ' ' '\n' |
- LC_ALL=C sort | sed '/^$/d' | paste -s -d ' ' -)"
+LISTPORTS="$(sorted "${LISTPORTS}")"
echo -n "Gathering metadata for requested ports..."
IGNOREDPORTS=""
SKIPPEDPORTS=""
@@ -718,10 +727,8 @@ for origin in ${LISTPORTS}; do
cache_pkgnames 0 "${origin}" || :
done
echo " done"
-IGNOREDPORTS="$(echo "${IGNOREDPORTS}" | tr ' ' '\n' |
- LC_ALL=C sort | sed '/^$/d' | paste -s -d ' ' -)"
-SKIPPEDPORTS="$(echo "${SKIPPEDPORTS}" | tr ' ' '\n' |
- LC_ALL=C sort | sed '/^$/d' | paste -s -d ' ' -)"
+IGNOREDPORTS="$(sorted "${IGNOREDPORTS}")"
+SKIPPEDPORTS="$(sorted "${SKIPPEDPORTS}")"
expand_origin_flavors "${LISTPORTS}" LISTPORTS_EXPANDED
# Separate out IGNORED ports
LISTPORTS_NOIGNORED="${LISTPORTS_EXPANDED}"