Skip to content
This repository was archived by the owner on Apr 30, 2021. It is now read-only.

Commit a7756eb

Browse files
author
Yevgeny Pats
committed
Add a generic environment flag for creating jobs
1 parent 4e805bb commit a7756eb

File tree

5 files changed

+21
-21
lines changed

5 files changed

+21
-21
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ go get -v -u github.com/fuzzitdev/fuzzit/...
3232

3333
```bash
3434
brew install fuzzitdev/tap/fuzzit
35+
# After initial install you can upgrade the version via:
36+
brew upgrade fuzzit
3537
```
3638

3739
## Compilation

client/client.go

+9-10
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,15 @@ type Target struct {
1818
}
1919

2020
type Job struct {
21-
TargetId string `firestore:"target_id"`
22-
Args string `firestore:"args"`
23-
Local bool
24-
Type string `firestore:"type"`
25-
Host string `firestore:"host"`
26-
Revision string `firestore:"revision"`
27-
Branch string `firestore:"branch"`
28-
Parallelism uint16 `firestore:"parallelism"`
29-
AsanOptions string `firestore:"asan_options"`
30-
UbsanOptions string `firestore:"ubsan_options"`
21+
TargetId string `firestore:"target_id"`
22+
Args string `firestore:"args"`
23+
Local bool
24+
Type string `firestore:"type"`
25+
Host string `firestore:"host"`
26+
Revision string `firestore:"revision"`
27+
Branch string `firestore:"branch"`
28+
Parallelism uint16 `firestore:"parallelism"`
29+
EnvironmentVariables []string `firestore:"environment_variables"`
3130
}
3231

3332
// Internal struct

client/commands.go

+7-8
Original file line numberDiff line numberDiff line change
@@ -249,16 +249,15 @@ func (c *FuzzitClient) CreateLocalJob(jobConfig Job, files []string) error {
249249
if err != nil {
250250
return err
251251
}
252-
253252
log.Println("Creating container")
254253
createdContainer, err := cli.ContainerCreate(ctx, &container.Config{
255-
Env: []string{
256-
"CORPUS_LINK=" + corpusLink,
257-
"SEED_LINK=" + seedLink,
258-
"ASAN_OPTIONS=" + jobConfig.AsanOptions,
259-
"UBSAN_OPTIONS=" + jobConfig.UbsanOptions,
260-
"ARGS=" + jobConfig.Args,
261-
"LD_LIBRARY_PATH=/app"},
254+
Env: append(
255+
[]string{
256+
"CORPUS_LINK=" + corpusLink,
257+
"SEED_LINK=" + seedLink,
258+
"ARGS=" + jobConfig.Args,
259+
"LD_LIBRARY_PATH=/app"},
260+
jobConfig.EnvironmentVariables...),
262261
Image: "docker.io/fuzzitdev/fuzzit:stretch-llvm8",
263262
Cmd: []string{"/bin/sh", "/app/run.sh"},
264263
AttachStdin: true,

cmd/job.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func init() {
7070
jobCmd.Flags().Uint16Var(&newJob.Parallelism, "cpus", 1, "number of cpus to use (only relevant for fuzzing job)")
7171
jobCmd.Flags().StringVar(&newJob.Revision, "revision", "", "Revision tag of fuzzer")
7272
jobCmd.Flags().StringVar(&newJob.Branch, "branch", "", "Branch of the fuzzer")
73-
jobCmd.Flags().StringVar(&newJob.AsanOptions, "asan_options", "", "Additional args to ASAN_OPTIONS env VARIABLE")
74-
jobCmd.Flags().StringVar(&newJob.UbsanOptions, "ubsan_options", "", "Additional args to UBSAN_OPTIONS env VARIABLE")
73+
jobCmd.Flags().StringArrayVarP(&newJob.EnvironmentVariables, "environment", "e", nil,
74+
"Additional environment variables for the fuzzer. For example ASAN_OPTINOS, UBSAN_OPTIONS or any other")
7575
jobCmd.Flags().StringVar(&newJob.Args, "args", "", "Additional runtime args for the fuzzer")
7676
}

cmd/root.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ var gFuzzitClient *client.FuzzitClient
3030
var rootCmd = &cobra.Command{
3131
Use: "fuzzit",
3232
Short: "Continuous fuzzing made simple CLI",
33-
Version: "2.4.17",
33+
Version: "2.4.18",
3434
}
3535

3636
func Execute() {

0 commit comments

Comments
 (0)