sensorlog: gosh: address TODOs
More specifically:
- Eliminates Shell.Main, since it's easy enough to use
Shell.Fn and set the returned Cmd's Args
- Renames Shell.Fn to Shell.FuncCmd
- Extends Shell.{Cmd,FuncCmd} comments to explain what's
done with the given arguments
- Makes it so NewShell takes a snapshot of os.Environ() and
uses that henceforth
- Makes it so NewShell filters out any gosh env vars coming
from outside
- Renames registry.go's Fn to Func, Register to
RegisterFunc, and Call to CallFunc
- Adjusts the behavior of RegisterFunc so that names are
augmented to produce collision-resistant handles of the
form "file:line:name"
- Makes callFunc and Func.call private for now, until
there's a clear need for them to be exported
- Eliminates gosh.Run
- Renames Cmd.Shutdown (which we decided to keep) to
Cmd.Terminate
- Changes Cmd.Signal and Cmd.Terminate to fail if Wait
has been called
- Drops Cmd.Kill; if it proves necessary, we'll add a
gosh.Kill implementation of os.Signal that tells
Cmd.Signal and Cmd.Terminate to issue Process.Kill
Also, updates v23test:
- Same changes as in gosh (Fn->FuncCmd, no more Main)
- Replaces v23test.Run with TestMain (simple case) and
InitTestMain (advanced case)
- Eliminates the hack with credentials env vars
MultiPart: 8/8
Change-Id: Icf571916d4b6f7ad0e79e52e0c42f0639ee8fec9
diff --git a/go/src/v.io/x/sensorlog/internal/client/device_v23_test.go b/go/src/v.io/x/sensorlog/internal/client/device_v23_test.go
index 4a65fc2..9fdafed 100644
--- a/go/src/v.io/x/sensorlog/internal/client/device_v23_test.go
+++ b/go/src/v.io/x/sensorlog/internal/client/device_v23_test.go
@@ -164,5 +164,5 @@
mounttabledPath := sh.BuildGoPkg("v.io/x/ref/services/mounttable/mounttabled")
inv := sh.Cmd(mounttabledPath, args...)
inv.Start()
- return inv.S.ExpectVar("NAME"), inv.Shutdown
+ return inv.S.ExpectVar("NAME"), inv.Terminate
}
diff --git a/go/src/v.io/x/sensorlog/internal/client/measured_v23_test.go b/go/src/v.io/x/sensorlog/internal/client/measured_v23_test.go
index ec940bb..aba1c73 100644
--- a/go/src/v.io/x/sensorlog/internal/client/measured_v23_test.go
+++ b/go/src/v.io/x/sensorlog/internal/client/measured_v23_test.go
@@ -85,7 +85,7 @@
time.Sleep(10 * time.Second)
// SIGINT will gracefully stop measured.
- measured.Shutdown(os.Interrupt)
+ measured.Terminate(os.Interrupt)
// Check that both streams have at least 3 measurements synced back to
// client device Syncbase.
diff --git a/go/src/v.io/x/sensorlog/internal/client/v23_main_test.go b/go/src/v.io/x/sensorlog/internal/client/v23_main_test.go
index b3f09da..53b8a6a 100644
--- a/go/src/v.io/x/sensorlog/internal/client/v23_main_test.go
+++ b/go/src/v.io/x/sensorlog/internal/client/v23_main_test.go
@@ -5,7 +5,6 @@
package client_test
import (
- "os"
"testing"
_ "v.io/x/ref/runtime/factories/generic"
@@ -13,5 +12,5 @@
)
func TestMain(m *testing.M) {
- os.Exit(v23test.Run(m.Run))
+ v23test.TestMain(m)
}