MCPcopy
hub / github.com/containerd/containerd / updatePathEnv

Function updatePathEnv

integration/client/container_fuzz_test.go:214–240  ·  view source on GitHub ↗

updatePathEnv() creates an empty directory in which the fuzzer will create the containerd socket. updatePathEnv() furthermore adds "/out/containerd-binaries" to $PATH, since the binaries are available there.

()

Source from the content-addressed store, hash-verified

212// updatePathEnv() furthermore adds "/out/containerd-binaries"
213// to $PATH, since the binaries are available there.
214func updatePathEnv() error {
215 // Create test dir for socket
216 err := os.MkdirAll(defaultState, 0777)
217 if err != nil {
218 return err
219 }
220
221 oldPathEnv := os.Getenv("PATH")
222 newPathEnv := oldPathEnv + ":" + fuzzBinDir
223
224 if ghWorkspace := os.Getenv("GITHUB_WORKSPACE"); ghWorkspace != "" {
225 // In `oss_fuzz_build.sh`, we build and install containerd binaries to
226 // `$OUT/containerd-binaries`, where `OUT=/out` in oss-fuzz environment.
227 // However in GitHub Actions, oss-fuzz maps `OUT` to `$GITHUB_WORKSPACE/build-out`.
228 // So here we add this to `$PATH` at the end of `PATH` so the fuzz works on
229 // both environments.
230 newPathEnv = newPathEnv + ":" + filepath.Join(ghWorkspace, "build-out", "containerd-binaries")
231 }
232
233 err = os.Setenv("PATH", newPathEnv)
234 if err != nil {
235 return err
236 }
237
238 haveChangedOSSFuzzPATH = true
239 return nil
240}
241
242// checkAndDoUnpack checks if an image is unpacked.
243// If it is not unpacked, then we may or may not

Calls 1

MkdirAllMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…