poldek: poldek/tests/sh/04-conf (NEW), poldek/tests/sh/lib/repo-se...
mis
mis at pld-linux.org
Mon Jun 25 17:43:47 CEST 2007
Author: mis Date: Mon Jun 25 15:43:47 2007 GMT
Module: poldek Tag: HEAD
---- Log message:
- next test
---- Files affected:
poldek/poldek/tests/sh:
04-conf (NONE -> 1.1) (NEW)
poldek/poldek/tests/sh/lib:
repo-setup (1.4 -> 1.5) , setup (1.3 -> 1.4)
---- Diffs:
================================================================
Index: poldek/poldek/tests/sh/04-conf
diff -u /dev/null poldek/poldek/tests/sh/04-conf:1.1
--- /dev/null Mon Jun 25 17:43:47 2007
+++ poldek/poldek/tests/sh/04-conf Mon Jun 25 17:43:41 2007
@@ -0,0 +1,155 @@
+#!/bin/sh
+# $Id$
+
+. ./sh/lib/setup
+. ./sh/lib/repo-setup
+
+create_local_conf() {
+echo "
+_name_prefix = test
+
+[source]
+name = %{_name_prefix}1
+type = pndir
+path = ${REPOURL}1
+
+[source]
+name = %{_name_prefix}2
+type = pdir
+path = ${REPOURL}2
+" > $TMPDIR/poldek.conf
+}
+
+testConf()
+{
+ #cat $TMPDIR/poldek.conf
+ create_local_conf
+ n=$($POLDEK --conf $TMPDIR/poldek.conf -q -l | grep -vE '^dbg:' | wc -l)
+ assertEquals "2 sources expected" "$n" "2"
+
+ #$POLDEK --conf $TMPDIR/poldek.conf -q -l | grep -E '^test[12] '
+ n=$($POLDEK --conf $TMPDIR/poldek.conf -q -l | grep -E '^test[12] ' | wc -l)
+ assertEquals "2 sources expected, but not those" "$n" "2"
+ #sources=$($POLDEK --conf $TMPDIR/poldek.conf -q -l | grep -E ^test[12]
+}
+
+testRemoteConfAndMacros() {
+
+ create_local_conf
+
+ POLDEK_TESTING_PRELOAD_CONF="$SHLIBDIR/vftest-fetch.conf"
+ export POLDEK_TESTING_PRELOAD_CONF
+
+ echo "
+[global]
+%include ${REPOURL}remote.conf
+
+[source]
+name = %{_name_prefix}3
+type = pndir
+path = ${REPOURL}3
+
+[source]
+name = %{_name_prefix}4
+type = pndir
+path = ${REPOURL}4
+" >> $TMPDIR/poldek.conf
+
+ echo "
+_name_prefix = xtest
+[source]
+name = %{_name_prefix}1
+type = pndir
+path = ${REPOURL}x1
+
+[source]
+name = %{_name_prefix}2
+type = pdir
+path = ${REPOURL}x2
+" > $REPO/remote.conf
+
+
+ poldek_l="$POLDEK --conf $TMPDIR/poldek.conf -q -l"
+ poldek_l_cdir="$poldek_l --cachedir $CACHEDIR"
+
+ n=$($poldek_l --noconf | grep -vE '^dbg:' | wc -l)
+ assertEquals "--noconf failed" "$n" "0"
+
+ #$POLDEK --conf $TMPDIR/poldek.conf -l --cachedir $CACHEDIR
+
+ n=$($poldek_l_cdir | grep 'type=' | wc -l)
+ assertEquals "6 sources expected, got $n" "$n" "6"
+
+ is_verbose_mode && $poldek_l_cdir
+
+ n=$($poldek_l_cdir | grep -E '^test[1234] ' | wc -l)
+ assertEquals "4 sources expected, but not those" "$n" "4"
+
+ n=$($poldek_l_cdir -l | grep -E '^xtest[1234] ' | wc -l)
+ assertEquals "2 xtest* sources expected, but not those $n" "$n" "2"
+
+ msgn "upconf"
+
+ echo "
+[source]
+name = %{_name_prefix}3
+type = pndir
+path = ${REPOURL}x3
+
+[source]
+name = %{_name_prefix}4
+type = pdir
+path = ${REPOURL}x4
+" >> $REPO/remote.conf
+
+ POLDEK_TESTING_DENIED_FILES="remote.conf"
+ #cat $TMPDIR/poldek.conf
+ is_verbose_mode && $poldek_l_cdir
+
+ n=$($poldek_l_cdir | grep -vE '^dbg:' | wc -l)
+ assertEquals "6 sources expected" "$n" "6"
+
+ #$POLDEK --conf $TMPDIR/poldek.conf -q -l | grep -E '^test[12] '
+ n=$($poldek_l_cdir | grep -E '^test[1234] ' | wc -l)
+ assertEquals "4 sources expected, but not those" "$n" "4"
+
+ POLDEK_TESTING_DENIED_FILES=""
+ $POLDEK --conf $TMPDIR/poldek.conf --upconf --cachedir $CACHEDIR
+
+ POLDEK_TESTING_DENIED_FILES="remote.conf"
+ n=$($poldek_l_cdir | grep '(type=' | wc -l)
+ assertEquals "8 sources exepected, got $n" "$n" "8"
+
+ n=$($poldek_l_cdir | grep -E '^test[1234] ' | wc -l)
+ assertEquals "4 sources expected, but not those" "$n" "4"
+
+ n=$($poldek_l_cdir | grep -E '^xtest[1234] ' | wc -l)
+ assertEquals "4 sources expected, but not those" "$n" "4"
+
+ n=$(find $CACHEDIR -name \*.conf | wc -l)
+ assertEquals "Expected cachedir/remote.conf only" "$n" "1"
+
+ #find $CACHEDIR
+ POLDEK_TESTING_DENIED_FILES="remote.conf"
+
+ msgn "whole conf remote"
+ $POLDEK --conf test://$TMPDIR/poldek.conf --cachedir $CACHEDIR -q -l >/dev/null
+ is_verbose_mode && $poldek_l_cdir
+
+ n=$($poldek_l_cdir | grep '(type=' | wc -l)
+ assertEquals "8 sources exepected, got $n" "$n" "8"
+
+ n=$($poldek_l_cdir | grep -E '^test[1234] ' | wc -l)
+ assertEquals "4 sources expected, but not those" "$n" "4"
+
+ n=$($poldek_l_cdir | grep -E '^xtest[1234] ' | wc -l)
+ assertEquals "4 sources expected, but not those" "$n" "4"
+
+ n=$(find $CACHEDIR -name remote.conf | wc -l)
+ assertEquals "Where is remote.conf cached copy??" "$n" "1"
+
+ n=$(find $CACHEDIR -name poldek.conf | wc -l)
+ assertEquals "Where is poldek.conf cached copy??" "$n" "1"
+}
+
+. ./sh/lib/shunit2
================================================================
Index: poldek/poldek/tests/sh/lib/repo-setup
diff -u poldek/poldek/tests/sh/lib/repo-setup:1.4 poldek/poldek/tests/sh/lib/repo-setup:1.5
--- poldek/poldek/tests/sh/lib/repo-setup:1.4 Mon Jun 25 00:48:52 2007
+++ poldek/poldek/tests/sh/lib/repo-setup Mon Jun 25 17:43:41 2007
@@ -12,20 +12,24 @@
oneTimeSetUp() {
[ ! -d "$PWD/sh/lib" ] && fail "$PWD is not a tests directory (missing sh/lib)"
+
+ SHLIBDIR="$PWD/sh/lib"
SOURCE_REPO=${SOURCE_REPO:-"${PWD}/repo"}
[ ! -d "$SOURCE_REPO" ] && fail "$SOURCE_REPO: no such directory"
- TMP=${TMP:-"$TMPDIR"}
- [ -z "$TMP" ] && TMP="${PWD}"
- TMP="${TMP}/poldekTests"
+ TMP=${TMP:-""}
+ TMPDIR=${TMPDIR:-""}
+ [ -z "$TMP" ] && TMP="${TMPDIR}"
+ [ -z "$TMP" ] && TMP="/tmp"
+ TMP="${TMP}/poldekTests.$$"
TMPDIR="$TMP"
rm -rf $TMPDIR
mkdir -p $TMPDIR
[ ! -d $TMPDIR ] && fail "$TMPDIR: no such directory"
-
+
CACHEDIR="$TMPDIR/kesz"
rm -rf $CACHEDIR
mkdir -p $CACHEDIR
@@ -42,7 +46,7 @@
POLDEK="$PWD/../cli/poldek $QUIET"
POLDEK_NOCONF="$POLDEK --noconf -Ovfile_retries=1 --cachedir $CACHEDIR"
POLDEK_UP="$POLDEK --conf ./sh/lib/vftest-fetch.conf --cachedir $CACHEDIR"
- cp $SOURCE_REPO/*.rpm $REPO || fail
+ ln -sf $SOURCE_REPO/*.rpm $REPO/ || fail
tearDown
}
@@ -161,4 +165,4 @@
[ "$nchanges" = "0" ] && random_change_repo
#msg "Added $nadded and $nremoved removed"
-}
\ No newline at end of file
+}
================================================================
Index: poldek/poldek/tests/sh/lib/setup
diff -u poldek/poldek/tests/sh/lib/setup:1.3 poldek/poldek/tests/sh/lib/setup:1.4
--- poldek/poldek/tests/sh/lib/setup:1.3 Sun Jun 24 13:31:14 2007
+++ poldek/poldek/tests/sh/lib/setup Mon Jun 25 17:43:42 2007
@@ -5,6 +5,10 @@
[ "$QUIET" != "-q" ] && echo -e $@
}
+is_verbose_mode() {
+ test "$QUIET" != "-q"
+}
+
msgn() {
msg "\n## $@"
}
================================================================
---- CVS-web:
http://cvs.pld-linux.org/poldek/poldek/tests/sh/lib/repo-setup?r1=1.4&r2=1.5&f=u
http://cvs.pld-linux.org/poldek/poldek/tests/sh/lib/setup?r1=1.3&r2=1.4&f=u
More information about the pld-cvs-commit
mailing list