veyron/lib/modules,veyron/services/mgmt/node/impl: expanding some of the logging
I found this useful to understand the sequence of command shutdowns while
debugging flaky tests.
Change-Id: I6e6fc23df1c63d6ec7b7275bc47e20510a8a7166
diff --git a/lib/modules/exec.go b/lib/modules/exec.go
index 8e2b6e6..74acf2f 100644
--- a/lib/modules/exec.go
+++ b/lib/modules/exec.go
@@ -166,6 +166,7 @@
eh.mu.Lock()
defer eh.mu.Unlock()
vlog.VI(1).Infof("Shutdown: %q", eh.name)
+ defer vlog.VI(1).Infof("Shutdown: %q [DONE]", eh.name)
eh.stdin.Close()
defer eh.sh.Forget(eh)
diff --git a/services/mgmt/node/impl/util_test.go b/services/mgmt/node/impl/util_test.go
index a720983..0d5acf2 100644
--- a/services/mgmt/node/impl/util_test.go
+++ b/services/mgmt/node/impl/util_test.go
@@ -87,6 +87,7 @@
sh.ClearVar(consts.VeyronCredentials)
mtName, mtHandle := startRootMT(t, sh)
+ vlog.VI(1).Infof("Started shell mounttable with name %v", mtName)
// Make sure the root mount table is the last process to be shutdown
// since the others will likely want to communicate with it during
// their shutdown process
@@ -98,11 +99,22 @@
fn := func() {
vlog.VI(1).Info("------------ CLEANUP ------------")
vlog.VI(1).Info("---------------------------------")
- sh.Cleanup(nil, os.Stderr)
- mtHandle.Shutdown(nil, os.Stderr)
+ vlog.VI(1).Info("--(cleaning up shell)------------")
+ if err := sh.Cleanup(os.Stdout, os.Stderr); err != nil {
+ t.Fatalf("sh.Cleanup failed with %v", err)
+ }
+ vlog.VI(1).Info("--(done cleaning up shell)-------")
+ vlog.VI(1).Info("--(shutting down root mt)--------")
+ if err := mtHandle.Shutdown(os.Stdout, os.Stderr); err != nil {
+ t.Fatalf("mtHandle.Shutdown failed with %v", err)
+ }
+ vlog.VI(1).Info("--(done shutting down root mt)---")
+ vlog.VI(1).Info("--------- DONE CLEANUP ----------")
+ // Calling sh.Start after sh.Cleanup is not a good idea.
+ // TODO(caprita): set the roots by hand and avoid running the
+ // corresponding modules command.
setNSRoots(t, sh, oldNamespaceRoots...)
}
-
setNSRoots(t, sh, mtName)
sh.SetVar(consts.NamespaceRootPrefix, mtName)
return sh, fn
@@ -160,7 +172,7 @@
vlog.Fatalf("NewServer() failed: %v", err)
}
spec := static.ListenSpec
- spec.Address = "127.0.0.1:0"
+ spec.Address = "127.0.0.1:0" // Isn't this the default?
endpoint, err := server.Listen(spec)
if err != nil {
vlog.Fatalf("Listen(%s) failed: %v", static.ListenSpec, err)