summaryrefslogtreecommitdiff
path: root/run.go
diff options
context:
space:
mode:
authorPeter Harris <pharris@opentext.com>2015-01-26 16:35:44 -0500
committerPeter Harris <pharris@opentext.com>2015-01-26 16:35:44 -0500
commita0fbba4fe34fd467a03288d8945978406f5f1f2f (patch)
tree5b3119dc3b7acc458712f0df97a95afddab6df03 /run.go
parent587b1a229bf351758ec93cc05406b1560251265c (diff)
Add xts-config replacement
This saves about half a second in run-time when running remotely (presumably due to all the extra round-trips of xset and xdpyinfo). The savings locally are less impressive (about 0.06s by saving a bunch of fork/exec pairs, and reducing the amount of output parsing going on).
Diffstat (limited to 'run.go')
-rw-r--r--run.go14
1 files changed, 11 insertions, 3 deletions
diff --git a/run.go b/run.go
index 9a103fe..ddb03ad 100644
--- a/run.go
+++ b/run.go
@@ -8,6 +8,8 @@
// - Creates config file in results directory (instead of $TMPDIR)
//
// - Adds ability to run a single (or multiple) sub-test(s) (similar to run_assert)
+//
+// - Avoids shelling out to xts-config (and therefore xset/xdpyinfo) (faster remote startup)
package main
import (
@@ -23,6 +25,7 @@ import (
var config = flag.String("config", "", "Location of xts configuration file")
var output = flag.String("output", "xts-results", "Output directory to use")
var version = flag.Bool("version", false, "Display version number and exit")
+var extconfig = flag.Bool("extconfig", false, "Use external xts-config")
func env(evar string, def string) string {
rv := os.Getenv(evar)
@@ -32,8 +35,7 @@ func env(evar string, def string) string {
return rv
}
-func createConfig(outdir string) error {
- *config = filepath.Join(outdir, "tetexec.cfg")
+func createConfigExt(outdir string) error {
perl := env("PERL", "perl")
tetRoot := env("TET_ROOT", "/usr/local/share")
config_in := filepath.Join(tetRoot, "xts5", "tetexec.cfg.in")
@@ -104,7 +106,13 @@ func main() {
// Create the config file if necessary
if *config == "" {
- err := createConfig(outdir)
+ *config = filepath.Join(outdir, "tetexec.cfg")
+ var err error
+ if *extconfig {
+ err = createConfigExt(outdir)
+ } else {
+ err = createConfig(outdir)
+ }
if err != nil {
fmt.Fprintln(os.Stdout, err)
os.Exit(1)