blob: bfc2a1954fbace0e0131634c1595ef3cdd0b6fef [file] [log] [blame]
Ian Wienandecf06db2015-11-09 17:42:23 +11001#!/bin/bash
2
3# basic test to ensure that package-install files remain sorted
4# alphabetically.
5
6TOP=$(cd $(dirname "$0")/.. && pwd)
7
8source $TOP/tests/unittest.sh
9
Sean Dague6fff3cc2016-03-08 12:00:15 -050010export LC_ALL=en_US.UTF-8
Ian Wienandecf06db2015-11-09 17:42:23 +110011PKG_FILES=$(find $TOP/files/debs $TOP/files/rpms $TOP/files/rpms-suse -type f)
12
13TMPDIR=$(mktemp -d)
14
15SORTED=${TMPDIR}/sorted
16UNSORTED=${TMPDIR}/unsorted
17
18for p in $PKG_FILES; do
19 grep -v '^#' $p > ${UNSORTED}
20 sort ${UNSORTED} > ${SORTED}
21
22 if [ -n "$(diff -c ${UNSORTED} ${SORTED})" ]; then
23 failed "$p is unsorted"
24 # output this, it's helpful to see what exactly is unsorted
25 diff -c ${UNSORTED} ${SORTED}
26 else
27 passed "$p is sorted"
28 fi
29done
30
31rm -rf ${TMPDIR}
32
33report_results