blob: f221c821a0b265be3c2a81b9ccf6803bd4669389 [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
Martin Kopecec07b342023-01-24 17:38:45 +010011PKG_FILES=$(find $TOP/files/debs $TOP/files/rpms -type f)
Ian Wienandecf06db2015-11-09 17:42:23 +110012
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