diff --git a/tests/actionsapitests.py b/tests/actionsapitests.py index ae17c192..dcb86358 100644 --- a/tests/actionsapitests.py +++ b/tests/actionsapitests.py @@ -6,18 +6,46 @@ # any later version. # # Please read the COPYING file. -# import unittest +import zipfile -from pisi.actionsapi import shelltools -from pisi.actionsapi import autotools -from pisi.actionsapi import pisitools +class ActionsAPITestCase(unittest.TestCase): + def setUp(self): + self.f = zipfile.ZipFile("helloworld-0.1-1.pisi", "r") + self.filelist = [] + + for file in self.f.namelist(): + self.filelist.append(file) -""" - Burasi ActionsAPI'yi gercekten test edecek case'ler ile - dolacak.. Ornegin bir paketin acilip derlenip dosed, dosym - doman, dobin, dosbin gibi fonksiyonlarin dogru calisrligi - test edilecek.. -""" + def testFileList(self): + fileContent = ["files.xml", \ + "install/bin/helloworld", \ + "install/opt/PARDUS", \ + "install/opt/helloworld/helloworld", \ + "install/opt/uludag", \ + "install/sbin/helloworld", \ + "install/sys/PARDUS", \ + "install/sys/uludag", \ + "install/usr/bin/goodbye", \ + "install/usr/bin/helloworld", \ + "install/usr/lib/helloworld.o", \ + "install/usr/sbin/goodbye", \ + "install/usr/sbin/helloworld", \ + "install/usr/share/doc/helloworld-0.1-1/Makefile.am", \ + "install/usr/share/doc/helloworld-0.1-1/goodbyeworld.cpp", \ + "install/usr/share/info/Makefile.am", \ + "install/usr/share/info/Makefile.cvs", \ + "install/usr/share/info/Makefile.in", \ + "install/var/goodbye", \ + "install/var/hello", \ + "metadata.xml"] + + '''check number of files in package''' + self.assertEqual(fileContent.__len__(), self.filelist.__len__()) + '''check file content''' + for file in self.filelist: + self.assert_(fileContent.__contains__(file)) + +suite = unittest.makeSuite(ActionsAPITestCase) diff --git a/tests/helloworld/actions.py b/tests/helloworld/actions.py new file mode 100644 index 00000000..da6b1f5c --- /dev/null +++ b/tests/helloworld/actions.py @@ -0,0 +1,102 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (C) 2005, TUBITAK/UEKAE +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 of the License, or (at your option) +# any later version. +# +# Please read the COPYING file. + +from pisi.actionsapi import autotools +from pisi.actionsapi import pisitools +from pisi.actionsapi import shelltools +from pisi.actionsapi import libtools +from pisi.actionsapi import get + +WorkDir = "helloworld" + +def setup(): + autotools.configure() + +def build(): + autotools.make() + +def install(): + autotools.install() + + '''/opt/helloworld/''' + pisitools.dodir("/opt/helloworld") + + '''/usr/share/doc/helloworld-0.1-1/Makefile.am''' + pisitools.dodoc("Makefile.am") + + '''/opt/helloworld/helloworld''' + pisitools.doexe("src/helloworld", "/opt/helloworld") + + '''/usr/share/info/Makefile.am''' + '''/usr/share/info/Makefile.cvs''' + '''/usr/share/info/Makefile.in''' + pisitools.doinfo("Makefile.*") + + '''/usr/lib/helloworld.o''' + pisitools.dolib("src/helloworld.o") + + '''/opt/hello''' + pisitools.insinto("/opt/", "src/helloworld", "hello") + '''/opt/hi''' + pisitools.insinto("/opt/", "src/helloworld", "hi") + + '''/opt/hello -> /var/hello''' + pisitools.domove("/opt/hello", "/var/") + '''/opt/hi -> /var/goodbye''' + pisitools.domove("/opt/hi", "/var/", "goodbye") + + '''/usr/bin/helloworld''' + pisitools.dobin("src/helloworld") + '''/bin/helloworld''' + pisitools.dobin("src/helloworld", "/bin") + + '''/usr/sbin/helloworld''' + pisitools.dosbin("src/helloworld") + '''/sbin/helloworld''' + pisitools.dosbin("src/helloworld", "/sbin") + + '''Hello, world! -> Goodbye, world!''' + pisitools.dosed("src/helloworld.cpp", "Hello, world!", "Goodbye, world!") + + '''/usr/sbin/goodbye --> helloworld''' + pisitools.dosym("helloworld", "/usr/sbin/goodbye") + '''/usr/bin/goodbye --> helloworld''' + pisitools.dosym("helloworld", "/usr/bin/goodbye") + + '''/home/pardus/''' + pisitools.dodir("/home/pardus") + '''delete pardus''' + pisitools.removeDir("/home/pardus") + '''delete home''' + pisitools.removeDir("/home") + + '''src/helloworld.cpp --> /usr/share/doc/helloworld-0.1-1/goodbyeworld.cpp''' + pisitools.newdoc("src/helloworld.cpp", "goodbyeworld.cpp") + + '''/opt/pardus''' + shelltools.touch("%s/opt/pardus" % get.installDIR()) + + '''/opt/pardus --> /opt/uludag''' + shelltools.copy("%s/opt/pardus" % get.installDIR(), "%s/opt/uludag" % get.installDIR()) + '''/opt/pardus --> /opt/Pardus''' + shelltools.move("%s/opt/pardus" % get.installDIR(), "%s/opt/PARDUS" % get.installDIR()) + + '''/opt/ --> /sys/''' + shelltools.copytree("%s/opt/" % get.installDIR(), "%s/sys/" % get.installDIR()) + + '''delete /sys/helloworld/helloworld''' + shelltools.unlink("%s/sys/helloworld/helloworld" % get.installDIR()) + '''delete /sys/helloworld''' + shelltools.unlinkDir("%s/sys/helloworld" % get.installDIR()) + + '''generate /usr/lib/helloworld.o''' + libtools.gen_usr_ldscript("helloworld.o") diff --git a/tests/helloworld/pspec.xml b/tests/helloworld/pspec.xml new file mode 100644 index 00000000..a50bfda9 --- /dev/null +++ b/tests/helloworld/pspec.xml @@ -0,0 +1,35 @@ + + + + + + + helloworld + http://www.uludag.org.tr + + S.Çağlar Onur + caglar@uludag.org.tr + + GPL-2 + category + component + Dummy HelloWorld for testing ActionsAPI + Dummy HelloWorld for testing ActionsAPI + http://cekirdek.uludag.org.tr/~caglar/helloworld.tar.gz + + + 2005-08-21 + 0.1 + 1 + + + + + + helloworld + + / + + + + diff --git a/tests/run.py b/tests/run.py index cbd7f464..6bc1f864 100755 --- a/tests/run.py +++ b/tests/run.py @@ -29,7 +29,7 @@ def run_all(): import installdbtests import sourcedbtests import packagedbtests - #import actionsapitests + import actionsapitests import graphtests import versiontests import configfiletests @@ -46,7 +46,7 @@ def run_all(): installdbtests.suite, sourcedbtests.suite, packagedbtests.suite, - #actionsapitests.suite, + actionsapitests.suite, graphtests.suite, versiontests.suite, configfiletests.suite,