aboutsummaryrefslogtreecommitdiff
path: root/compiler_wrapper/testutil_test.go
diff options
context:
space:
mode:
authorChih-Hung Hsieh <chh@google.com>2021-09-15 10:58:06 -0700
committerCommit Bot <commit-bot@chromium.org>2021-09-15 21:14:55 +0000
commit8c582e59426fe05fa275ed44bf7d73ab4070b146 (patch)
treedc62927598d3e9d9b35ca8982c1a37c9488469ac /compiler_wrapper/testutil_test.go
parent297b3d6fcec5871fc431408e6e6f0edc28a3306a (diff)
downloadtoolchain-utils-8c582e59426fe05fa275ed44bf7d73ab4070b146.tar.gz
compiler_wrapper: Handle TIDY_TIMEOUT for Android clang-tidy
* To check in upstream chromeos tools. * In Android mode, for clang-tidy, call runAndroidClangTidy to handle TIDY_TIMEOUT * Add runWithTimeout to env.go and runCmdWithTimeouit to command.go. BUG=b:199451930 TEST=Use a fake Android clang-tidy.real binary, TEST=to dump passed environment variables and run for required time. Change-Id: I629ae372251c034595011ef70559f8b12ed8568c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/3162668 Reviewed-by: Chih-Hung Hsieh <chh@google.com> Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Tested-by: George Burgess <gbiv@chromium.org> Commit-Queue: George Burgess <gbiv@chromium.org>
Diffstat (limited to 'compiler_wrapper/testutil_test.go')
-rw-r--r--compiler_wrapper/testutil_test.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler_wrapper/testutil_test.go b/compiler_wrapper/testutil_test.go
index 67081207..035f2373 100644
--- a/compiler_wrapper/testutil_test.go
+++ b/compiler_wrapper/testutil_test.go
@@ -17,6 +17,7 @@ import (
"sync"
"syscall"
"testing"
+ "time"
)
const (
@@ -160,6 +161,10 @@ func (ctx *testContext) run(cmd *command, stdin io.Reader, stdout io.Writer, std
return nil
}
+func (ctx *testContext) runWithTimeout(cmd *command, duration time.Duration) error {
+ return ctx.exec(cmd)
+}
+
func (ctx *testContext) exec(cmd *command) error {
ctx.cmdCount++
ctx.lastCmd = cmd