Skip to content

Commit

Permalink
test: remove old test suite code no longer used \o/
Browse files Browse the repository at this point in the history
  • Loading branch information
scop committed May 11, 2020
1 parent 21d4fba commit 5afc3b5
Show file tree
Hide file tree
Showing 13 changed files with 19 additions and 530 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ standard commands for GNU autotools packages:
autoreconf -i # if not installing from prepared release tarball
./configure
make
make check # optional, requires python3 with pytest >= 3.6 and
# pexpect, dejagnu
make check # optional, requires python3 with pytest >= 3.6, pexpect
make install # as root
```

Expand Down
47 changes: 8 additions & 39 deletions doc/testing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,8 @@ The bash-completion package contains an automated test suite. Running the
tests should help verifying that bash-completion works as expected. The tests
are also very helpful in uncovering software regressions at an early stage.

The original, "legacy" bash-completion test suite is written on top of the
https://www.gnu.org/software/dejagnu/[DejaGnu] testing framework. DejaGnu is
written in https://core.tcl-lang.org/expect/index[Expect], which in turn uses
https://www.tcl-lang.org/[Tcl] -- Tool command language.

Most of the test framework has been ported over to use
https://pytest.org/[pytest] and https://pexpect.readthedocs.io/[pexpect].
Eventually, all of it should be ported.
The test suite is written in Python, using https://pytest.org/[pytest]
and https://pexpect.readthedocs.io/[pexpect].


Coding Style Guide
Expand All @@ -24,9 +18,6 @@ For the Python part, all of it is formatted using
https://github.com/ambv/black[Black], and we also run
https://flake8.pycqa.org/[Flake8] on it.

The legacy test suite tries to adhere to this
https://wiki.tcl-lang.org/page/Tcl+Style+Guide[Tcl Style Guide].


Installing dependencies
-----------------------
Expand All @@ -45,7 +36,7 @@ Debian/Ubuntu

On Debian/Ubuntu you can use `apt-get`:
-------------
sudo apt-get install python3-pytest python3-pexpect dejagnu
sudo apt-get install python3-pytest python3-pexpect
-------------
This should also install the necessary dependencies. Only Debian testing
(buster) and Ubuntu 18.10 (cosmic) and later have an appropriate version
Expand All @@ -56,7 +47,7 @@ Fedora/RHEL/CentOS

On Fedora and RHEL/CentOS (with EPEL) you can try `yum` or `dnf`:
-------------
sudo yum install python3-pytest python3-pexpect dejagnu
sudo yum install python3-pytest python3-pexpect
-------------
This should also install the necessary dependencies. At time of writing, only
Fedora 29 comes with recent enough pytest.
Expand All @@ -66,41 +57,19 @@ Fedora 29 comes with recent enough pytest.
Structure
---------

Pytest tests are in the `t/` subdirectory, with `t/test_\*.py` being
completion tests, and `t/unit/test_unit_\*.py` unit tests.

Legacy tests are grouped into different areas, called _tool_ in DejaGnu:

*completion*::
Functional tests per completion.
*install*::
Functional tests for installation and caching of the main bash-completion
package.
*unit*::
Unit tests for bash-completion helper functions.
Tests are in the `t/` subdirectory, with `t/test_\*.py` being completion
tests, and `t/unit/test_unit_\*.py` unit tests.


Running the tests
-----------------

Python based tests are run by calling `pytest` on the desired test directories
or individual files, for example in the project root directory:
Tests are run by calling `pytest` on the desired test directories or
individual files, for example in the project root directory:
-----------------------
pytest test/t
-----------------------

Legacy tests are run by calling `runtest` command in the test directory:
-----------------------
runtest --outdir log --tool install
runtest --outdir log --tool unit
-----------------------
The commands above are already wrapped up in shell scripts within the `test`
directory:
-----------------------
./runInstall
./runUnit
-----------------------

See `test/docker/docker-script.sh` for how and what we run and test in CI.


Expand Down
5 changes: 0 additions & 5 deletions test/.gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,2 @@
log/
tmp/
dbg.log
xtrace.log
site.exp
site.bak
pytestdebug.log
12 changes: 3 additions & 9 deletions test/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
AUTOMAKE_OPTIONS = dejagnu
DEJATOOL = install unit
AM_RUNTESTFLAGS = --outdir log --ignore $(PACKAGE).log

SUBDIRS = t

EXTRA_DIST = config \
fixtures \
lib \
setup.cfg \
unit
setup.cfg

all:
$(MKDIR_P) log tmp
$(MKDIR_P) tmp

CLEANFILES = \
fixtures/make/extra_makefile

clean-local:
$(RM) -rf log tmp
$(RM) -rf tmp
9 changes: 6 additions & 3 deletions test/config/bashrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# bashrc file for bash-completion test suite

# Note that we do some initialization that would be too late to do here in
# library.exp's start_bash() and conftest.py.
# conftest.py.

# Use emacs key bindings
set -o emacs
Expand Down Expand Up @@ -44,8 +44,11 @@ unset -v \
COMP_KNOWN_HOSTS_WITH_HOSTFILE \
COMP_TAR_INTERNAL_PATHS

# Load bash testsuite helper functions
. $SRCDIR/lib/library.sh
# @param $1 Char to add to $COMP_WORDBREAKS
add_comp_wordbreak_char()
{
[[ "${COMP_WORDBREAKS//[^$1]/}" ]] || COMP_WORDBREAKS+=$1
}

# Local variables:
# mode: shell-script
Expand Down
21 changes: 0 additions & 21 deletions test/config/default.exp

This file was deleted.

3 changes: 1 addition & 2 deletions test/docker/docker-script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@ autoreconf -i
make -j

xvfb-run make distcheck \
PYTESTFLAGS="--verbose --numprocesses=auto --dist=loadfile" \
RUNTESTFLAGS="--all --verbose"
PYTESTFLAGS="--verbose --numprocesses=auto --dist=loadfile"
Loading

0 comments on commit 5afc3b5

Please sign in to comment.