File: test

package info (click to toggle)
libvpl-tools 1.4.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,652 kB
  • sloc: cpp: 107,469; python: 4,303; ansic: 3,202; sh: 159; lisp: 52; makefile: 13
file content (47 lines) | stat: -rwxr-xr-x 996 bytes parent folder | download | duplicates (2)
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
47
#!/bin/bash
###############################################################################
# Copyright (C) Intel Corporation
#
# SPDX-License-Identifier: MIT
###############################################################################
# Run the test suite.
#
# Scope can be limited by providing subset of tests as argumene from among:
# lint, unit
set -o errexit ; set -o nounset

if [ -z "$BASH_VERSION" ]; then
  echo "This script must be run under bash"
  exit 1
fi

script_dir="$( cd "$(dirname "${BASH_SOURCE[0]:-$0}")" >/dev/null 2>&1 ; pwd -P )"

proj_dir="$(dirname "$script_dir")"

if [ $# -eq 0 ]; then
  # if no arguments provided enable all testing
  do_lint=true
else
  do_lint=false
fi

while test $# -gt 0
do
  case "$1" in
    lint) do_lint=true
      ;;
    *) echo "invalid option: '$1'";
      exit 1
      ;;
  esac
  shift
done

if [ "$do_lint" = true ] ; then
  pushd "${proj_dir}"
  pre-commit run --all-files
  pre-commit run --hook-stage manual gitlint-ci
  popd
fi