File: ilsm-test.bash

package info (click to toggle)
libinline-perl 0.86-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 504 kB
  • sloc: perl: 3,147; sh: 57; makefile: 2
file content (64 lines) | stat: -rwxr-xr-x 1,124 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env bash

set -e

export PERL5LIB=$PWD/lib

ILSM=(
  ingydotnet/inline-c-pm
  daoswald/Inline-CPP
)

main() {
  for repo in ${ILSM[@]}; do
    echo "Testing '$repo'"
    check-repo || continue
    (
      set -x
      cd "$repo_path"
      if [ -e Meta ]; then
        make test
        make cpantest
        make disttest
      else
        perl Makefile.PL < /dev/null
        make test
        make purge
      fi
    )
  done
  echo "All ILSM tests passed!"
}

check-repo() {
  repo_path="test/devel/repo/${repo#*/}"
  if [ ! -e "$repo_path" ]; then
    mkdir -p test/devel
    git clone "git@github.com:$repo" "$repo_path"
  else
    (
      set -x
      cd "$repo_path"
      branch="$(git rev-parse --abbrev-ref HEAD)"
      if [ "$branch" != master ]; then
        echo "Repo '$repo_path' is not on master"
      fi
      git reset --hard
      git clean -fxd
      if [ -n "$(git status -s)" ]; then
        die "Repo '$repo_path' is not clean"
      fi
      git pull --rebase origin master
    ) || return 1
  fi
  return 0
}

die() {
  echo "$@"
  exit 1
}

[ "$BASH_SOURCE" == "$0" ] && main "$@"

: