camput: re-enable deadlock test, now that it's fixed

And tweak limits a bit lower.

Change-Id: I7a38ffce37a997aa6ce9943e13605e76476f5646
This commit is contained in:
Brad Fitzpatrick 2014-02-21 15:38:21 -08:00
parent 735aca5825
commit ccacf76451
2 changed files with 12 additions and 14 deletions

View File

@ -23,7 +23,6 @@ import (
"os" "os"
"path/filepath" "path/filepath"
"runtime" "runtime"
"strconv"
"strings" "strings"
"testing" "testing"
"time" "time"
@ -121,11 +120,6 @@ func TestUploadDirectories(t *testing.T) {
if testing.Short() { if testing.Short() {
t.Skip("skipping test in short mode.") t.Skip("skipping test in short mode.")
} }
if v, _ := strconv.ParseBool(os.Getenv("RUN_UPLOAD_DEADLOCK_TEST")); !v {
// Temporary. For now the test isn't working (failing) reliably.
// Once the test fails reliably, then we fix.
t.Skip("skipping test without RUN_UPLOAD_DEADLOCK_TEST=1 in environment")
}
debugFlagOnce.Do(registerDebugFlags) debugFlagOnce.Do(registerDebugFlags)
@ -168,9 +162,13 @@ func TestUploadDirectories(t *testing.T) {
dirIter = dirPath dirIter = dirPath
} }
// Now set statCacheWorkers greater than uploadWorkers, so the
// sleep above can re-arrange the order that files get
// uploaded in, so the directory comes before the file. This
// was the old deadlock.
defer setAndRestore(&uploadWorkers, 1)() defer setAndRestore(&uploadWorkers, 1)()
defer setAndRestore(&dirUploadWorkers, 1)() defer setAndRestore(&dirUploadWorkers, 1)()
defer setAndRestore(&statCacheWorkers, 1)() defer setAndRestore(&statCacheWorkers, 5)()
e := &env{ e := &env{
Timeout: 5 * time.Second, Timeout: 5 * time.Second,

View File

@ -65,12 +65,12 @@ type fileCmd struct {
histo string // optional histogram output filename histo string // optional histogram output filename
} }
var ( var flagUseSQLiteChildCache bool // Use sqlite for the statcache and havecache.
flagUseSQLiteChildCache bool // Use sqlite for the statcache and havecache.
uploadWorkers = 10 // concurrent upload workers (negative means unbounded: memory hog) var (
dirUploadWorkers = 5 // concurrent directory uploading workers uploadWorkers = 5 // concurrent upload workers (negative means unbounded: memory hog)
statCacheWorkers = 10 // concurrent statcache workers dirUploadWorkers = 3 // concurrent directory uploading workers
statCacheWorkers = 5 // concurrent statcache workers
) )
func init() { func init() {
@ -101,9 +101,9 @@ func init() {
if android.IsChild() { if android.IsChild() {
flags.BoolVar(&cmd.argsFromInput, "stdinargs", false, "If true, filenames to upload are sent one-per-line on stdin. EOF means to quit the process with exit status 0.") flags.BoolVar(&cmd.argsFromInput, "stdinargs", false, "If true, filenames to upload are sent one-per-line on stdin. EOF means to quit the process with exit status 0.")
// limit number of goroutines to limit memory // limit number of goroutines to limit memory
uploadWorkers = 3 uploadWorkers = 2
dirUploadWorkers = 2 dirUploadWorkers = 2
statCacheWorkers = 3 statCacheWorkers = 2
} }
flagCacheLog = flags.Bool("logcache", false, "log caching details") flagCacheLog = flags.Bool("logcache", false, "log caching details")