diff options
author | Ben Hutchings <ben.hutchings@codethink.co.uk> | 2020-09-16 23:49:23 +0100 |
---|---|---|
committer | Ben Hutchings <ben.hutchings@codethink.co.uk> | 2020-09-16 23:55:36 +0100 |
commit | dfd9a7d9ad8be7b467f2203ccaa7b3e8ccb91f4a (patch) | |
tree | b48f2b5e8c06df31968461113ccfcbe682537517 /tests | |
parent | c356e375704e3951a6fa7db1097cef6182383047 (diff) | |
download | lorry-dfd9a7d9ad8be7b467f2203ccaa7b3e8ccb91f4a.tar.gz |
tests: Clear out $DATADIR after every test
Some tests have a teardown script that removes their temporary files,
but most do not.
To avoid interference or dependencies between tests, use a global
teardown script that removes almost everything in $DATADIR. It
excludes git-upstream, which is intentionally set up once and read by
multiple tests.
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/git-backup-on-error-multiple-backups.teardown | 21 | ||||
-rwxr-xr-x | tests/git-backup-on-error-single-backup-is-removed-if-exists.teardown | 21 | ||||
-rwxr-xr-x | tests/git-backup-on-error-single-backup.teardown | 21 | ||||
-rwxr-xr-x | tests/hg-incremental.teardown | 21 | ||||
-rwxr-xr-x | tests/hg-single-commit.teardown | 21 | ||||
-rwxr-xr-x | tests/hg-unnamed-head.teardown | 21 | ||||
-rwxr-xr-x | tests/migrate-oldstyle-repos.teardown | 21 | ||||
-rwxr-xr-x | tests/repo-update-count.teardown | 21 | ||||
-rwxr-xr-x | tests/teardown | 7 |
9 files changed, 7 insertions, 168 deletions
diff --git a/tests/git-backup-on-error-multiple-backups.teardown b/tests/git-backup-on-error-multiple-backups.teardown deleted file mode 100755 index 8b5bef3..0000000 --- a/tests/git-backup-on-error-multiple-backups.teardown +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -# -# Tests when a git mirror fails that it keeps the backups around -# -# Copyright (C) 2012-2013 Codethink Limited -# -# 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; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - -rm -r "$DATADIR/git-backup-test-repo.log" "$DATADIR/work-dir" diff --git a/tests/git-backup-on-error-single-backup-is-removed-if-exists.teardown b/tests/git-backup-on-error-single-backup-is-removed-if-exists.teardown deleted file mode 100755 index 8b5bef3..0000000 --- a/tests/git-backup-on-error-single-backup-is-removed-if-exists.teardown +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -# -# Tests when a git mirror fails that it keeps the backups around -# -# Copyright (C) 2012-2013 Codethink Limited -# -# 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; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - -rm -r "$DATADIR/git-backup-test-repo.log" "$DATADIR/work-dir" diff --git a/tests/git-backup-on-error-single-backup.teardown b/tests/git-backup-on-error-single-backup.teardown deleted file mode 100755 index 8b5bef3..0000000 --- a/tests/git-backup-on-error-single-backup.teardown +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -# -# Tests when a git mirror fails that it keeps the backups around -# -# Copyright (C) 2012-2013 Codethink Limited -# -# 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; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - -rm -r "$DATADIR/git-backup-test-repo.log" "$DATADIR/work-dir" diff --git a/tests/hg-incremental.teardown b/tests/hg-incremental.teardown deleted file mode 100755 index 409c26b..0000000 --- a/tests/hg-incremental.teardown +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -# -# Tests incremental conversion of a simple hg repository to git. -# -# Copyright (C) 2020 Codethink Limited -# -# 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; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - -rm -rf "$DATADIR/hg-test-repo" "$DATADIR/hg-test-repo.lorry" "$DATADIR/work-dir" diff --git a/tests/hg-single-commit.teardown b/tests/hg-single-commit.teardown deleted file mode 100755 index 5a6aa57..0000000 --- a/tests/hg-single-commit.teardown +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -# -# Tests converting a simple hg repository to git. -# -# Copyright (C) 2020 Codethink Limited -# -# 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; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - -rm -rf "$DATADIR/hg-test-repo" "$DATADIR/hg-test-repo.lorry" "$DATADIR/work-dir" diff --git a/tests/hg-unnamed-head.teardown b/tests/hg-unnamed-head.teardown deleted file mode 100755 index 8b8cee1..0000000 --- a/tests/hg-unnamed-head.teardown +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -# -# Regression test for https://gitlab.com/CodethinkLabs/lorry/lorry/-/issues/7 -# -# Copyright (C) 2020 Codethink Limited -# -# 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; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - -rm -rf "$DATADIR/hg-test-repo" "$DATADIR/hg-test-repo.lorry" "$DATADIR/work-dir" diff --git a/tests/migrate-oldstyle-repos.teardown b/tests/migrate-oldstyle-repos.teardown deleted file mode 100755 index 19d1cb1..0000000 --- a/tests/migrate-oldstyle-repos.teardown +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -# -# Tests migration of old-style working repositories -# -# Copyright (C) 2020 Codethink Limited -# -# 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; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - -rm -r "$DATADIR/migrate-test-repo.log" "$DATADIR/work-dir" diff --git a/tests/repo-update-count.teardown b/tests/repo-update-count.teardown deleted file mode 100755 index b400abf..0000000 --- a/tests/repo-update-count.teardown +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -# -# Tests update counts in working repositories -# -# Copyright (C) 2020 Codethink Limited -# -# 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; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - -rm -r "$DATADIR/update-count-test-repo.log" "$DATADIR/work-dir" diff --git a/tests/teardown b/tests/teardown new file mode 100755 index 0000000..c821266 --- /dev/null +++ b/tests/teardown @@ -0,0 +1,7 @@ +#!/bin/sh + +set -e + +# Delete everything under $DATADIR except git-upstream +find "$DATADIR" -mindepth 1 -maxdepth 1 \! -path "$DATADIR/git-upstream" \ + -exec rm -rf {} \+ |