blob: a568abf92858ae160c56487e1f2690a2d92ad33e [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
10PKG_FILES=$(find $TOP/files/debs $TOP/files/rpms $TOP/files/rpms-suse -type f)
11
12TMPDIR=$(mktemp -d)
13
14SORTED=${TMPDIR}/sorted
15UNSORTED=${TMPDIR}/unsorted
16
17for p in $PKG_FILES; do
18 grep -v '^#' $p > ${UNSORTED}
19 sort ${UNSORTED} > ${SORTED}
20
21 if [ -n "$(diff -c ${UNSORTED} ${SORTED})" ]; then
22 failed "$p is unsorted"
23 # output this, it's helpful to see what exactly is unsorted
24 diff -c ${UNSORTED} ${SORTED}
25 else
26 passed "$p is sorted"
27 fi
28done
29
30rm -rf ${TMPDIR}
31
32report_results