git » chasquid » commit 2498310

courier: Skip test if test/util/exitcode is not found

author Alberto Bertogli
2016-11-20 18:30:30 UTC
committer Alberto Bertogli
2016-11-20 18:30:30 UTC
parent db130639c240a53d732890d8b1de8b64d5f9723d

courier: Skip test if test/util/exitcode is not found

When building the Debian package, the tests are run in such a way that
test/util/exitcode is not found, which causes them to fail.

This patch is a workaround which skips the test if test/util/exitcode is
not found; for now we should consider it temporary, until either the
Debian packaging is fixed, or we decide that its environment is
reasonably enough to make it permanent.
:

internal/courier/procmail_test.go +7 -0

diff --git a/internal/courier/procmail_test.go b/internal/courier/procmail_test.go
index a6fc4ea..0668a36 100644
--- a/internal/courier/procmail_test.go
+++ b/internal/courier/procmail_test.go
@@ -66,6 +66,13 @@ func TestProcmailBadCommandLine(t *testing.T) {
 // Test that local delivery failures are considered permanent or not
 // according to the exit code.
 func TestExitCode(t *testing.T) {
+	// TODO: This can happen when building under unusual circumstances, such
+	// as Debian package building. Are they reasonable enough for us to keep
+	// this?
+	if _, err := os.Stat("../../test/util/exitcode"); os.IsNotExist(err) {
+		t.Skipf("util/exitcode not found, running from outside repo?")
+	}
+
 	cases := []struct {
 		cmd             string
 		args            []string