|
1 | 1 | Fuzzer usage
|
2 | 2 | ============
|
3 | 3 |
|
| 4 | + |
4 | 5 | The fuzzer works in a standalone manner, by calling it to fuzz a full message structure via CLI,
|
5 | 6 | or by designing custom tests that fuzz or exclude different fields of the messages.
|
6 | 7 |
|
| 8 | +.. toctree:: |
| 9 | + :maxdepth: 4 |
| 10 | + :caption: Contents: |
| 11 | + |
| 12 | + |
7 | 13 |
|
8 | 14 | CLI Usage
|
9 | 15 | ---------
|
@@ -59,3 +65,33 @@ The :func:`hypothesis.given` decorator runs the decorated function with all the
|
59 | 65 | self.pub.publish(log)
|
60 | 66 |
|
61 | 67 |
|
| 68 | +The following examples show a trajectory message fuzzer utilized for fuzzing the ABB control |
| 69 | +node of the `Link ROS Industrial <https://github.com/ros-industrial>`project. |
| 70 | +Notice the settings block, which serves as a way to set the fuzz cases to launch and the output of the fuzzer. |
| 71 | +The :class:`ros_commons.ProcessHandler` class serves to detect changes in the target node, |
| 72 | +detecting when this node has crashed. |
| 73 | + |
| 74 | +.. code-block:: python |
| 75 | + :caption: Joint Trajectory message fuzzing used on REDROS-I ROSIN project for ABB node fuzzing. |
| 76 | +
|
| 77 | + @settings(max_examples=5000, verbosity=Verbosity.verbose) |
| 78 | + @given(array(elements=float64(), min_size=6, max_size=6)) |
| 79 | + def fuzz_message_jointstate_effort(process_handler, fuzzed_fields): |
| 80 | + joint_state_message.effort = fuzzed_fields |
| 81 | + pub.publish(joint_state_message) |
| 82 | + assert process_handler.check_if_alive() is True |
| 83 | +
|
| 84 | + @settings(max_examples=5000, verbosity=Verbosity.verbose) |
| 85 | + @given(array(elements=float64(), min_size=6, max_size=6), |
| 86 | + array(elements=float64(), min_size=6, max_size=6), |
| 87 | + array(elements=float64(), min_size=6, max_size=6)) |
| 88 | + def fuzz_message_jointstate_all(process_handler, positions, velocities, efforts): |
| 89 | + joint_state_message.position = positions |
| 90 | + joint_state_message.velocity = velocities |
| 91 | + joint_state_message.effort = efforts |
| 92 | + pub.publish(joint_state_message) |
| 93 | + assert process_handler.check_if_alive() is True |
| 94 | +
|
| 95 | +
|
| 96 | +
|
| 97 | +
|
0 commit comments