Skip to content

Commit 695e69b

Browse files
committed
script for harness agent
1 parent b1e3c94 commit 695e69b

File tree

2 files changed

+76
-0
lines changed

2 files changed

+76
-0
lines changed

README.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,51 @@ To run SeedGen2 for the `libxml2` project with the `xml` harness:
5151
```shell
5252
python3 oss-fuzz.py libxml2 xml
5353
```
54+
55+
To run seedmind for libxml2 project for all harnesses:
56+
57+
```shell
58+
# set up the LiteLLM variables
59+
export LITELLM_BASE_URL=https://your.litellm.host
60+
export LITELLM_KEY=sk-your_private_key
61+
export SEEDGEN_KNOWLEDGEABLE_MODEL=openai/gpt-5-mini
62+
export SEEDGEN_GENERATIVE_MODEL=openai/gpt-5-mini
63+
export SEEDGEN_INFER_MODEL=openai/gpt-5.1
64+
export GEN_MODEL_LIST=openai/gpt-5-mini,openai/gpt-5.1
65+
export OSSFUZZ_PATH=/workspaces/oss-fuzz-harnessagent
66+
67+
# src_path is the external source code path of target project
68+
69+
python infra/oss-fuzz.py --root /workspaces/oss-fuzz-harnessagent --model gpt-5-mini --src_path "$src_path" libxml2 --all
70+
```
71+
72+
### Run with Docker:
73+
74+
set up the environment variables
75+
76+
```shell
77+
cat <<'EOF' > .env
78+
LITELLM_BASE_URL=https://your.litellm.host
79+
LITELLM_KEY=sk-your_private_key
80+
SEEDGEN_KNOWLEDGEABLE_MODEL=openai/gpt-5-mini
81+
SEEDGEN_GENERATIVE_MODEL=openai/gpt-5-mini
82+
SEEDGEN_INFER_MODEL=openai/gpt-5.1
83+
GEN_MODEL_LIST=openai/gpt-5-mini,openai/gpt-5.1
84+
OSSFUZZ_PATH=/workspaces/oss-fuzz-harnessagent
85+
PROJECT=libxml2
86+
HARNESSNAME=html
87+
EOF
88+
```
89+
90+
91+
```
92+
docker run -it \
93+
--env-file .env \
94+
--privileged \
95+
--entrypoint=/entrypoint_harnessagent.sh \
96+
--rm \
97+
-v $PWD/entrypoint_harnessagent.sh:/entrypoint_harnessagent.sh \
98+
-v /path/to/save/corpus:/workspaces/corpus \
99+
-v /path/to/ossfuzz:/workspaces/oss-fuzz-harnessagent \
100+
ghcr.io/emptyiscolor/sunflower-seedmind:latest
101+
```

entrypoint_harnessagent.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
3+
# Start docker
4+
start-docker.sh
5+
6+
# prepare output directory
7+
seeds_agg_dir="/workspaces/corpus"
8+
mkdir -p "$seeds_agg_dir"
9+
10+
# Commands go here
11+
python infra/oss-fuzz.py --root $OSSFUZZ_PATH --model $SEEDGEN_GENERATIVE_MODEL $PROJECT $HARNESSNAME
12+
13+
echo "Seeds generated successfully"
14+
15+
# find "/app/.tmp/$PROJECT" -type d -name "seeds"
16+
# Find all seeds folders within the project directory
17+
while IFS= read -r seeds_folder; do
18+
# Check if the seeds folder contains any regular files
19+
if find "$seeds_folder" -maxdepth 1 -type f | grep -q .; then
20+
# Create destination directory
21+
mkdir -p "$seeds_agg_dir/$project_name"
22+
23+
# Copy all regular files from seeds folder to aggregated location
24+
find "$seeds_folder" -maxdepth 1 -type f -exec cp {} "$seeds_agg_dir/$project_name/" \;
25+
26+
echo "Collected seeds from $seeds_folder to $seeds_agg_dir/$project_name/"
27+
fi
28+
done < <(find "/app/.tmp/$PROJECT" -type d -name "seeds")

0 commit comments

Comments
 (0)