aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2016-03-09 12:07:15 +0100
committerDmitry Vyukov <dvyukov@google.com>2016-03-10 17:47:13 +0100
commit4b4dc9d1f30c996dc5eefbecbf91399939adbee5 (patch)
tree77811450cd2727273961bbfc00bf780be8a3b90e
parentf419fc90dd6b663ac04d1a46c8bf99e1437609dc (diff)
executor: ignore the case when test process kills loop process
This lead to lots of false positives.
-rw-r--r--executor/executor.cc3
-rw-r--r--ipc/ipc.go17
2 files changed, 15 insertions, 5 deletions
diff --git a/executor/executor.cc b/executor/executor.cc
index 4405548df..6c63b4667 100644
--- a/executor/executor.cc
+++ b/executor/executor.cc
@@ -59,6 +59,7 @@ const uint64_t arg_data = 2;
const int kFailStatus = 67;
const int kErrorStatus = 68;
+const int kRetryStatus = 69;
// We use the default value instead of results of failed syscalls.
// -1 is an invalid fd and an invalid address and deterministic,
@@ -976,7 +977,7 @@ void exitf(const char* msg, ...)
vfprintf(stderr, msg, args);
va_end(args);
fprintf(stderr, " (errno %d)\n", e);
- exit(1);
+ exit(kRetryStatus);
}
void debug(const char* msg, ...)
diff --git a/ipc/ipc.go b/ipc/ipc.go
index 92c1a253e..8301d0f78 100644
--- a/ipc/ipc.go
+++ b/ipc/ipc.go
@@ -174,8 +174,9 @@ func (env *Env) Exec(p *prog.Prog) (output []byte, cov [][]uint32, errnos []int,
return
}
}
- output, failed, hanged, err0 = env.cmd.exec()
- if err0 != nil {
+ var restart bool
+ output, failed, hanged, restart, err0 = env.cmd.exec()
+ if err0 != nil || restart {
env.cmd.close()
env.cmd = nil
return
@@ -404,7 +405,7 @@ func (c *command) kill() {
syscall.Kill(c.cmd.Process.Pid, syscall.SIGKILL)
}
-func (c *command) exec() (output []byte, failed, hanged bool, err0 error) {
+func (c *command) exec() (output []byte, failed, hanged, restart bool, err0 error) {
var tmp [1]byte
if _, err := c.outwp.Write(tmp[:]); err != nil {
output, _ = ioutil.ReadAll(c.rp)
@@ -448,11 +449,19 @@ func (c *command) exec() (output []byte, failed, hanged bool, err0 error) {
// Magic values returned by executor.
if ws.ExitStatus() == 67 {
err0 = fmt.Errorf("executor failed: %s", output)
- return
}
if ws.ExitStatus() == 68 {
failed = true
}
+ if ws.ExitStatus() == 69 {
+ // This is a temporal error (ENOMEM) or an unfortunate
+ // program that messes with testing setup (e.g. kills executor
+ // loop process). Pretend that nothing happened.
+ // It's better than a false crash report.
+ err0 = nil
+ hanged = false
+ restart = true
+ }
}
}
return