]> git.saurik.com Git - apt.git/commitdiff
tests: skip over -flags for first option in autotests
authorDavid Kalnischkies <david@kalnischkies.de>
Wed, 20 Jul 2016 12:56:06 +0000 (14:56 +0200)
committerDavid Kalnischkies <david@kalnischkies.de>
Fri, 22 Jul 2016 14:05:09 +0000 (16:05 +0200)
Otherwise calls like "apt -q install" end up calling "aptautotest_apt_q"
instead of "aptautotest_apt_install"

Gbp-Dch: Ignore

test/integration/framework

index 54adcf92d0f24c7ebce25becffadf2d51aa54279..792ba79d9ed43e5f96b7adbed72e1257272599aa 100644 (file)
@@ -1931,12 +1931,20 @@ mkdir() {
 ### general things about commands executed without writing the test every time.
 
 aptautotest() {
+       if [ $# -lt 3 ]; then return; fi
        local TESTCALL="$1"
        local CMD="$2"
        local FIRSTOPT="$3"
+       shift 2
+       for i in "$@"; do
+               if ! expr match "$i" '^-' >/dev/null 2>&1; then
+                       FIRSTOPT="$i"
+                       break
+               fi
+       done
+       shift
        local AUTOTEST="aptautotest_$(echo "${CMD##*/}_${FIRSTOPT}" | tr -d -c 'A-za-z0-9')"
        if command -v $AUTOTEST >/dev/null; then
-               shift 3
                # save and restore the *.output files from other tests
                # as we might otherwise override them in these automatic tests
                rm -rf "${TMPWORKINGDIRECTORY}/rootdir/tmp-before"