devstack/tests/test_package_ordering.sh
Sean Dague 6fff3cc035 Fix sorting on LC_ALL=C platforms
We made assumptions on the platform for sorting purposes, which turned
out to break with new images being deployed. Explicitly setting LC_ALL
should make this work.

Change-Id: Id65f1bff8e38c777fa406d88ac6a2355d6033d94
2016-03-08 12:00:15 -05:00

34 lines
714 B
Bash
Executable File

#!/bin/bash
# basic test to ensure that package-install files remain sorted
# alphabetically.
TOP=$(cd $(dirname "$0")/.. && pwd)
source $TOP/tests/unittest.sh
export LC_ALL=en_US.UTF-8
PKG_FILES=$(find $TOP/files/debs $TOP/files/rpms $TOP/files/rpms-suse -type f)
TMPDIR=$(mktemp -d)
SORTED=${TMPDIR}/sorted
UNSORTED=${TMPDIR}/unsorted
for p in $PKG_FILES; do
grep -v '^#' $p > ${UNSORTED}
sort ${UNSORTED} > ${SORTED}
if [ -n "$(diff -c ${UNSORTED} ${SORTED})" ]; then
failed "$p is unsorted"
# output this, it's helpful to see what exactly is unsorted
diff -c ${UNSORTED} ${SORTED}
else
passed "$p is sorted"
fi
done
rm -rf ${TMPDIR}
report_results