Non-modular package is obsoleted by avocado:stable

This commit is contained in:
Merlin Mathesius 2019-01-16 15:53:54 -06:00
commit 48c501c45f
10 changed files with 1 additions and 1060 deletions

9
.gitignore vendored
View file

@ -1,9 +0,0 @@
/avocado-43.0.tar.gz
/avocado-46.0.tar.gz
/avocado-47.0.tar.gz
/avocado-48.0.tar.gz
/avocado-49.0.tar.gz
/avocado-50.0.tar.gz
/avocado-51.0.tar.gz
/avocado-52.0.tar.gz
/avocado-52.1.tar.gz

View file

@ -1,11 +0,0 @@
diff -r -u avocado-52.0.orig/selftests/functional/test_output.py avocado-52.0/selftests/functional/test_output.py
--- avocado-52.0.orig/selftests/functional/test_output.py 2017-06-26 19:26:48.000000000 -0500
+++ avocado-52.0/selftests/functional/test_output.py 2017-08-09 07:40:41.636928188 -0500
@@ -67,6 +67,7 @@
def setUp(self):
self.tmpdir = tempfile.mkdtemp(prefix='avocado_' + __name__)
+ @unittest.skip("Test is producing a false failure due to platform/compiler changes")
@unittest.skipIf(missing_binary('cc'),
"C compiler is required by the underlying doublefree.py test")
def test_output_doublefree(self):

View file

@ -1,15 +0,0 @@
diff -ru ../avocado-52.1.orig/selftests/functional/test_plugin_diff.py ./selftests/functional/test_plugin_diff.py
--- ../avocado-52.1.orig/selftests/functional/test_plugin_diff.py 2018-03-01 12:05:02.000000000 -0600
+++ ./selftests/functional/test_plugin_diff.py 2018-03-13 16:50:33.662490323 -0500
@@ -52,9 +52,9 @@
result = self.run_and_check(cmd_line, expected_rc)
msg = "# COMMAND LINE"
self.assertIn(msg, result.stdout)
- msg = "-./scripts/avocado run"
+ msg = "-%s run" % AVOCADO
self.assertIn(msg, result.stdout)
- msg = "+./scripts/avocado run"
+ msg = "+%s run" % AVOCADO
self.assertIn(msg, result.stdout)
def test_diff_nocmdline(self):

1
dead.package Normal file
View file

@ -0,0 +1 @@
Non-modular package is obsoleted by avocado:stable

View file

@ -1,540 +0,0 @@
%global srcname avocado
%global pkgname avocado
# Conditional for release vs. snapshot builds. Set to 1 for release build.
%if ! 0%{?rel_build:1}
%global rel_build 1
%endif
# Settings used for build from snapshots.
%if 0%{?rel_build}
%global gittar %{srcname}-%{version}.tar.gz
%else
%if ! 0%{?commit:1}
%global commit 0ddd3c7b92f18c85157766e9e0ec810e6b3dd37e
%endif
%if ! 0%{?commit_date:1}
%global commit_date 20180301
%endif
%global shortcommit %(c=%{commit};echo ${c:0:7})
%global gitrel .%{commit_date}git%{shortcommit}
%global gittar %{srcname}-%{shortcommit}.tar.gz
%endif
# Selftests are provided but may need to be skipped because many of
# the functional tests are time and resource sensitive and can
# cause race conditions and random build failures. They are
# enabled by default.
# However, selftests need to be disabled when libvirt is not available.
%global with_tests 1
%if 0%{?rhel} && 0%{?rhel} <= 7
# libvirt is not available for all RHEL builder architectures
%global with_tests 0
%endif
Name: python-%{pkgname}
Version: 52.1
Release: 7%{?gitrel}%{?dist}
Summary: Framework with tools and libraries for Automated Testing
# Found licenses:
# avocado/utils/external/gdbmi_parser.py: MIT
# avocado/utils/external/spark.py: MIT
# optional_plugins/html/avocado_result_html/resources/static/css/*: MIT
# optional_plugins/html/avocado_result_html/resources/static/js/*: MIT
# Other files: GPLv2 and GPLv2+
License: GPLv2 and MIT
URL: http://avocado-framework.github.io/
%if 0%{?rel_build}
Source0: https://github.com/avocado-framework/%{srcname}/archive/%{version}.tar.gz#/%{gittar}
%else
Source0: https://github.com/avocado-framework/%{srcname}/archive/%{commit}.tar.gz#/%{gittar}
%endif
Patch0: avocado-selftest-doublefree-disable.patch
Patch1: avocado-selftest-fix-cmdline-check.patch
BuildArch: noarch
BuildRequires: python2-aexpect
BuildRequires: python2-devel
BuildRequires: python2-mock
BuildRequires: python2-resultsdb_api
BuildRequires: /usr/bin/rst2man
BuildRequires: grep, sed
%if 0%{?fedora} > 27 || 0%{?rhel} > 7
BuildRequires: python2-flexmock
BuildRequires: python2-lxml
BuildRequires: python2-pystache
%else
BuildRequires: python-flexmock
BuildRequires: python-lxml
BuildRequires: pystache
%endif
%if 0%{?fedora} >= 29
BuildRequires: python2-fabric3
%else
BuildRequires: fabric
%endif
%if 0%{?with_tests}
BuildRequires: perl(TAP::Parser)
%if 0%{?fedora} >= 27 || 0%{?rhel} > 7
BuildRequires: python2-libvirt
%else
BuildRequires: libvirt-python
%endif
%if 0%{?rhel} && 0%{?rhel} <= 7
BuildRequires: python-yaml
%else
BuildRequires: python2-yaml
%endif
%endif
%if 0%{?rhel} && 0%{?rhel} <= 7
BuildRequires: python-psutil
BuildRequires: python-requests
BuildRequires: python-setuptools
BuildRequires: python-sphinx
BuildRequires: python-stevedore
%else
BuildRequires: python2-psutil
BuildRequires: python2-requests
BuildRequires: python2-setuptools
BuildRequires: python2-sphinx
BuildRequires: python2-stevedore
%endif
%if 0%{?el6}
BuildRequires: procps
BuildRequires: python-argparse
BuildRequires: python-importlib
BuildRequires: python-logutils
BuildRequires: python-unittest2
%else
BuildRequires: procps-ng
%endif
# For some strange reason, fabric on Fedora 24 does not require the
# python-crypto package, but the fabric code always imports it. Newer
# fabric versions, such from Fedora 25 do conditional imports (try:
# from Crypto import Random; except: Random = None) and thus do not
# need this requirement.
%if 0%{?fedora} == 24
BuildRequires: python-crypto
%endif
%if 0%{?fedora} >= 25 || 0%{?rhel} >= 7
BuildRequires: kmod
%endif
%description
Avocado is a set of tools and libraries (what people call
these days a framework) to perform automated testing.
%package -n python2-%{pkgname}
Summary: %{summary}
License: GPLv2 and MIT
%{?python_provide:%python_provide python2-%{pkgname}}
Requires: gdb
Requires: gdb-gdbserver
Requires: pyliblzma
Requires: python2
%if 0%{?fedora} > 27 || 0%{?rhel} > 7
Requires: python2-pystache
%else
Requires: pystache
%endif
%if 0%{?fedora} >= 29
Requires: python2-fabric3
%else
Requires: fabric
%endif
%if 0%{?rhel} && 0%{?rhel} <= 7
Requires: python-requests
Requires: python-stevedore
%else
Requires: python2-requests
Requires: python2-stevedore
%endif
%if 0%{?el6}
Requires: procps
Requires: python-argparse
Requires: python-importlib
Requires: python-logutils
Requires: python-unittest2
%else
Requires: procps-ng
%endif
%description -n python2-%{pkgname}
Avocado is a set of tools and libraries (what people call
these days a framework) to perform automated testing.
%package -n python2-%{pkgname}-plugins-output-html
Summary: Avocado HTML report plugin
%{?python_provide:%python_provide python2-%{pkgname}-plugins-output-html}
Requires: python2-%{pkgname} == %{version}-%{release}
%if 0%{?fedora} > 27 || 0%{?rhel} > 7
Requires: python2-pystache
%else
Requires: pystache
%endif
%description -n python2-%{pkgname}-plugins-output-html
Adds to avocado the ability to generate an HTML report at every job results
directory. It also gives the user the ability to write a report on an
arbitrary filesystem location.
%package -n python2-%{pkgname}-plugins-runner-remote
Summary: Avocado Runner for Remote Execution
%{?python_provide:%python_provide python2-%{pkgname}-plugins-runner-remote}
Requires: python2-%{pkgname} == %{version}-%{release}
%if 0%{?fedora} == 24
Requires: python-crypto
%endif
%if 0%{?fedora} >= 29
Requires: python2-fabric3
%else
Requires: fabric
%endif
%description -n python2-%{pkgname}-plugins-runner-remote
Allows Avocado to run jobs on a remote machine, by means of an SSH
connection. Avocado must be previously installed on the remote machine.
%package -n python2-%{pkgname}-plugins-runner-vm
Summary: Avocado Runner for libvirt VM Execution
%{?python_provide:%python_provide python2-%{pkgname}-plugins-runner-vm}
Requires: python2-%{pkgname} == %{version}-%{release}
Requires: python2-%{pkgname}-plugins-runner-remote == %{version}-%{release}
%if 0%{?fedora} >= 27 || 0%{?rhel} > 7
Requires: python2-libvirt
%else
Requires: libvirt-python
%endif
%description -n python2-%{pkgname}-plugins-runner-vm
Allows Avocado to run jobs on a libvirt based VM, by means of
interaction with a libvirt daemon and an SSH connection to the VM
itself. Avocado must be previously installed on the VM.
%package -n python2-%{pkgname}-plugins-runner-docker
Summary: Avocado Runner for Execution on Docker Containers
%{?python_provide:%python_provide python2-%{pkgname}-plugins-runner-docker}
Requires: python2-%{pkgname} == %{version}-%{release}
Requires: python2-%{pkgname}-plugins-runner-remote == %{version}-%{release}
Requires: python2-aexpect
%description -n python2-%{pkgname}-plugins-runner-docker
Allows Avocado to run jobs on a Docker container by interacting with a
Docker daemon and attaching to the container itself. Avocado must
be previously installed on the container.
%package -n python2-%{pkgname}-plugins-resultsdb
Summary: Avocado plugin to propagate job results to ResultsDB
%{?python_provide:%python_provide python2-%{pkgname}-plugins-resultsdb}
Requires: python2-%{pkgname} == %{version}-%{release}
Requires: python2-resultsdb_api
%description -n python2-%{pkgname}-plugins-resultsdb
Allows Avocado to send job results directly to a ResultsDB
server.
%package -n python2-%{pkgname}-plugins-varianter-yaml-to-mux
Summary: Avocado plugin to generate variants out of yaml files
%{?python_provide:%python_provide python2-%{pkgname}-plugins-varianter-yaml-to-mux}
Requires: python2-%{pkgname} == %{version}-%{release}
%if 0%{?rhel} && 0%{?rhel} <= 7
Requires: python-yaml
%else
Requires: python2-yaml
%endif
%description -n python2-%{pkgname}-plugins-varianter-yaml-to-mux
Can be used to produce multiple test variants with test parameters
defined in a yaml file(s).
%package -n python-%{pkgname}-examples
Summary: Avocado Test Framework Example Tests
License: GPLv2
# documentation does not require main package, but needs to be in lock-step if present
Conflicts: python-%{pkgname} < %{version}-%{release}, python-%{pkgname} > %{version}-%{release}
%description -n python-%{pkgname}-examples
The set of example tests present in the upstream tree of the Avocado framework.
Some of them are used as functional tests of the framework, others serve as
examples of how to write tests on your own.
%prep
%if 0%{?rel_build}
%setup -q -n %{srcname}-%{version}
%else
%setup -q -n %{srcname}-%{commit}
%endif
%patch0 -p1
%patch1 -p1
# package plugins-runner-vm requires libvirt-python, but the RPM
# version of libvirt-python does not publish the egg info and this
# causes that dep to be attempted to be installed by pip
sed -e "s/'libvirt-python'//" -i optional_plugins/runner_vm/setup.py
%if 0%{?fedora} >= 29
sed -e "s/'fabric'/'fabric3'/" -i optional_plugins/runner_remote/setup.py
%endif
grep -r -l '/usr/bin/env python' . | xargs sed -i 's|/usr/bin/env python|%__python2|'
%build
%{__python2} setup.py build
pushd optional_plugins/html
%{__python2} setup.py build
popd
pushd optional_plugins/runner_remote
%{__python2} setup.py build
popd
pushd optional_plugins/runner_vm
%{__python2} setup.py build
popd
pushd optional_plugins/runner_docker
%{__python2} setup.py build
popd
pushd optional_plugins/resultsdb
%{__python2} setup.py build
popd
pushd optional_plugins/varianter_yaml_to_mux
%{__python2} setup.py build
popd
%{__make} man
%install
%{__python2} setup.py install --root %{buildroot} --skip-build
pushd optional_plugins/html
%{__python2} setup.py install --root %{buildroot} --skip-build
popd
pushd optional_plugins/runner_remote
%{__python2} setup.py install --root %{buildroot} --skip-build
popd
pushd optional_plugins/runner_vm
%{__python2} setup.py install --root %{buildroot} --skip-build
popd
pushd optional_plugins/runner_docker
%{__python2} setup.py install --root %{buildroot} --skip-build
popd
pushd optional_plugins/resultsdb
%{__python2} setup.py install --root %{buildroot} --skip-build
popd
pushd optional_plugins/varianter_yaml_to_mux
%{__python2} setup.py install --root %{buildroot} --skip-build
popd
%{__mv} %{buildroot}%{_bindir}/avocado %{buildroot}%{_bindir}/avocado-%{python2_version}
%{__ln_s} avocado-%{python2_version} %{buildroot}%{_bindir}/avocado-2
%{__ln_s} avocado-%{python2_version} %{buildroot}%{_bindir}/avocado
%{__mv} %{buildroot}%{_bindir}/avocado-rest-client %{buildroot}%{_bindir}/avocado-rest-client-%{python2_version}
%{__ln_s} avocado-rest-client-%{python2_version} %{buildroot}%{_bindir}/avocado-rest-client-2
%{__ln_s} avocado-rest-client-%{python2_version} %{buildroot}%{_bindir}/avocado-rest-client
%{__mkdir_p} %{buildroot}%{_mandir}/man1
%{__install} -m 0644 man/avocado.1 %{buildroot}%{_mandir}/man1/avocado.1
%{__install} -m 0644 man/avocado-rest-client.1 %{buildroot}%{_mandir}/man1/avocado-rest-client.1
%{__install} -d -m 0755 %{buildroot}%{_sharedstatedir}/avocado/data
# relocate examples to documentation directory
%{__mkdir_p} %{buildroot}%{_docdir}/avocado
%{__mv} %{buildroot}%{_datadir}/avocado/tests %{buildroot}%{_docdir}/avocado/tests
%{__mv} %{buildroot}%{_datadir}/avocado/wrappers %{buildroot}%{_docdir}/avocado/wrappers
find %{buildroot}%{_docdir}/avocado -type f -name '*.py' -exec %{__chmod} -c -x {} ';'
%check
%if 0%{?with_tests}
%{__python2} setup.py develop --user
pushd optional_plugins/html
%{__python2} setup.py develop --user
popd
pushd optional_plugins/runner_remote
%{__python2} setup.py develop --user
popd
pushd optional_plugins/runner_vm
%{__python2} setup.py develop --user
popd
pushd optional_plugins/runner_docker
%{__python2} setup.py develop --user
popd
pushd optional_plugins/resultsdb
%{__python2} setup.py develop --user
popd
pushd optional_plugins/varianter_yaml_to_mux
%{__python2} setup.py develop --user
popd
# Package build environments have the least amount of resources
# we have observed so far. Let's avoid tests that require too
# much resources or are time sensitive.
# Also, use of unversioned python is deprecated, so force use of python2 as per
# https://fedoraproject.org/wiki/Changes/Avoid_usr_bin_python_in_RPM_Build
AVOCADO_CHECK_LEVEL=0 UNITTEST_AVOCADO_CMD="$HOME/.local/bin/avocado" %{__python2} selftests/run
%endif
%files -n python2-%{pkgname}
%license LICENSE
%doc README.rst
%dir %{_sysconfdir}/avocado
%dir %{_sysconfdir}/avocado/conf.d
%dir %{_sysconfdir}/avocado/sysinfo
%dir %{_sysconfdir}/avocado/scripts
%dir %{_sysconfdir}/avocado/scripts/job
%dir %{_sysconfdir}/avocado/scripts/job/pre.d
%dir %{_sysconfdir}/avocado/scripts/job/post.d
%config(noreplace) %{_sysconfdir}/avocado/avocado.conf
%config(noreplace) %{_sysconfdir}/avocado/conf.d/gdb.conf
%config(noreplace) %{_sysconfdir}/avocado/sysinfo/commands
%config(noreplace) %{_sysconfdir}/avocado/sysinfo/files
%config(noreplace) %{_sysconfdir}/avocado/sysinfo/profilers
%{_sysconfdir}/avocado/conf.d/README
%{_sysconfdir}/avocado/scripts/job/pre.d/README
%{_sysconfdir}/avocado/scripts/job/post.d/README
%{python2_sitelib}/avocado/
%{python2_sitelib}/avocado_framework-%{version}-py%{python2_version}.egg-info
%{_bindir}/avocado-%{python2_version}
%{_bindir}/avocado-2
%{_bindir}/avocado
%{_bindir}/avocado-rest-client-%{python2_version}
%{_bindir}/avocado-rest-client-2
%{_bindir}/avocado-rest-client
%{_mandir}/man1/avocado.1.gz
%{_mandir}/man1/avocado-rest-client.1.gz
%dir %{_sharedstatedir}/avocado
%dir %{_docdir}/avocado
%{_docdir}/avocado/avocado.rst
%{_docdir}/avocado/avocado-rest-client.rst
%dir %{_libexecdir}/avocado
%{_libexecdir}/avocado/avocado-bash-utils
%{_libexecdir}/avocado/avocado_debug
%{_libexecdir}/avocado/avocado_error
%{_libexecdir}/avocado/avocado_info
%{_libexecdir}/avocado/avocado_warn
%files -n python2-%{pkgname}-plugins-output-html
%{python2_sitelib}/avocado_result_html/
%{python2_sitelib}/avocado_framework_plugin_result_html-%{version}-py%{python2_version}.egg-info
%files -n python2-%{pkgname}-plugins-runner-remote
%{python2_sitelib}/avocado_runner_remote/
%{python2_sitelib}/avocado_framework_plugin_runner_remote-%{version}-py%{python2_version}.egg-info
%files -n python2-%{pkgname}-plugins-runner-vm
%{python2_sitelib}/avocado_runner_vm/
%{python2_sitelib}/avocado_framework_plugin_runner_vm-%{version}-py%{python2_version}.egg-info
%files -n python2-%{pkgname}-plugins-runner-docker
%{python2_sitelib}/avocado_runner_docker/
%{python2_sitelib}/avocado_framework_plugin_runner_docker-%{version}-py%{python2_version}.egg-info
%files -n python2-%{pkgname}-plugins-resultsdb
%{python2_sitelib}/avocado_resultsdb/
%{python2_sitelib}/avocado_framework_plugin_resultsdb-%{version}-py%{python2_version}.egg-info
%files -n python2-%{pkgname}-plugins-varianter-yaml-to-mux
%{python2_sitelib}/avocado_varianter_yaml_to_mux/
%{python2_sitelib}/avocado_framework_plugin_varianter_yaml_to_mux-%{version}-py%{python2_version}.egg-info
%files -n python-%{pkgname}-examples
%dir %{_docdir}/avocado
%{_docdir}/avocado/tests
%{_docdir}/avocado/wrappers
%changelog
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 52.1-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Fri Jun 08 2018 Merlin Mathesius <mmathesi@redhat.com> - 52.1-6
- Correct libvirt dependency for EPEL7/RHEL7
* Mon Jun 04 2018 Merlin Mathesius <mmathesi@redhat.com> - 52.1-5
- Conditionalize python2 dependencies for cross-release compatibility of SPEC
* Mon May 14 2018 Merlin Mathesius <mmathesi@redhat.com> - 52.1-4
- Dependency fabric has been renamed to python2-fabric3
* Mon May 14 2018 Merlin Mathesius <mmathesi@redhat.com> - 52.1-3
- correct python_provide argument typo for varianter-yaml-to-mux plugin
* Mon Apr 9 2018 Cleber Rosa <cleber@redhat.com> - 52.1-2
- Added Fedora CI tests
* Tue Apr 03 2018 Merlin Mathesius <mmathesi@redhat.com> - 52.1-1
- Sync with upstream release 52.1 (LTS series).
- Correct deprecated use of unversioned python.
* Mon Mar 26 2018 Iryna Shcherbina <ishcherb@redhat.com> - 52.0-5
- Update Python 2 dependency declarations to new packaging standards
(See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 52.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Wed Aug 09 2017 Merlin Mathesius <mmathesi@redhat.com> - 52.0-3
- Fix FTBFS error by disabling selfcheck producing false failures
- Update SPEC to use pkgname instead of srcname macro where appropriate
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 52.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Thu Jun 29 2017 Merlin Mathesius <mmathesi@redhat.com> - 52.0-1
- Sync with upstream release 52.0. (BZ#1465409)
* Wed Jun 14 2017 Merlin Mathesius <mmathesi@redhat.com> - 51.0-1
- Sync with upstream release 51.0. (BZ#1460837)
- Disable selftests when libvirt may not be available.
* Wed May 17 2017 Merlin Mathesius <mmathesi@redhat.com> - 50.0-1
- Sync with upstream release 50.0. (BZ#1431413)
- Be explicit about selftest level run on check.
* Tue Apr 25 2017 Merlin Mathesius <mmathesi@redhat.com> - 49.0-1
- Sync with upstream release 49.0. (BZ#1431413)
* Tue Apr 18 2017 Merlin Mathesius <mmathesi@redhat.com> - 48.0-1
- Sync with upstream release 48.0. (BZ#1431413)
- Allow rel_build macro to be defined outside of the SPEC file.
* Mon Mar 27 2017 Merlin Mathesius <mmathesi@redhat.com> - 47.0-1
- Sync with upstream release 47.0.
- Enable self-tests during build.
- Add example test to be run by Taskotron.
* Mon Feb 27 2017 Merlin Mathesius <mmathesi@redhat.com> - 46.0-2
- Incorporate upstream SPEC file changes to split plugins into subpackages.
- Remove obsolete CC-BY-SA license, which went away with the halflings font.
* Tue Feb 14 2017 Merlin Mathesius <mmathesi@redhat.com> - 46.0-1
- Sync with upstream release 46.0.
- Remove halflings license since font was removed from upstream.
- SPEC updates to easily switch between release and snapshot builds.
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 43.0-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Tue Jan 10 2017 Merlin Mathesius <mmathesi@redhat.com> - 43.0-7
- SPEC updates to build and install for EPEL.
* Mon Nov 21 2016 Merlin Mathesius <mmathesi@redhat.com> - 43.0-6
- Initial packaging for Fedora.

View file

@ -1 +0,0 @@
SHA512 (avocado-52.1.tar.gz) = fb97ea6056700f57f34e8e4ce0c27774c386d646aaffc7da2abb8d0a797cff4448934789ffaf81da1592fceae1bb464da2b5dde000730c4f417b03552a432c6c

View file

@ -1,399 +0,0 @@
#!/usr/bin/env python
import os
from six.moves import xrange as range
from avocado import Test
from avocado import main
from avocado.utils import gdb
from avocado.utils import genio
from avocado.utils import process
class GdbTest(Test):
"""
Execute the gdb test
:avocado: tags=requires_c_compiler
"""
VALID_CMDS = ["-list-target-features",
"-break-info",
"-break-list",
"-thread-info",
"-stack-info-frame",
"-stack-info-depth"]
INVALID_CMDS = ["-foobar",
"-magic8ball",
"-find-me-the-bug",
"-auto-debug-it"]
def setUp(self):
return99_source_path = os.path.join(self.datadir, 'return99.c')
segfault_source_path = os.path.join(self.datadir, 'segfault.c')
self.return99_binary_path = os.path.join(self.outputdir, 'return99')
process.system('gcc -O0 -g %s -o %s' % (return99_source_path,
self.return99_binary_path))
self.segfault_binary_path = os.path.join(self.outputdir, 'segfault')
process.system('gcc -O0 -g %s -o %s' % (segfault_source_path,
self.segfault_binary_path))
@staticmethod
def is_process_alive(process):
"""
Checks if a process is still alive
:param process: a :class:`subprocess.POpen` instance
:type process: :class:`subprocess.POpen`
:returns: True or False
:rtype: bool
"""
return process.poll() is None
def test_start_exit(self):
"""
Tests execution of multiple GDB instances without any blocking or race
"""
self.log.info("Testing execution of multiple GDB instances")
process_count = 10
gdb_instances = []
for i in range(0, process_count):
gdb_instances.append(gdb.GDB())
for i in range(0, process_count):
self.assertEqual(gdb_instances[i].exit(), 0)
def test_existing_commands_raw(self):
"""
Tests the GDB response to commands that exist and to those that do not
"""
g = gdb.GDB()
self.log.info("Testing existing (valid) GDB commands using raw commands")
for cmd in self.VALID_CMDS:
info_cmd = "-info-gdb-mi-command %s" % cmd[1:]
r = g.cmd(info_cmd)
self.assertEqual(r.result.result.command.exists, 'true')
self.log.info("Testing non-existing (invalid) GDB commands using raw "
"commands")
for cmd in self.INVALID_CMDS:
info_cmd = "-info-gdb-mi-command %s" % cmd[1:]
r = g.cmd(info_cmd)
self.assertEqual(r.result.result.command.exists, 'false')
def test_existing_commands(self):
g = gdb.GDB()
self.log.info("Testing existing (valid) GDB commands using utility "
"methods")
for cmd in self.VALID_CMDS:
self.assertTrue(g.cmd_exists(cmd))
g.cmd(cmd)
self.log.info("Testing non-existing (invalid) GDB commands using "
"utility methods")
for cmd in self.INVALID_CMDS:
self.assertFalse(g.cmd_exists(cmd))
def test_load_set_breakpoint_run_exit_raw(self):
"""
Test a common GDB cycle using raw commands: load, set break, run, exit
"""
self.log.info("Testing that GDB loads a file and sets a breakpoint")
g = gdb.GDB()
file_cmd = "-file-exec-and-symbols %s" % self.return99_binary_path
r = g.cmd(file_cmd)
self.assertEqual(r.result.class_, 'done')
break_cmd = "-break-insert 5"
r = g.cmd(break_cmd)
self.assertEqual(r.result.class_, 'done')
self.assertEqual(r.result.result.bkpt.number, '1')
self.assertEqual(r.result.result.bkpt.enabled, 'y')
break_del_cmd = "-break-delete 1"
r = g.cmd(break_del_cmd)
self.assertEqual(r.result.class_, 'done')
run_cmd = "-exec-run"
r = g.cmd(run_cmd)
self.assertEqual(r.result.class_, 'running')
g.cmd("-gdb-exit")
self.assertEqual(g.process.wait(), 0)
def test_load_set_breakpoint_run_exit(self):
"""
Test a common GDB cycle: load, set break, delete break, run, exit
"""
self.log.info("Testing a common GDB cycle")
g = gdb.GDB()
g.set_file(self.return99_binary_path)
g.set_break("5")
g.del_break(1)
g.run()
g.exit()
def test_generate_core(self):
"""
Load a file that will cause a segfault and produce a core dump
"""
self.log.info("Testing that a core dump will be generated")
g = gdb.GDB()
file_cmd = "-file-exec-and-symbols %s" % self.segfault_binary_path
r = g.cmd(file_cmd)
self.assertEqual(r.result.class_, 'done')
run_cmd = "-exec-run"
r = g.cmd(run_cmd)
self.assertEqual(r.result.class_, 'running')
other_messages = g.read_until_break()
core_path = None
for msg in other_messages:
parsed_msg = gdb.parse_mi(msg)
if (hasattr(parsed_msg, 'class_') and
(parsed_msg.class_ == 'stopped') and
(parsed_msg.result.signal_name == 'SIGSEGV')):
core_path = "%s.core" % self.segfault_binary_path
gcore_cmd = 'gcore %s' % core_path
gcore_cmd = gdb.encode_mi_cli(gcore_cmd)
r = g.cmd(gcore_cmd)
self.assertEqual(r.result.class_, 'done')
self.assertTrue(os.path.exists(core_path))
g.exit()
def test_set_multiple_break(self):
"""
Tests that multiple breakpoints do not interfere with each other
"""
self.log.info("Testing setting multiple breakpoints")
g = gdb.GDB()
g.set_file(self.return99_binary_path)
g.set_break('empty')
g.set_break('7')
g.exit()
def test_disconnect_raw(self):
"""
Connect/disconnect repeatedly from a remote debugger using raw commands
"""
self.log.info("Testing connecting and disconnecting repeatedly using "
"raw commands")
s = gdb.GDBServer()
g = gdb.GDB()
# Do 100 cycle of target (kind of connects) and disconnects
for _ in range(0, 100):
cmd = '-target-select extended-remote :%s' % s.port
r = g.cmd(cmd)
self.assertEqual(r.result.class_, 'connected')
r = g.cmd('-target-disconnect')
self.assertEqual(r.result.class_, 'done')
# manual server shutdown
cmd = '-target-select extended-remote :%s' % s.port
r = g.cmd(cmd)
self.assertEqual(r.result.class_, 'connected')
r = g.cli_cmd('monitor exit')
self.assertEqual(r.result.class_, 'done')
g.exit()
s.exit()
def test_disconnect(self):
"""
Connect/disconnect repeatedly from a remote debugger using utilities
"""
self.log.info("Testing connecting and disconnecting repeatedly")
s = gdb.GDBServer()
g = gdb.GDB()
for _ in range(0, 100):
r = g.connect(s.port)
self.assertEqual(r.result.class_, 'connected')
r = g.disconnect()
self.assertEqual(r.result.class_, 'done')
g.exit()
s.exit()
def test_remote_exec(self):
"""
Tests execution on a remote target
"""
self.log.info("Testing execution on a remote target")
hit_breakpoint = False
s = gdb.GDBServer()
g = gdb.GDB()
cmd = '-file-exec-and-symbols %s' % self.return99_binary_path
r = g.cmd(cmd)
self.assertEqual(r.result.class_, 'done')
cmd = 'set remote exec-file %s' % self.return99_binary_path
r = g.cmd(cmd)
self.assertEqual(r.result.class_, 'done')
cmd = "-break-insert %s" % 'main'
r = g.cmd(cmd)
self.assertEqual(r.result.class_, 'done')
r = g.cmd('-exec-run')
other_messages = g.read_until_break()
for msg in other_messages:
parsed_msg = gdb.parse_mi(msg)
if (hasattr(parsed_msg, 'class_') and
parsed_msg.class_ == 'stopped' and
parsed_msg.result.reason == 'breakpoint-hit'):
hit_breakpoint = True
self.assertTrue(hit_breakpoint)
g.exit()
s.exit()
def test_stream_messages(self):
"""
Tests if the expected response appears in the result stream messages
"""
self.log.info("Testing that messages appears in the result stream")
g = gdb.GDB()
r = g.cmd("-gdb-version")
self.assertIn("GNU GPL version", r.get_stream_messages_text())
def test_connect_multiple_clients(self):
"""
Tests two or more connections to the same server raise an exception
"""
self.log.info("Testing that multiple clients cannot connect at once")
s = gdb.GDBServer()
c1 = gdb.GDB()
c1.connect(s.port)
c2 = gdb.GDB()
self.assertRaises(ValueError, c2.connect, s.port)
s.exit()
def test_server_exit(self):
"""
Tests that the server is shutdown by using a monitor exit command
"""
self.log.info("Testing that a single server exits cleanly")
s = gdb.GDBServer()
s.exit()
self.assertFalse(self.is_process_alive(s.process))
def test_multiple_servers(self):
"""
Tests multiple server instances without any blocking or race condition
"""
self.log.info("Testing execution of multiple GDB server instances")
process_count = 10
server_instances = []
for i in range(0, process_count):
s = gdb.GDBServer()
c = gdb.GDB()
c.connect(s.port)
c.cmd('show-version')
c.disconnect()
server_instances.append(s)
for i in range(0, process_count):
self.assertTrue(self.is_process_alive(server_instances[i].process))
server_instances[i].exit()
self.assertFalse(self.is_process_alive(server_instances[i].process))
def test_interactive(self):
"""
Tests avocado's GDB plugin features
If GDB command line options are given, `--gdb-run-bin=return99` for
this particular test, the test will stop at binary main() function.
"""
self.log.info('Testing GDB interactivity')
process.run(self.return99_binary_path, ignore_status=True)
def test_interactive_args(self):
"""
Tests avocado's GDB plugin features with an executable and args
If GDB command line options are given, `--gdb-run-bin=return99` for
this particular test, the test will stop at binary main() function.
This test uses `process.run()` without an `ignore_status` parameter
"""
self.log.info('Testing GDB interactivity with arguments')
result = process.run("%s 0" % self.return99_binary_path)
self.assertEqual(result.exit_status, 0)
def test_exit_status(self):
"""
Tests avocado's GDB plugin features
If GDB command line options are given, `--gdb-run-bin=return99` for
this particular test, the test will stop at binary main() function.
"""
self.log.info('Testing process exit statuses')
for arg, exp in [(-1, 255), (8, 8)]:
self.log.info('Expecting exit status "%s"', exp)
cmd = "%s %s" % (self.return99_binary_path, arg)
result = process.run(cmd, ignore_status=True)
self.assertEqual(result.exit_status, exp)
def test_server_stderr(self):
self.log.info('Testing server stderr collection')
s = gdb.GDBServer()
s.exit()
self.assertTrue(os.path.exists(s.stderr_path))
stderr_lines = genio.read_all_lines(s.stderr_path)
listening_line = "Listening on port %s" % s.port
self.assertIn(listening_line, stderr_lines)
def test_server_stdout(self):
self.log.info('Testing server stdout/stderr collection')
s = gdb.GDBServer()
c = gdb.GDB()
c.connect(s.port)
c.set_file(self.return99_binary_path)
c.run()
s.exit()
self.assertTrue(os.path.exists(s.stdout_path))
self.assertTrue(os.path.exists(s.stderr_path))
stdout_lines = genio.read_all_lines(s.stdout_path)
self.assertIn("return 99", stdout_lines)
def test_interactive_stdout(self):
"""
Tests avocado's GDB plugin features
If GDB command line options are given, `--gdb-run-bin=return99` for
this particular test, the test will stop at binary main() function.
"""
self.log.info('Testing GDB interactivity')
result = process.run(self.return99_binary_path, ignore_status=True)
self.assertIn("return 99\n", result.stdout)
def test_remote(self):
"""
Tests GDBRemote interaction with a GDBServer
"""
s = gdb.GDBServer()
r = gdb.GDBRemote('127.0.0.1', s.port)
r.connect()
r.cmd("qSupported")
r.cmd("qfThreadInfo")
s.exit()
if __name__ == '__main__':
main()

View file

@ -1,47 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
void empty()
{
}
void write_stdout()
{
fprintf(stdout, "testing output to stdout\n");
}
void write_stderr()
{
fprintf(stderr, "testing output to stderr\n");
}
int forkme()
{
int pid;
pid = fork();
if (pid != 0)
pid = fork();
if (pid != 0)
pid = fork();
return pid;
}
int main(int argc, char *argv[])
{
int exit_status = 99;
if (argc > 1)
exit_status = atoi(argv[1]);
empty();
write_stdout();
write_stderr();
if (forkme()) {
fprintf(stdout, "return %i\n", exit_status);
}
return exit_status;
}

View file

@ -1,9 +0,0 @@
#include <stdio.h>
int main()
{
int *p = NULL;
*p = 0xdead;
return 0;
}

View file

@ -1,29 +0,0 @@
- hosts: localhost
roles:
- role: standard-test-avocado
tests:
- gdbtest.py:GdbTest.test_start_exit
- gdbtest.py:GdbTest.test_existing_commands
- gdbtest.py:GdbTest.test_existing_commands_raw
- gdbtest.py:GdbTest.test_load_set_breakpoint_run_exit_raw
- gdbtest.py:GdbTest.test_load_set_breakpoint_run_exit
- gdbtest.py:GdbTest.test_generate_core
- gdbtest.py:GdbTest.test_set_multiple_break
- gdbtest.py:GdbTest.test_disconnect_raw
- gdbtest.py:GdbTest.test_disconnect
- gdbtest.py:GdbTest.test_remote_exec
- gdbtest.py:GdbTest.test_stream_messages
- gdbtest.py:GdbTest.test_connect_multiple_clients
- gdbtest.py:GdbTest.test_server_exit
- gdbtest.py:GdbTest.test_server_stdout
- gdbtest.py:GdbTest.test_server_stderr
- gdbtest.py:GdbTest.test_multiple_servers
- gdbtest.py:GdbTest.test_interactive
- gdbtest.py:GdbTest.test_interactive_args
- gdbtest.py:GdbTest.test_exit_status
- gdbtest.py:GdbTest.test_interactive_stdout
- gdbtest.py:GdbTest.test_remote
required_packages:
- gcc
- gdb
- gdb-gdbserver