summaryrefslogtreecommitdiffstats
path: root/debian/tests/metadata
blob: 21c1eceea89da156f3ebcbdb990a812055d67c16 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh

set -e

TMPXML=$AUTOPKGTEST_TMP/xml

for agent in /usr/sbin/fence_*; do
  [ "$agent" = "/usr/sbin/fence_ack_manual" ] && continue

  printf '\nTesting %s...\n' "$agent"
  $agent -o metadata > "$TMPXML" 2> /dev/null
  cat "$TMPXML"

  TESTXML=tests/data/metadata/${agent##*/}.xml
  if [ -f "$TESTXML" ]; then
    gawk 'BEGIN {store=-1} /name=".*_path"/ || /name=".*_file"/ {store=2} {if (store!=0) {print}; store--}' "$TMPXML" \
    | diff -u "$TESTXML" -
  fi

  xsltproc lib/fence2rng.xsl "$TMPXML" \
  | sed -e 's/ rha:description=/ description=/g' -e 's/ rha:name=/ name=/g' \
  | xmllint --nsclean --noout -
done