runtimetest: add host platform validation#507
runtimetest: add host platform validation#507Mashimiao merged 1 commit intoopencontainers:masterfrom
Conversation
cmd/runtimetest/main.go
Outdated
|
|
||
| func validatePlatform(spec *rspec.Spec) error { | ||
| if runtime.GOOS != "linux" && runtime.GOOS != "solaris" && runtime.GOOS != "windows" { | ||
| return fmt.Errorf("host platform %q is not supported", runtime.GOOS) |
There was a problem hiding this comment.
This is presumably based on this spec section, but there's no RFC 2119 language there, and the platform target is closer to selecting the relevant spec than it is to being a requirement of the spec. I'm fine with having something like this being a fatal error (i.e. “runtime-tools has not implemented testing for your platform because the spec has nothing to say about it”). But I don't see a point to making it soft error after which we continue on to run our other tests. If we're comfortable running the other tests, we should just run them, and let each test take care of skipping all the things that are specific to one of the above platforms (which is most things).
c557bac to
7f1a267
Compare
cmd/runtimetest/main.go
Outdated
| } | ||
|
|
||
| platform := runtime.GOOS | ||
| if err := validatePlatform(platform); err != nil { |
There was a problem hiding this comment.
This can be moved before loadSpecConfig. Non need to hit the disk at all for unsupported platforms.
7f1a267 to
1f59e78
Compare
cmd/runtimetest/main.go
Outdated
|
|
||
| func validatePlatform(platform string) error { | ||
| if platform != "linux" && platform != "solaris" && platform != "windows" { | ||
| return fmt.Errorf("runtime-tools has not implemented testing for your platform %q, because the spec has nothing to say about it", platform) |
There was a problem hiding this comment.
This is hard to say whether right or not.
Though spec don't have specific configs for those platform, But spec has common configs for all platform.
And spec seems never say it just supports those three platforms.
|
I think this judgement is useful, testing on an unknown platform can not prove anything, either right or wrong. We can just abort the testing. I think we should not name it 'validatePlatform', it is misleading. It sounds like there is a RFC requirement in the spec and we are validating it. But in fact, we are just making sure I suggest we can just do it in the |
Signed-off-by: Zhou Hao <zhouhao@cn.fujitsu.com>
1f59e78 to
39f3f74
Compare
|
updated, thanks. |
Signed-off-by: Zhou Hao zhouhao@cn.fujitsu.com