Author: mzugec
Date: Thu Aug 21 16:45:59 2008
New Revision: 50288
URL: http://svn.opensuse.org/viewcvs/yast?rev=50288&view=rev
Log:
added testsuite+package directories
Added:
branches/tmp/mzugec/supportconfig/package/
branches/tmp/mzugec/supportconfig/package/.cvsignore
branches/tmp/mzugec/supportconfig/package/yast2-supportconfig.changes
branches/tmp/mzugec/supportconfig/testsuite/
branches/tmp/mzugec/supportconfig/testsuite/.cvsignore
branches/tmp/mzugec/supportconfig/testsuite/Makefile.am
branches/tmp/mzugec/supportconfig/testsuite/config/
branches/tmp/mzugec/supportconfig/testsuite/config/default.exp
branches/tmp/mzugec/supportconfig/testsuite/config/unix.exp
branches/tmp/mzugec/supportconfig/testsuite/config/unknown.exp
branches/tmp/mzugec/supportconfig/testsuite/run/
branches/tmp/mzugec/supportconfig/testsuite/run/runtest.sh (with props)
branches/tmp/mzugec/supportconfig/testsuite/tests/
branches/tmp/mzugec/supportconfig/testsuite/tests/.cvsignore
branches/tmp/mzugec/supportconfig/testsuite/tests/Supportconfig.err
branches/tmp/mzugec/supportconfig/testsuite/tests/Supportconfig.out
branches/tmp/mzugec/supportconfig/testsuite/tests/Supportconfig.ycp
branches/tmp/mzugec/supportconfig/testsuite/yast2-supportconfig.test/
branches/tmp/mzugec/supportconfig/testsuite/yast2-supportconfig.test/testsuite.exp
Added: branches/tmp/mzugec/supportconfig/package/.cvsignore
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/mzugec/supportconfig/package/.cvsignore?rev=50288&view=auto
==============================================================================
--- branches/tmp/mzugec/supportconfig/package/.cvsignore (added)
+++ branches/tmp/mzugec/supportconfig/package/.cvsignore Thu Aug 21 16:45:59 2008
@@ -0,0 +1,2 @@
+*.spec
+*.bz2
Added: branches/tmp/mzugec/supportconfig/package/yast2-supportconfig.changes
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/mzugec/supportconfig/package/yast2-supportconfig.changes?rev=50288&view=auto
==============================================================================
--- branches/tmp/mzugec/supportconfig/package/yast2-supportconfig.changes (added)
+++ branches/tmp/mzugec/supportconfig/package/yast2-supportconfig.changes Thu Aug 21 16:45:59 2008
@@ -0,0 +1,4 @@
+-------------------------------------------------------------------
+Tue Aug 12 19:56:47 2008 - mzugec@novell.com
+
+- initial version
Added: branches/tmp/mzugec/supportconfig/testsuite/.cvsignore
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/mzugec/supportconfig/testsuite/.cvsignore?rev=50288&view=auto
==============================================================================
--- branches/tmp/mzugec/supportconfig/testsuite/.cvsignore (added)
+++ branches/tmp/mzugec/supportconfig/testsuite/.cvsignore Thu Aug 21 16:45:59 2008
@@ -0,0 +1,11 @@
+Makefile
+Makefile.in
+site.exp
+*.sum
+*.log
+tmp.out*
+tmp.err*
+tmp.log*
+config
+run
+*.test
Added: branches/tmp/mzugec/supportconfig/testsuite/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/mzugec/supportconfig/testsuite/Makefile.am?rev=50288&view=auto
==============================================================================
--- branches/tmp/mzugec/supportconfig/testsuite/Makefile.am (added)
+++ branches/tmp/mzugec/supportconfig/testsuite/Makefile.am Thu Aug 21 16:45:59 2008
@@ -0,0 +1,21 @@
+#
+# Makefile.am for .../testsuite
+#
+# Do not edit this file (Makefile.am) as it will be overwritten!
+#
+
+AUTOMAKE_OPTIONS = dejagnu
+EXTRA_DIST = $(wildcard tests/*.out) $(wildcard tests/*.err) $(wildcard tests/*.ycp) $(wildcard tests/*.yh)
+
+testsuite_prepare = @ydatadir@/testsuite/Makefile.testsuite
+
+all-local: $(testsuite_prepare)
+ make -f $(testsuite_prepare) RPMNAME=$(RPMNAME) srcdir=$(srcdir)
+
+clean-local: $(testsuite_prepare)
+ make -f $(testsuite_prepare) RPMNAME=$(RPMNAME) srcdir=$(srcdir) clean
+
+check-local: $(testsuite_prepare)
+ make -f $(testsuite_prepare) RPMNAME=$(RPMNAME) srcdir=$(srcdir) check
+
+# EOF
Added: branches/tmp/mzugec/supportconfig/testsuite/config/default.exp
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/mzugec/supportconfig/testsuite/config/default.exp?rev=50288&view=auto
==============================================================================
--- branches/tmp/mzugec/supportconfig/testsuite/config/default.exp (added)
+++ branches/tmp/mzugec/supportconfig/testsuite/config/default.exp Thu Aug 21 16:45:59 2008
@@ -0,0 +1,2 @@
+# default.exp -- empty
+
Added: branches/tmp/mzugec/supportconfig/testsuite/config/unix.exp
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/mzugec/supportconfig/testsuite/config/unix.exp?rev=50288&view=auto
==============================================================================
--- branches/tmp/mzugec/supportconfig/testsuite/config/unix.exp (added)
+++ branches/tmp/mzugec/supportconfig/testsuite/config/unix.exp Thu Aug 21 16:45:59 2008
@@ -0,0 +1,114 @@
+# YaST2: modules testsuite
+#
+# Description:
+# Main config file
+#
+# Author:
+# Michal Svec
+#
+# $Id: unix.exp 46223 2008-04-08 11:09:51Z mvidner $
+
+proc testsuite_exit {} {}
+proc testsuite_version {} {}
+
+# Run one test
+
+proc testsuite-run { src } {
+
+ set path [split $src "/"]
+ set filename [lindex $path [expr [llength $path]-1]]
+
+ # extract basename and check extension
+
+ set fname [split $filename "."]
+
+ if {[llength $fname] < 2} {
+ fail "Bad filename syntax '$src'"
+ return -1
+ }
+ if {[lindex $fname [expr [llength $fname]-1]] != "ycp"} {
+ fail "Not .ycp extension '$src'"
+ return -1
+ }
+
+ # setup filenames
+
+ # $src is the name of the original testfile with absolute path
+ # tests/$filename is the name of the original testfile with relative path,
+ # relative to the testsuite directory
+ set test_input "tests/$filename"
+
+ set base_name [lindex $fname 0]
+
+ set stdout_name "tests/$base_name.out"
+ set stderr_name "tests/$base_name.err"
+ set log_name "tests/$base_name.log"
+ set tmpout_name "tmp.out.$base_name"
+ set tmperr_name "tmp.err.$base_name"
+ set tmplog_name "tmp.log.$base_name"
+
+ # fate#2306: enable make check *gasp* before make install
+ # by searching in the source directory
+ set options ""
+ # first hack: look for the usual suspects
+ # (next steps: use YCPCFLAGS)
+ set sourcedir "../src"
+ if {[file isdirectory $sourcedir]} {
+ set options "-I $sourcedir -M $sourcedir"
+ }
+
+ puts "Running $base_name ..."
+
+ # run the test
+
+ set result ""
+ set oops [catch { set result [exec "run/runtest.sh" $options "$test_input" "$tmpout_name" "$tmperr_name" ] } catched]
+
+ if {$oops != 0} {
+ fail "Test case failed for $base_name: $catched"
+ return -1
+ }
+
+ # check return code from runycp
+
+ if {$result != ""} {
+ warning "Compilation of $base_name results in '$result'"
+ return -1
+ }
+
+ # check stderr
+
+ if {[diff $stderr_name "tmp.err.$base_name"] != 1} {
+ fail "Wrong stderr for $base_name"
+ set oops [catch { set result [exec test -f $stderr_name] } catched ]
+ if {$oops == 0} {
+ puts "\nThe diff follows...\n"
+ puts [exec sh -c "diff -u $stderr_name tmp.err.$base_name || true"]
+ puts ""
+ fail "Wrong stderr for $base_name"
+ puts "See the diff above."
+ }
+ return -1
+ }
+
+ # check stdout
+
+ if {[diff $stdout_name "tmp.out.$base_name"] != 1} {
+ fail "Wrong stdout for $base_name"
+ set oops [catch { set result [exec test -f $stdout_name] } catched ]
+ if {$oops == 0} {
+ puts "\nThe diff follows...\n"
+ puts [exec sh -c "diff -u $stdout_name tmp.out.$base_name || true"]
+ puts ""
+ fail "Wrong stdout for $base_name"
+ puts "See the diff above."
+ }
+ return -1
+ }
+
+ # ok, all is fine
+
+ pass $base_name
+
+ return 0
+}
Added: branches/tmp/mzugec/supportconfig/testsuite/config/unknown.exp
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/mzugec/supportconfig/testsuite/config/unknown.exp?rev=50288&view=auto
==============================================================================
--- branches/tmp/mzugec/supportconfig/testsuite/config/unknown.exp (added)
+++ branches/tmp/mzugec/supportconfig/testsuite/config/unknown.exp Thu Aug 21 16:45:59 2008
@@ -0,0 +1,2 @@
+perror "No setup for current configuration"
+exit 1
Added: branches/tmp/mzugec/supportconfig/testsuite/run/runtest.sh
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/mzugec/supportconfig/testsuite/run/runtest.sh?rev=50288&view=auto
==============================================================================
--- branches/tmp/mzugec/supportconfig/testsuite/run/runtest.sh (added)
+++ branches/tmp/mzugec/supportconfig/testsuite/run/runtest.sh Thu Aug 21 16:45:59 2008
@@ -0,0 +1,94 @@
+#! /bin/bash
+
+# Run test on one ycp file
+# Michal Svec
+#
+# $1 = script.ycp
+# $2 = stdout
+# $3 = stderr
+#
+# These arguments may be preceded by options that will be passed to y2base
+#
+# $Id: runtest.sh 46223 2008-04-08 11:09:51Z mvidner $
+
+while [ $# -gt 3 ]; do
+ OPTIONS="$OPTIONS $1"
+ shift
+done
+
+unset LANG
+unset LC_CTYPE
+unset LC_NUMERIC
+unset LC_TIME
+unset LC_COLLATE
+unset LC_MONETARY
+unset LC_MESSAGES
+unset LC_PAPER
+unset LC_NAME
+unset LC_ADDRESS
+unset LC_TELEPHONE
+unset LC_MEASUREMENT
+unset LC_IDENTIFICATION
+unset LC_ALL
+
+unset Y2DEBUG
+unset Y2DEBUGALL
+# export Y2DEBUG=1
+# export Y2DEBUGALL=1
+export Y2ALLGLOBAL=1
+
+ybindir=`pkg-config --print-errors --variable=ybindir yast2-devtools`
+yast2dir=`pkg-config --print-errors --variable=yast2dir yast2-devtools`
+Y2BASE=$ybindir/y2base
+logconf="$yast2dir/data/testsuite/log.conf"
+
+if [ ! -f "$logconf" ]; then
+ logconf="../skel/log.conf"
+fi
+
+DUMMY_LOG_STRING="LOGTHIS_SECRET_314 "
+
+files="$(grep '^[/*[:space:]]*testedfiles:' "$1"|sed 's/.*testedfiles:[[:space:]]*//g')"
+if [ "$files" ]; then
+ echo "$files" >> testsuite.log
+ regex="[ /](testsuite\.ycp|Testsuite\.ycp|$(echo "$files"|sed 's|\.|\\.|g'|sed 's| |\||g')):"
+fi
+echo "$regex" >> testsuite.log
+
+parse() {
+ file="`mktemp /tmp/yast2-test.XXXXXX`"
+ cat >"$file"
+ if [ -z "$Y2TESTSUITE" ]; then
+ # errors are OK if they come from YCP (or Perl, #41448),
+ # mark them for output
+ sed1="s/ <[2-5]> [^ ]\+ \[\(YCP\|Perl\)\] \([^ ]\+\) / <0> host [YCP] \2 ${DUMMY_LOG_STRING}Log /"
+ # leave only essential info
+ sed2="s/^.*$DUMMY_LOG_STRING//g"
+ ycp="\[YCP\].*$DUMMY_LOG_STRING"
+ components="(agent-dummy|YCP)"
+ cat "$file" | sed "$sed1" | grep -E "<[012]>[^]]*$components.*$regex.*$DUMMY_LOG_STRING" | sed "$sed2" # | cut -d" " -f7-
+ # Y2PMrc: #38235
+ cat "$file" | grep "<[345]>" | grep -v "\[\(YCP\|Perl\|Y2PMrc\)\]" >&2
+ else
+ echo "Y2TESTSUITE set to \"$Y2TESTSUITE\""
+ echo
+ cat "$file"
+ fi
+ rm -f "$file"
+}
+
+( $Y2BASE -l - -c "$logconf" $OPTIONS "$1" UI 2>&1 ) | parse >"$2" 2>"$3"
+
+retcode="$PIPESTATUS"
+if [ "$retcode" -gt 0 ]; then
+ if [ "$retcode" -ge 128 ]; then
+ sig=$[$retcode-128]
+ echo -ne "\nCommand terminated on signal '$sig'"
+ echo -e '!\n'
+ else
+ echo -e "\nReturn code: '$retcode'.\n"
+ fi
+fi
+
+exit "$retcode"
+# EOF
Added: branches/tmp/mzugec/supportconfig/testsuite/tests/.cvsignore
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/mzugec/supportconfig/testsuite/tests/.cvsignore?rev=50288&view=auto
==============================================================================
(empty)
Added: branches/tmp/mzugec/supportconfig/testsuite/tests/Supportconfig.err
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/mzugec/supportconfig/testsuite/tests/Supportconfig.err?rev=50288&view=auto
==============================================================================
(empty)
Added: branches/tmp/mzugec/supportconfig/testsuite/tests/Supportconfig.out
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/mzugec/supportconfig/testsuite/tests/Supportconfig.out?rev=50288&view=auto
==============================================================================
--- branches/tmp/mzugec/supportconfig/testsuite/tests/Supportconfig.out (added)
+++ branches/tmp/mzugec/supportconfig/testsuite/tests/Supportconfig.out Thu Aug 21 16:45:59 2008
@@ -0,0 +1,2 @@
+Dump Supportconfig::Modified
+Return false
Added: branches/tmp/mzugec/supportconfig/testsuite/tests/Supportconfig.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/mzugec/supportconfig/testsuite/tests/Supportconfig.ycp?rev=50288&view=auto
==============================================================================
--- branches/tmp/mzugec/supportconfig/testsuite/tests/Supportconfig.ycp (added)
+++ branches/tmp/mzugec/supportconfig/testsuite/tests/Supportconfig.ycp Thu Aug 21 16:45:59 2008
@@ -0,0 +1,13 @@
+{
+
+// testedfiles: Supportconfig.ycp
+
+include "testsuite.ycp";
+TESTSUITE_INIT([], nil);
+
+import "Supportconfig";
+
+DUMP("Supportconfig::Modified");
+TEST(``(Supportconfig::Modified()), [], nil);
+
+}
Added: branches/tmp/mzugec/supportconfig/testsuite/yast2-supportconfig.test/testsuite.exp
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/mzugec/supportconfig/testsuite/yast2-supportconfig.test/testsuite.exp?rev=50288&view=auto
==============================================================================
--- branches/tmp/mzugec/supportconfig/testsuite/yast2-supportconfig.test/testsuite.exp (added)
+++ branches/tmp/mzugec/supportconfig/testsuite/yast2-supportconfig.test/testsuite.exp Thu Aug 21 16:45:59 2008
@@ -0,0 +1,28 @@
+# YaST2: modules testsuite
+#
+# Description:
+# Main file for all tests
+#
+# Author:
+# Michal Svec
+#
+# $Id: testsuite.exp 13187 2004-01-13 14:54:45Z msvec $
+
+global CASE
+# there must be a space before the closing brace!
+if [catch {set pattern $CASE }] {
+ # CASE undefined, do a glob
+ set pattern "*"
+}
+
+set filenames [lsort [glob "$srcdir/tests/$pattern.ycp"]]
+
+puts "\nChecking started\n"
+
+foreach file $filenames {
+ if {[testsuite-run $file] < 0} {
+ return
+ }
+}
+
+puts "\nChecking finished\n"
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org