diff --git a/hacking/titotest-centos-5.9/Dockerfile b/hacking/titotest-centos-5.9/Dockerfile index ccf89f8..eaf66da 100644 --- a/hacking/titotest-centos-5.9/Dockerfile +++ b/hacking/titotest-centos-5.9/Dockerfile @@ -9,6 +9,7 @@ RUN rpm -Uvh http://mirror.es.its.nyu.edu/epel/5/x86_64/epel-release-5-4.noarch. RUN yum -y install git rpm-build \ python-devel python-nose python-setuptools python-pep8 \ python-pip \ + docbook-style-xsl \ libxslt asciidoc tar createrepo which RUN pip-python install mock --upgrade diff --git a/hacking/titotest-centos-5.9/README.md b/hacking/titotest-centos-5.9/README.md index ff66a7f..fb50ac9 120000 --- a/hacking/titotest-centos-5.9/README.md +++ b/hacking/titotest-centos-5.9/README.md @@ -1 +1 @@ -../../HACKING.mkd \ No newline at end of file +../../HACKING \ No newline at end of file diff --git a/hacking/titotest-centos-6.4/README.md b/hacking/titotest-centos-6.4/README.md index ff66a7f..fb50ac9 120000 --- a/hacking/titotest-centos-6.4/README.md +++ b/hacking/titotest-centos-6.4/README.md @@ -1 +1 @@ -../../HACKING.mkd \ No newline at end of file +../../HACKING \ No newline at end of file diff --git a/hacking/titotest-fedora-20/Dockerfile b/hacking/titotest-fedora-20/Dockerfile index 0aee8ef..9175669 100644 --- a/hacking/titotest-fedora-20/Dockerfile +++ b/hacking/titotest-fedora-20/Dockerfile @@ -4,8 +4,12 @@ FROM mattdm/fedora:f20 # http://jumanjiman.github.io/ MAINTAINER Paul Morgan +# F20 needs updates to resolve conflict with asciidoc. +RUN yum -y update; yum clean all + # Install dependencies. RUN yum -y install git rpm-build libxslt tar \ + asciidoc \ python-devel python-nose python-setuptools python-pep8 \ python-mock \ python3-devel python3-nose python3-setuptools python3-pep8 rpm-python3 python3-mock \ diff --git a/hacking/titotest-fedora-20/README.md b/hacking/titotest-fedora-20/README.md index ff66a7f..fb50ac9 120000 --- a/hacking/titotest-fedora-20/README.md +++ b/hacking/titotest-fedora-20/README.md @@ -1 +1 @@ -../../HACKING.mkd \ No newline at end of file +../../HACKING \ No newline at end of file diff --git a/test/functional/build_tito_tests.py b/test/functional/build_tito_tests.py new file mode 100644 index 0000000..e471f23 --- /dev/null +++ b/test/functional/build_tito_tests.py @@ -0,0 +1,63 @@ +# +# Copyright (c) 2008-2014 Red Hat, Inc. +# +# This software is licensed to you under the GNU General Public License, +# version 2 (GPLv2). There is NO WARRANTY for this software, express or +# implied, including the implied warranties of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2 +# along with this software; if not, see +# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. +# +# Red Hat trademarks are not licensed under GPLv2. No permission is +# granted to use or replicate Red Hat trademarks that are incorporated +# in this software or its documentation. +''' +Functional tests to build tito with tito. +This can catch indirect omissions within tito itself. +''' + +import os +import shutil +import tempfile +import unittest + +from functional.fixture import tito +from glob import glob +from os.path import join + + +class BuildTitoTests(unittest.TestCase): + + @classmethod + def setUpClass(self): + 'Run tito build before _all_ tests in this class.' + self.output_dir = tempfile.mkdtemp("-titotestoutput") + os.chdir(os.path.abspath(join(__file__, '..', '..', '..'))) + self.artifacts = tito( + 'build --rpm --test --output=%s --offline --no-cleanup --debug' % + self.output_dir + ) + + @classmethod + def tearDownClass(self): + 'Clean up after _all_ tests in this class unless any test fails.' + shutil.rmtree(self.output_dir) + + def test_build_tito(self): + 'Tito creates three artifacts' + self.assertEqual(3, len(self.artifacts)) + + def test_find_srpm(self): + 'One artifact is an SRPM' + srpms = glob(join(self.output_dir, 'tito-*src.rpm')) + self.assertEqual(1, len(srpms)) + + def test_find_rpm(self): + 'One artifact is a noarch RPM' + rpms = glob(join(self.output_dir, 'noarch', 'tito-*noarch.rpm')) + self.assertEqual(1, len(rpms)) + + def test_find_tgz(self): + 'One artifact is a tarball' + tgzs = glob(join(self.output_dir, 'tito-*tar.gz')) + self.assertEqual(1, len(tgzs)) diff --git a/tito.spec b/tito.spec index 6d19117..6d50518 100644 --- a/tito.spec +++ b/tito.spec @@ -15,6 +15,7 @@ BuildArch: noarch BuildRequires: python-devel BuildRequires: python-setuptools BuildRequires: asciidoc +BuildRequires: docbook-style-xsl BuildRequires: libxslt Requires: python-setuptools