[Dev] [dbscripts] [PATCH 00/31] Backport Pierre's April 2017 test suite improvements

Luke Shumaker lukeshu at lukeshu.com
Fri Apr 6 18:43:33 GMT 2018

From: Luke Shumaker <lukeshu at parabola.nu>

Before applying these changes to 'master', I'd like to submit them
here for comments.  This patchset is also published as the
'lukeshu/pierre-tests' branch in git.

The last few big patchsets have been setting the stage for this:

 (1) My first big recent patchset (which I didn't submit to the list;
     it was the 18 commits 323706b19^..ffedeab54) re-organized our
     test suite to be shaped like Arch's: move files around, and
     adjust it to use BATS instead of shUnit2.  This got it ready to
     backport changes from Arch.  However, it left the test suite
     horribly, slow, taking a full hour to run (on
     beefcake.parabola.nu).  This made it very difficult to work on
     the tests.

 (2) So then, the next big patchset (lukeshu/fast-tests) backported
     from Arch the ability for the test suite to cache
     `makepkg/makechrootpkg/libremakepkg` results, speeding the test
     suite up to about 13 minutes.

 (3) However, that wasn't perfect (sometimes the cache got corrupted),
     and was still slower than it could be.  So lukeshu/faster-tests
     backported the cache corruption fix, and also made it so that the
     cache could persist across test suite runs.  Down to 7-8 minutes
     for a full run (assuming a full cache)!

So now, let's get the payoff; backport Pierre Schmitz' April 2017
improvements to the test suite!  When cherry-picking these, some of
the conflict resolutions are non-obvious or tricky.

This also includes a couple of fixes for issues that are unearthed by
the improved tests:

 - db-repo-add: Fix adding arch=(any) packages (normally packages are
   added directly by db-update or db-import, so this wasn't terribly
 - db-update: Be stricter about package names

Unlike Pierre's changes in Arch, this doesn't have us use Docker for
the test suite.  There are a few reasons for that, but the biggest is
that we don't have a standard up-to-date Docker image of Parabola.

I have verified that at each and every commit (except for the one
tagged [ci skip]) the tests pass (allowing caching packages between
commits), and have also verified that the tests pass with an empty
package cache at the most recent commit.

Eli Schwartz (1):
  test: Don't treat PKGEXT as a glob

Luke Shumaker (10):
  test: common.bash: checkPackageDB(): Require the DB file to exist
  test: common.bash: Do better quoting when setting xbs-abs.conf:ARCHES
  .gitignore: Tidy
  test: common.bash: Move __buildPackage() down in the file
  test: ftpdir-cleanup: "cleanup split packages": Correctly iterate
  test: Prefer to check status with 'run' and $status
  test: Don't direct {pushd,popd,svn,ftpdir-cleanup} to /dev/null
  test: common.bash: Move __buildPackage() up in the file
  test: ftpdir-cleanup: Fix variable name mistake: ${pkg[0]} ->
  test: common.bash: Fix syntax mistake: $pkgarches[@] ->

Pierre Schmitz (20):
  Add travis configuration
  Add editor configuration
  Use a minimal travis environment
  db-repo-add: Fix adding of 'any' packages
  db-repo-remove: Test removal of 'any' packages
  ftpdir-cleanup: Test removal of old packages
  db-update: Disallow invalid package names [ci skip]
  Avoid replacing the temporary dir by accident
  db-update: Test if package cannot be added if svn is inconsistent
  db-update: Test package validation
  Move package build and update functions to common library
  Remove test for file database as this feature was moved to
    pacman/repo-add a long time ago
  Mark private test functions
  Extend check functions to handle 'any' packages as well
  Move common checks to functions
  Remove useless code
  Allways build packages for all supported architectures
  Reduce test dependencies
  Correctly use checkRemovedPackage
  Move package and db checks from test cases to library

 .editorconfig                           |   7 +
 .gitignore                              |   7 +-
 .travis.yml                             |   9 +
 db-functions                            |   2 +-
 db-repo-add                             |   4 +-
 test/Makefile                           |   6 +-
 test/cases/create-filelists.bats        |  95 -----------
 test/cases/db-move.bats                 |  59 ++-----
 test/cases/db-remove.bats               |  20 +--
 test/cases/db-repo-add.bats             |  60 +++++--
 test/cases/db-repo-remove.bats          |  35 ++--
 test/cases/db-update.bats               | 188 ++++++++++++---------
 test/cases/ftpdir-cleanup.bats          | 107 +++++++-----
 test/cases/packages.bats                |  45 -----
 test/cases/sourceballs.bats             |  34 ++--
 test/fixtures/pkg-any-a/PKGBUILD        |   1 +
 test/fixtures/pkg-any-b/PKGBUILD        |   1 +
 test/fixtures/pkg-simple-a/PKGBUILD     |   1 +
 test/fixtures/pkg-simple-b/PKGBUILD     |   1 +
 test/fixtures/pkg-simple-epoch/PKGBUILD |   1 +
 test/fixtures/pkg-single-arch/PKGBUILD  |  13 ++
 test/fixtures/pkg-single-epoch/PKGBUILD |  14 ++
 test/fixtures/pkg-split-a/PKGBUILD      |   1 +
 test/fixtures/pkg-split-b/PKGBUILD      |   1 +
 test/lib/common.bash                    | 280 ++++++++++++++++----------------
 25 files changed, 495 insertions(+), 497 deletions(-)
 create mode 100644 .editorconfig
 create mode 100644 .travis.yml
 delete mode 100755 test/cases/create-filelists.bats
 delete mode 100755 test/cases/packages.bats
 create mode 100644 test/fixtures/pkg-single-arch/PKGBUILD
 create mode 100644 test/fixtures/pkg-single-epoch/PKGBUILD

Happy hacking,
~ Luke Shumaker

More information about the Dev mailing list