File: lint-common.sh

package info (click to toggle)
glib2.0 2.86.1-2
  • links: PTS, VCS
  • area: main
  • in suites: experimental, sid
  • size: 67,012 kB
  • sloc: ansic: 544,596; python: 9,702; sh: 1,612; xml: 1,482; perl: 1,222; cpp: 535; makefile: 321; javascript: 11
file content (46 lines) | stat: -rw-r--r-- 947 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env bash
# Copyright 2016-2018 Simon McVittie
# Copyright 2018-2024 Collabora Ltd.
# SPDX-License-Identifier: LGPL-2.1-or-later

set -eu

skip_all () {
    echo "1..0 # SKIP $*"
    exit 0
}

main () {
    local need_git=
    local tool

    cd "$G_TEST_SRCDIR/.."
    echo "TAP version 13"

    # shellcheck disable=SC2046
    for tool in ${TEST_REQUIRES_TOOLS-}; do
        command -v "$tool" >/dev/null || skip_all "$tool not found"
        if [ "$tool" = git ]; then
            need_git=1
        fi
    done

    if [ -n "${need_git-}" ] && ! test -e .git; then
        skip_all "not a git checkout"
    fi

    echo "1..1"

    if run_lint >&2; then
        echo "ok 1"
        exit 0
    elif [ -n "${LINT_WARNINGS_ARE_ERRORS-}" ]; then
        echo "not ok 1 - warnings from ${TEST_NAME-"lint tool"}"
        exit 1
    else
        echo "not ok 1 # TO""DO warnings from ${TEST_NAME-"lint tool"}"
        exit 0
    fi
}

main