Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Godeps/Godeps.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ clean:
rm -f oci-runtime-tool runtimetest *.1 $(VALIDATION_TESTS)

localvalidation:
@for EXECUTABLE in runtimetest $(VALIDATION_TESTS); \
do \
if test ! -x "$${EXECUTABLE}"; \
then \
echo "missing test executable $${EXECUTABLE}; run 'make runtimetest validation-executables'" >&2; \
exit 1; \
fi; \
done
RUNTIME=$(RUNTIME) $(TAP) $(VALIDATION_TESTS)

.PHONY: validation-executables
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,18 @@ $ npm install tap

```console
$ make runtimetest validation-executables
$ sudo make RUNTIME=runc localvalidation

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to add the following?

for EXECUTABLE in runtimetest validation/linux_rootfs_propagation_shared.t validation/create.t validation/linux_gid_mappings.t validation/linux_rootfs_propagation_unbindable.t validation/linux_readonly_paths.t validation/linux_masked_paths.t validation/mounts.t validation/process.t validation/root_readonly_false.t validation/linux_sysctl.t validation/default.t validation/linux_devices.t validation/process_capabilities.t validation/process_oom_score_adj.t validation/process_rlimits.t validation/root_readonly_true.t validation/hostname.t validation/linux_uid_mappings.t; \ do \ test -x "${EXECUTABLE}"; \ done || (echo "missing test executable; run 'make runtimetest validation-executables'" >&2 && exit 1)

The other looks good to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to add the following?

for EXECUTABLE
…

I've pushed 07a380923f547a to remove that noise from the localvalidation output.

RUNTIME=runc tap validation/linux_rootfs_propagation_shared.t validation/create.t validation/default.t validation/linux_readonly_paths.t validation/linux_masked_paths.t validation/mounts.t validation/process.t validation/root_readonly_false.t validation/linux_sysctl.t validation/linux_devices.t validation/linux_gid_mappings.t validation/process_oom_score_adj.t validation/process_capabilities.t validation/process_rlimits.t validation/root_readonly_true.t validation/linux_rootfs_propagation_unbindable.t validation/hostname.t validation/linux_uid_mappings.t
validation/linux_rootfs_propagation_shared.t ........ 18/19
not ok rootfs propagation
error: 'rootfs should be shared, but not'

validation/create.t ................................... 4/4
validation/default.t ................................ 19/19
validation/linux_readonly_paths.t ................... 19/19
validation/linux_masked_paths.t ..................... 18/19
not ok masked paths
error: /masktest should not be readable

validation/mounts.t ................................... 0/1
Skipped: 1
Expand Down
4 changes: 2 additions & 2 deletions cmd/runtimetest/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -945,15 +945,15 @@ func run(context *cli.Context) error {
} else {
t.Fail(v.description)
}
t.Diagnostic(err.Error())
t.YAML(map[string]string{"error": err.Error()})
}
} else {
if e, ok := err.(*rfc2119.Error); ok {
t.Ok(e.Level < complianceLevel, v.description)
} else {
t.Fail(v.description)
}
t.Diagnostic(err.Error())
t.YAML(map[string]string{"error": err.Error()})
}
}
}
Expand Down
16 changes: 11 additions & 5 deletions validation/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,24 @@ func main() {
r.SetID(c.id)
stderr, err := r.Create()
t.Ok((err == nil) == c.errExpected, c.err.(*specerror.Error).Err.Err.Error())
t.Diagnostic(c.err.(*specerror.Error).Err.Reference)
diagnostic := map[string]string{
"reference": c.err.(*specerror.Error).Err.Reference,
}
if err != nil {
t.Diagnostic(err.Error())
diagnostic["error"] = err.Error()
}
if len(stderr) > 0 {
t.Diagnostic(string(stderr))
diagnostic["stderr"] = string(stderr)
}
t.YAML(diagnostic)

if err == nil {
state, _ := r.State()
t.Ok(state.ID == c.id, "")
t.Diagnosticf("container PID: %d, state ID: %d", c.id, state.ID)
t.Ok(state.ID == c.id, "'state' MUST return the state of a container")
t.YAML(map[string]string{
"container ID": c.id,
"state ID": state.ID,
})
}
}

Expand Down
2 changes: 1 addition & 1 deletion validation/process_capabilities.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

func main() {
if "linux" != runtime.GOOS {
util.Skip("linux-specific process.capabilities test", runtime.GOOS)
util.Skip("linux-specific process.capabilities test", map[string]string{"OS": runtime.GOOS})
os.Exit(0)
}

Expand Down
2 changes: 1 addition & 1 deletion validation/root_readonly_true.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

func main() {
if "windows" == runtime.GOOS {
util.Skip("non-Windows root.readonly test", runtime.GOOS)
util.Skip("non-Windows root.readonly test", map[string]string{"OS": runtime.GOOS})
os.Exit(0)
}

Expand Down
6 changes: 4 additions & 2 deletions validation/util/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (

rspecs "github.com/opencontainers/runtime-spec/specs-go"
"github.com/opencontainers/runtime-tools/generate"
"github.com/satori/go.uuid"
)

// Runtime represents the basic requirement of a container runtime
Expand Down Expand Up @@ -63,12 +64,13 @@ func (r *Runtime) Create() (stderr []byte, err error) {
// }
cmd := exec.Command(r.RuntimeCommand, args...)
cmd.Dir = r.BundleDir
r.stdout, err = os.OpenFile(filepath.Join(r.BundleDir, fmt.Sprintf("stdout-%s", r.ID)), os.O_CREATE|os.O_EXCL|os.O_RDWR, 0600)
id := uuid.NewV4().String()
r.stdout, err = os.OpenFile(filepath.Join(r.BundleDir, fmt.Sprintf("stdout-%s", id)), os.O_CREATE|os.O_EXCL|os.O_RDWR, 0600)
if err != nil {
return []byte(""), err
}
cmd.Stdout = r.stdout
r.stderr, err = os.OpenFile(filepath.Join(r.BundleDir, fmt.Sprintf("stderr-%s", r.ID)), os.O_CREATE|os.O_EXCL|os.O_RDWR, 0600)
r.stderr, err = os.OpenFile(filepath.Join(r.BundleDir, fmt.Sprintf("stderr-%s", id)), os.O_CREATE|os.O_EXCL|os.O_RDWR, 0600)
if err != nil {
return []byte(""), err
}
Expand Down
6 changes: 3 additions & 3 deletions validation/util/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ func Fatal(err error) {
}

// Skip skips a full TAP suite.
func Skip(message string, diagnostic string) {
func Skip(message string, diagnostic interface{}) {
t := tap.New()
t.Header(1)
t.Skip(1, message)
if diagnostic != "" {
t.Diagnostic(diagnostic)
if diagnostic != nil {
t.YAML(diagnostic)
}
}

Expand Down
8 changes: 4 additions & 4 deletions vendor/github.com/mndrix/tap-go/Makefile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions vendor/github.com/mndrix/tap-go/tap.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions vendor/github.com/mndrix/tap-go/yaml_json.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions vendor/github.com/mndrix/tap-go/yaml_yaml.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.