summaryrefslogtreecommitdiffstats
path: root/debian/tests/metadata
blob: cf91d28117e44df3386dbcd404fbc11c0813d5ff (plain)
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
#!/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
    if [ "$agent" = "/usr/sbin/fence_virt" ]; then
      diff -u "$TESTXML" "$TMPXML"
    else
      gawk 'BEGIN {store=-1} /name=".*_path"/ || /name=".*_file"/ {store=2} {if (store!=0) {print}; store--}' "$TMPXML" \
      | diff -u "$TESTXML" -
    fi
  fi

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