]> git.ipfire.org Git - thirdparty/ldns.git/commitdiff
add coding style test
authorMiek Gieben <miekg@NLnetLabs.nl>
Tue, 14 Mar 2006 13:20:28 +0000 (13:20 +0000)
committerMiek Gieben <miekg@NLnetLabs.nl>
Tue, 14 Mar 2006 13:20:28 +0000 (13:20 +0000)
test/codingstyle.tpkg [new file with mode: 0644]

diff --git a/test/codingstyle.tpkg b/test/codingstyle.tpkg
new file mode 100644 (file)
index 0000000..47c901d
--- /dev/null
@@ -0,0 +1,188 @@
+#!/bin/sh
+# This is a shell archive (produced by GNU sharutils 4.2.1).
+# To extract the files from this archive, save it to some FILE, remove
+# everything before the `!/bin/sh' line above, then type `sh FILE'.
+#
+# Made on 2006-03-14 14:19 CET by <miekg@floep>.
+# Source directory was `/home/miekg/svn/libdns/trunk/test/codingstyle.dir'.
+#
+# Existing files will *not* be overwritten unless `-c' is specified.
+#
+# This shar contains:
+# length mode       name
+# ------ ---------- ------------------------------------------
+#    321 -rw------- codingstyle.dsc
+#     36 -rw------- codingstyle.help
+#    937 -rw------- codingstyle.test
+#
+save_IFS="${IFS}"
+IFS="${IFS}:"
+gettext_dir=FAILED
+locale_dir=FAILED
+first_param="$1"
+for dir in $PATH
+do
+  if test "$gettext_dir" = FAILED && test -f $dir/gettext \
+     && ($dir/gettext --version >/dev/null 2>&1)
+  then
+    set `$dir/gettext --version 2>&1`
+    if test "$3" = GNU
+    then
+      gettext_dir=$dir
+    fi
+  fi
+  if test "$locale_dir" = FAILED && test -f $dir/shar \
+     && ($dir/shar --print-text-domain-dir >/dev/null 2>&1)
+  then
+    locale_dir=`$dir/shar --print-text-domain-dir`
+  fi
+done
+IFS="$save_IFS"
+if test "$locale_dir" = FAILED || test "$gettext_dir" = FAILED
+then
+  echo=echo
+else
+  TEXTDOMAINDIR=$locale_dir
+  export TEXTDOMAINDIR
+  TEXTDOMAIN=sharutils
+  export TEXTDOMAIN
+  echo="$gettext_dir/gettext -s"
+fi
+if touch -am -t 200112312359.59 $$.touch >/dev/null 2>&1 && test ! -f 200112312359.59 -a -f $$.touch; then
+  shar_touch='touch -am -t $1$2$3$4$5$6.$7 "$8"'
+elif touch -am 123123592001.59 $$.touch >/dev/null 2>&1 && test ! -f 123123592001.59 -a ! -f 123123592001.5 -a -f $$.touch; then
+  shar_touch='touch -am $3$4$5$6$1$2.$7 "$8"'
+elif touch -am 1231235901 $$.touch >/dev/null 2>&1 && test ! -f 1231235901 -a -f $$.touch; then
+  shar_touch='touch -am $3$4$5$6$2 "$8"'
+else
+  shar_touch=:
+  echo
+  $echo 'WARNING: not restoring timestamps.  Consider getting and'
+  $echo "installing GNU \`touch', distributed in GNU File Utilities..."
+  echo
+fi
+rm -f 200112312359.59 123123592001.59 123123592001.5 1231235901 $$.touch
+#
+if mkdir _sh15085; then
+  $echo 'x -' 'creating lock directory'
+else
+  $echo 'failed to create lock directory'
+  exit 1
+fi
+# ============= codingstyle.dsc ==============
+if test -f 'codingstyle.dsc' && test "$first_param" != -c; then
+  $echo 'x -' SKIPPING 'codingstyle.dsc' '(file already exists)'
+else
+  $echo 'x -' extracting 'codingstyle.dsc' '(text)'
+  sed 's/^X//' << 'SHAR_EOF' > 'codingstyle.dsc' &&
+BaseName: codingstyle
+Version: 1.0
+Description: Check NSD CodingStyle: -l90 -nut -ce -nfca -nlp -ncdb -nsai -br -ts08 -i8
+CreationDate: Tue Mar 14 12:58:28 CET 2006
+Maintainer: Miek Gieben
+Category: 
+Component:
+CmdDepends: 
+Depends: 
+Help: codingstyle.help
+Pre: 
+Post: 
+Test: codingstyle.test
+AuxFiles: 
+Passed:
+Failure:
+SHAR_EOF
+  (set 20 06 03 14 12 58 58 'codingstyle.dsc'; eval "$shar_touch") &&
+  chmod 0600 'codingstyle.dsc' ||
+  $echo 'restore of' 'codingstyle.dsc' 'failed'
+  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
+  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
+    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
+    || $echo 'codingstyle.dsc:' 'MD5 check failed'
+81b3d2cd3741a3687f495d5a49f5a009  codingstyle.dsc
+SHAR_EOF
+  else
+    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'codingstyle.dsc'`"
+    test 321 -eq "$shar_count" ||
+    $echo 'codingstyle.dsc:' 'original size' '321,' 'current size' "$shar_count!"
+  fi
+fi
+# ============= codingstyle.help ==============
+if test -f 'codingstyle.help' && test "$first_param" != -c; then
+  $echo 'x -' SKIPPING 'codingstyle.help' '(file already exists)'
+else
+  $echo 'x -' extracting 'codingstyle.help' '(text)'
+  sed 's/^X//' << 'SHAR_EOF' > 'codingstyle.help' &&
+No arguments are used for this test
+SHAR_EOF
+  (set 20 06 03 14 12 59 12 'codingstyle.help'; eval "$shar_touch") &&
+  chmod 0600 'codingstyle.help' ||
+  $echo 'restore of' 'codingstyle.help' 'failed'
+  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
+  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
+    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
+    || $echo 'codingstyle.help:' 'MD5 check failed'
+5d749925e0abe1c66168ecf77206c92c  codingstyle.help
+SHAR_EOF
+  else
+    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'codingstyle.help'`"
+    test 36 -eq "$shar_count" ||
+    $echo 'codingstyle.help:' 'original size' '36,' 'current size' "$shar_count!"
+  fi
+fi
+# ============= codingstyle.test ==============
+if test -f 'codingstyle.test' && test "$first_param" != -c; then
+  $echo 'x -' SKIPPING 'codingstyle.test' '(file already exists)'
+else
+  $echo 'x -' extracting 'codingstyle.test' '(text)'
+  sed 's/^X//' << 'SHAR_EOF' > 'codingstyle.test' &&
+# #-- codingstyle.test --#
+# source the master var file when it's there
+[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master
+# use .tpkg.var.test for in test variable passing
+[ -f .tpkg.var.test ] && source .tpkg.var.test
+# svnserve resets the path, you may need to adjust it, like this:
+PATH=$PATH:/usr/sbin:/sbin:/usr/local/bin:/usr/local/sbin:.
+X
+L=90
+X
+st=0
+for i in ../../*.c; do
+X        case $OSTYPE in
+X        linux-gnu*)
+X                diff -w -u $i <(cat $i | indent -l$L -nut -ce -nfca -nlp -ncdb \
+X                -nsai -br -ts08 -i8) 
+X                ;;
+X        freebsd*) 
+X                diff -w -u $i <(cat $i | gindent -l$L -nut -ce -nfca -nlp -ncdb \
+X                -nsai -br -ts08 -i8) 
+X                ;;
+X        esac
+X              
+X        if [[ $? -eq 1 ]]; then
+X                st=1
+X        fi
+done
+if [[ $st -eq 1 ]]; then
+X        echo "There are coding style improvements possible..."
+X        exit 1
+fi
+Xexit 0
+SHAR_EOF
+  (set 20 06 03 14 14 19 52 'codingstyle.test'; eval "$shar_touch") &&
+  chmod 0600 'codingstyle.test' ||
+  $echo 'restore of' 'codingstyle.test' 'failed'
+  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
+  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
+    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
+    || $echo 'codingstyle.test:' 'MD5 check failed'
+23b305977e5b2ccc7210a7e3f8c888d6  codingstyle.test
+SHAR_EOF
+  else
+    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'codingstyle.test'`"
+    test 937 -eq "$shar_count" ||
+    $echo 'codingstyle.test:' 'original size' '937,' 'current size' "$shar_count!"
+  fi
+fi
+rm -fr _sh15085
+exit 0