Fix import of config
BUG=chromium:1051691
TEST=emerge and run_tests.sh
Change-Id: I053f6f9fa825519810f888d6b2d0cff23f15f15b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/infra/tnull/+/2290412
Commit-Queue: Jacob Kopczynski <jkop@chromium.org>
Tested-by: Jacob Kopczynski <jkop@chromium.org>
Auto-Submit: Jacob Kopczynski <jkop@chromium.org>
Reviewed-by: Prathmesh Prabhu <pprabhu@chromium.org>
diff --git a/.gitignore b/.gitignore
index a878606..ea110e0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,4 +2,3 @@
.cipd_bin/*
*.pb.go
descpb.bin
-*.binaryproto
diff --git a/metadata/dummy-pass.json b/metadata/dummy-pass.json
new file mode 100644
index 0000000..d533091
--- /dev/null
+++ b/metadata/dummy-pass.json
@@ -0,0 +1 @@
+{"name":"dummy_request","test":"remoteTestDrivers/tnull/tests/dummy-pass"}
\ No newline at end of file
diff --git a/run_tests.sh b/run_tests.sh
index 23629db..731ce0a 100755
--- a/run_tests.sh
+++ b/run_tests.sh
@@ -3,4 +3,4 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-tnull run-steps -input_json src/tnull/dummy-pass.json
+tnull run-steps -input_json metadata/dummy-pass.json
diff --git a/src/tnull/main.go b/src/tnull/main.go
index 10d2bc5..b9bd44a 100644
--- a/src/tnull/main.go
+++ b/src/tnull/main.go
@@ -8,6 +8,7 @@
"context"
"fmt"
"os"
+ "path/filepath"
"tnull/driver"
"github.com/golang/protobuf/jsonpb"
@@ -25,7 +26,7 @@
)
const tnullName = "remoteTestDrivers/tnull"
-const specPath = "../../metadata/generated/config.cfg"
+const specRelPath = "trunk/infra/tnull/metadata/generated/config.cfg"
type run struct {
subcommands.CommandRunBase
@@ -63,7 +64,7 @@
return errors.Annotate(err, "reading in the Invocation").Err()
}
- lookup, err := extractTestsFromSpecification(specPath)
+ lookup, err := extractTestsFromSpecification()
if err != nil {
return err
}
@@ -83,9 +84,13 @@
return nil
}
-func extractTestsFromSpecification(specPath string) (*tnProto.TestMap, error) {
+func extractTestsFromSpecification() (*tnProto.TestMap, error) {
+ p, err := specPath()
+ if err != nil {
+ return nil, errors.Annotate(err, "extracting tests from spec").Err()
+ }
var s metadata.Specification
- if err := readJSONPb(specPath, &s); err != nil {
+ if err := readJSONPb(p, &s); err != nil {
return nil, errors.Annotate(err, "extracting tests from spec").Err()
}
testMap := &tnProto.TestMap{Lookup: map[string]*tnProto.Steps{}}
@@ -174,6 +179,14 @@
return nil
}
+func specPath() (string, error) {
+ if home, err := os.UserHomeDir(); err != nil {
+ return "", err
+ } else {
+ return filepath.Join(home, specRelPath), nil
+ }
+}
+
func main() {
application := &cli.Application{
Name: "TNull",