@@ -81,32 +81,11 @@ func loadSpecConfig(path string) (spec *rspec.Spec, err error) {
8181 return spec , nil
8282}
8383
84- // should be included by other platform specified process validation
85- func validateProcess (spec * rspec.Spec ) error {
86- if spec .Process .Cwd != "" {
87- cwd , err := os .Getwd ()
88- if err != nil {
89- return err
90- }
91- if cwd != spec .Process .Cwd {
92- return fmt .Errorf ("Cwd expected: %v, actual: %v" , spec .Process .Cwd , cwd )
93- }
94- }
95-
96- for _ , env := range spec .Process .Env {
97- parts := strings .Split (env , "=" )
98- key := parts [0 ]
99- expectedValue := parts [1 ]
100- actualValue := os .Getenv (key )
101- if actualValue != expectedValue {
102- return fmt .Errorf ("Env %v expected: %v, actual: %v" , key , expectedValue , actualValue )
103- }
84+ func validateUser (spec * rspec.Spec ) error {
85+ if runtime .GOOS == "windows" {
86+ return nil
10487 }
10588
106- return nil
107- }
108-
109- func validateLinuxProcess (spec * rspec.Spec ) error {
11089 if spec .Process == nil {
11190 return nil
11291 }
@@ -136,6 +115,39 @@ func validateLinuxProcess(spec *rspec.Spec) error {
136115 }
137116 }
138117
118+ return nil
119+ }
120+
121+ // should be included by other platform specified process validation
122+ func validateProcess (spec * rspec.Spec ) error {
123+ if spec .Process .Cwd != "" {
124+ cwd , err := os .Getwd ()
125+ if err != nil {
126+ return err
127+ }
128+ if cwd != spec .Process .Cwd {
129+ return fmt .Errorf ("Cwd expected: %v, actual: %v" , spec .Process .Cwd , cwd )
130+ }
131+ }
132+
133+ for _ , env := range spec .Process .Env {
134+ parts := strings .Split (env , "=" )
135+ key := parts [0 ]
136+ expectedValue := parts [1 ]
137+ actualValue := os .Getenv (key )
138+ if actualValue != expectedValue {
139+ return fmt .Errorf ("Env %v expected: %v, actual: %v" , key , expectedValue , actualValue )
140+ }
141+ }
142+
143+ return nil
144+ }
145+
146+ func validateLinuxProcess (spec * rspec.Spec ) error {
147+ if spec .Process == nil {
148+ return nil
149+ }
150+
139151 cmdlineBytes , err := ioutil .ReadFile ("/proc/self/cmdline" )
140152 if err != nil {
141153 return err
@@ -739,6 +751,10 @@ func run(context *cli.Context) error {
739751 test : validateProcess ,
740752 description : "process" ,
741753 },
754+ {
755+ test : validateUser ,
756+ description : "user" ,
757+ },
742758 }
743759
744760 linuxValidations := []validation {
0 commit comments