- add a simple testcase
authorMichael Schroeder <mls@suse.de>
Tue, 21 Feb 2012 16:57:54 +0000 (17:57 +0100)
committerMichael Schroeder <mls@suse.de>
Tue, 21 Feb 2012 16:57:54 +0000 (17:57 +0100)
CMakeLists.txt
test/CMakeLists.txt [new file with mode: 0644]
test/runtestcases [new file with mode: 0755]
test/testcases/sat/mm-packages.repo.gz [new file with mode: 0644]
test/testcases/sat/mm-system.repo.gz [new file with mode: 0644]
test/testcases/sat/mm-test.t [new file with mode: 0644]

index 539199e..aacd49a 100644 (file)
@@ -250,3 +250,6 @@ ADD_CUSTOM_TARGET (srcpackage
 ADD_CUSTOM_TARGET (srcpackage_local
   ${AUTOBUILD_COMMAND}
 )
+
+ENABLE_TESTING()
+ADD_SUBDIRECTORY (test)
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
new file mode 100644 (file)
index 0000000..713c1f7
--- /dev/null
@@ -0,0 +1,9 @@
+FOREACH(tcdir testcases libsolv_zypptestcases)
+    IF(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${tcdir}")
+        FILE(GLOB dirs "${CMAKE_CURRENT_SOURCE_DIR}/${tcdir}/*")
+        FOREACH(dir ${dirs})
+            FILE(RELATIVE_PATH myname "${CMAKE_CURRENT_SOURCE_DIR}/${tcdir}" ${dir})
+            ADD_TEST(${myname} ${CMAKE_CURRENT_SOURCE_DIR}/runtestcases ${CMAKE_BINARY_DIR}/tools/testsolv ${dir})
+        ENDFOREACH(dir)
+    ENDIF(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${tcdir}")
+ENDFOREACH(tcdir)
diff --git a/test/runtestcases b/test/runtestcases
new file mode 100755 (executable)
index 0000000..0764a6a
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+cmd=$1
+dir=$2
+
+if test -z "$dir"; then
+  echo "Usage: runtestcases <cmd> <dir>";
+  exit 1
+fi
+
+ex=0
+for tc in $(find $dir -name \*.t) ; do
+  if ! $cmd $tc > /dev/null ; then
+    echo "${tc#$dir} failed"
+    ex=1
+  fi
+done
+exit $ex
diff --git a/test/testcases/sat/mm-packages.repo.gz b/test/testcases/sat/mm-packages.repo.gz
new file mode 100644 (file)
index 0000000..fd4aa08
Binary files /dev/null and b/test/testcases/sat/mm-packages.repo.gz differ
diff --git a/test/testcases/sat/mm-system.repo.gz b/test/testcases/sat/mm-system.repo.gz
new file mode 100644 (file)
index 0000000..ef1ac5f
Binary files /dev/null and b/test/testcases/sat/mm-system.repo.gz differ
diff --git a/test/testcases/sat/mm-test.t b/test/testcases/sat/mm-test.t
new file mode 100644 (file)
index 0000000..ea7b574
--- /dev/null
@@ -0,0 +1,17 @@
+#
+# testcase to check enabling/disabling of learnt rules
+#
+repo system 0 susetags mm-system.repo.gz
+repo test 0 susetags mm-packages.repo.gz
+system i686 rpm system
+job install provides E
+job verify all packages
+result transaction,problems <inline>
+#>erase D-1.0-1.noarch@system
+#>erase D2-1.0-1.noarch@system
+#>problem a3755a16 info package E-2.0-1.noarch requires foo, but none of the providers can be installed
+#>problem a3755a16 solution 6d40bce1 deljob install provides E
+#>problem a3755a16 solution c06ed43e erase D-1.0-1.noarch@system
+#>problem a3755a16 solution c8a04f77 erase D2-1.0-1.noarch@system
+#>upgrade A-1.0-1.noarch@system A-2.0-1.noarch@test
+#>upgrade A2-1.0-1.noarch@system A2-2.0-1.noarch@test