diff options
author | Colin Cross <ccross@android.com> | 2019-09-23 12:44:54 -0700 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2019-09-23 14:24:57 -0700 |
commit | c0b9f6b9d256ca59faf89b3636d90346c24d674a (patch) | |
tree | f664f3adffe930c31f50e85dfcdccec29afad48a /ui/terminal | |
parent | f0b987ecba2b014a8bf11b93367b8d5368bdf629 (diff) | |
download | build_soong-c0b9f6b9d256ca59faf89b3636d90346c24d674a.tar.gz build_soong-c0b9f6b9d256ca59faf89b3636d90346c24d674a.tar.bz2 build_soong-c0b9f6b9d256ca59faf89b3636d90346c24d674a.zip |
Force dumpvars into dumb terminal mode and move log files
Force soong_ui in dumpvars mode to use a dumb terminal so that it
doesn't print an empty status table. Also move the logs to files
that are prefixed with "dumpvars-" so that they don't rotate the
real build logs.
Fixes: 139307849
Test: lunch
Change-Id: If92421af07731fedc9ca42670f309e95922a2224
Diffstat (limited to 'ui/terminal')
-rw-r--r-- | ui/terminal/status.go | 4 | ||||
-rw-r--r-- | ui/terminal/status_test.go | 17 |
2 files changed, 16 insertions, 5 deletions
diff --git a/ui/terminal/status.go b/ui/terminal/status.go index 69a2a092..60dfc702 100644 --- a/ui/terminal/status.go +++ b/ui/terminal/status.go @@ -26,10 +26,10 @@ import ( // // statusFormat takes nearly all the same options as NINJA_STATUS. // %c is currently unsupported. -func NewStatusOutput(w io.Writer, statusFormat string, quietBuild bool) status.StatusOutput { +func NewStatusOutput(w io.Writer, statusFormat string, forceDumbOutput, quietBuild bool) status.StatusOutput { formatter := newFormatter(statusFormat, quietBuild) - if isSmartTerminal(w) { + if !forceDumbOutput && isSmartTerminal(w) { return NewSmartStatusOutput(w, formatter) } else { return NewDumbStatusOutput(w, formatter) diff --git a/ui/terminal/status_test.go b/ui/terminal/status_test.go index 81aa238b..9f608298 100644 --- a/ui/terminal/status_test.go +++ b/ui/terminal/status_test.go @@ -94,7 +94,7 @@ func TestStatusOutput(t *testing.T) { t.Run("smart", func(t *testing.T) { smart := &fakeSmartTerminal{termWidth: 40} - stat := NewStatusOutput(smart, "", false) + stat := NewStatusOutput(smart, "", false, false) tt.calls(stat) stat.Flush() @@ -105,7 +105,7 @@ func TestStatusOutput(t *testing.T) { t.Run("dumb", func(t *testing.T) { dumb := &bytes.Buffer{} - stat := NewStatusOutput(dumb, "", false) + stat := NewStatusOutput(dumb, "", false, false) tt.calls(stat) stat.Flush() @@ -113,6 +113,17 @@ func TestStatusOutput(t *testing.T) { t.Errorf("want:\n%q\ngot:\n%q", w, g) } }) + + t.Run("force dumb", func(t *testing.T) { + smart := &fakeSmartTerminal{termWidth: 40} + stat := NewStatusOutput(smart, "", true, false) + tt.calls(stat) + stat.Flush() + + if g, w := smart.String(), tt.dumb; g != w { + t.Errorf("want:\n%q\ngot:\n%q", w, g) + } + }) }) } } @@ -258,7 +269,7 @@ func TestSmartStatusOutputWidthChange(t *testing.T) { os.Setenv(tableHeightEnVar, "") smart := &fakeSmartTerminal{termWidth: 40} - stat := NewStatusOutput(smart, "", false) + stat := NewStatusOutput(smart, "", false, false) smartStat := stat.(*smartStatusOutput) smartStat.sigwinchHandled = make(chan bool) |