Skip to content
This repository was archived by the owner on Nov 1, 2023. It is now read-only.

Commit e32568d

Browse files
committed
Document how to use the validation tools
1 parent a720dd1 commit e32568d

File tree

3 files changed

+60
-8
lines changed

3 files changed

+60
-8
lines changed

docs/troubleshooting.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Troubleshooting issues with binaries
2+
3+
The agent exposes some validation tools to help troubleshoot issues with a binary.
4+
This allows the user to debug and fix errors that could prevent a job from running.
5+
6+
## Using the validation tools
7+
Download a zip file containing the agent binaries:
8+
9+
```
10+
onefuzz tools get <destination_folder>
11+
```
12+
13+
Extract the zip file in a folder of your choice.
14+
Navigate to the folder that matches your os
15+
Run the following command to see the tools available
16+
`onefuzz-agent.exe validate --help`
17+
The current list of commands are
18+
- run_setup : Run the setup script
19+
- validate_libfuzzer: Validate the libfuzzer target
20+
- execution_log: Get the execution logs to debug loading issues
21+
22+
More tools might be added in the future so please refer the help command to get the most up to date list.
23+
24+
25+
26+
## In a docker container
27+
28+
It could also be helpful to run the those command in an environment to closely match the vm where the agent is deployed.
29+
A docker container can help with that scenario.
30+
31+
Make sure [docker](https://docs.docker.com/desktop/) is installed and run properly
32+
33+
Navigate to the folder that matches your os in the tools folder created earlier and build the docker container
34+
35+
```cmd
36+
docker build --t <container_name> .
37+
```
38+
39+
Use the container interactively to execute the validation command
40+
41+
windows
42+
43+
```
44+
docker run --it --rm --entrypoint powershell <image_name>
45+
```
46+
47+
linux
48+
49+
```
50+
docker run --it --rm --entrypoint bash <image_name>
51+
```
52+
53+
From there you can navigate to the onefuzz directory and execute the validation commands
54+

docs/unmanaged-nodes.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ Under the `client_credential` section of the agent config file, update `client_i
7575

7676
Save the config to the file.
7777

78-
### Start the agent.
78+
### Start the agent
7979

8080
Navigate to the folder corresponding to your OS.
8181
Set the necessary environment variable by running the script `set-env.ps1` (for Windows) or `set-env.sh` (for Linux).
@@ -111,7 +111,7 @@ From here you will be able to schedule jobs on that pool and they will run.
111111

112112
## Troubleshooting
113113

114-
### increase the verbosity of the logs
114+
### Increase the verbosity of the logs
115115

116116
It can help when investigating issues to increase the log verbosity. you will need to set the [RUST_LOG](https://docs.rs/env_logger/latest/env_logger/#enabling-logging) environment variable when starting docker
117117

@@ -127,7 +127,7 @@ log_level can be any of
127127
- debug
128128
- trace
129129

130-
### use the container interactively
130+
### Use the container interactively
131131

132132
you can use the container interactively by with the following command
133133

@@ -143,7 +143,7 @@ linux
143143
docker run --it --rm --entrypoint bash <image_name>
144144
```
145145

146-
### mount a local folder in the container
146+
### Mount a local folder in the container
147147

148148
docker allows you to [mount](https://docs.docker.com/storage/bind-mounts/#mount-into-a-non-empty-directory-on-the-container) a local folder when running a container
149149

src/agent/onefuzz-agent/src/validations.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ use uuid::Uuid;
1111
pub enum ValidationCommand {
1212
/// Run the setup script
1313
RunSetup { setup_folder: PathBuf },
14-
/// Validate the libfuzzer target
14+
/// Validate the libfuzzer target by attempting to run the target by itself and with some of the supplied seeds if provided
1515
ValidateLibfuzzer(ValidationConfig),
16-
/// Get the execution logs to debug loading issues
16+
/// Get the execution logs to debug dll loading issues
1717
ExecutionLog(ValidationConfig),
1818
}
1919

@@ -30,8 +30,6 @@ where
3030
.find('=')
3131
.ok_or_else(|| format!("invalid KEY=value: no `=` found in `{s}`"))?;
3232

33-
println!("******** pos: {}", pos);
34-
3533
Ok((s[..pos].parse()?, s[pos + 1..].parse()?))
3634
}
3735

0 commit comments

Comments
 (0)