- Fuzz for restconf and cli updated
This commit is contained in:
parent
965cce5e5d
commit
af88b974fd
11 changed files with 172 additions and 62 deletions
|
|
@ -6,28 +6,15 @@ Note: cli plugins do not work.
|
|||
|
||||
## Prereqs
|
||||
|
||||
See [AFL docs](https://afl-1.readthedocs.io/en/latest) for installing afl.
|
||||
On ubuntu this may be enough:
|
||||
```
|
||||
sudo apt install afl
|
||||
```
|
||||
Install AFL, see [..](..)
|
||||
|
||||
You may have to change cpu frequency:
|
||||
```
|
||||
cd /sys/devices/system/cpu
|
||||
echo performance | tee cpu?/cpufreq/scaling_governor
|
||||
```
|
||||
|
||||
And possibly change core behaviour:
|
||||
```
|
||||
echo core >/proc/sys/kernel/core_pattern
|
||||
```
|
||||
Build and install a clixon system (in particular the backend, the CLI will be replaced)
|
||||
|
||||
## Build
|
||||
|
||||
Build clixon statically with the afl-clang compiler:
|
||||
Build clixon cli statically with the afl-clang compiler:
|
||||
```
|
||||
CC=/usr/bin/afl-clang-fast LINKAGE=static ./configure
|
||||
CC=/usr/bin/afl-clang-fast LINKAGE=static ./configure # Dont care about restconf
|
||||
make clean
|
||||
cd apps/cli
|
||||
make clixon_cli
|
||||
|
|
@ -36,9 +23,9 @@ Build clixon statically with the afl-clang compiler:
|
|||
|
||||
## Run tests
|
||||
|
||||
Start the backend and Use the script `runfuzz.sh` to run one test with a cli spec and an input string, eg:
|
||||
Run the script `runfuzz.sh` to run one test with a cli spec and an input string, eg:
|
||||
```
|
||||
./runfuzz.sh /usr/local/etc/hello.xml "set table parameter a value 23"
|
||||
./runfuzz.sh
|
||||
```
|
||||
|
||||
After (or during) the test, investigate results in the output dir.
|
||||
|
|
|
|||
|
|
@ -15,18 +15,23 @@ cat <<EOF > $cfg
|
|||
<CLICON_CONFIGFILE>$cfg</CLICON_CONFIGFILE>
|
||||
<CLICON_FEATURE>*:*</CLICON_FEATURE>
|
||||
<CLICON_YANG_DIR>/usr/local/share/clixon</CLICON_YANG_DIR>
|
||||
<CLICON_YANG_MODULE_MAIN>clixon-hello</CLICON_YANG_MODULE_MAIN>
|
||||
<CLICON_CLI_MODE>hello</CLICON_CLI_MODE>
|
||||
<CLICON_SOCK>/usr/local/var/hello.sock</CLICON_SOCK>
|
||||
<CLICON_CLISPEC_DIR>/usr/local/lib/hello/clispec</CLICON_CLISPEC_DIR>
|
||||
<CLICON_YANG_MODULE_MAIN>clixon-example</CLICON_YANG_MODULE_MAIN>
|
||||
<CLICON_SOCK>/usr/local/var/example/example.sock</CLICON_SOCK>
|
||||
<CLICON_BACKEND_PIDFILE>/usr/local/var/$APPNAME/$APPNAME.pidfile</CLICON_BACKEND_PIDFILE>
|
||||
<CLICON_XMLDB_DIR>/usr/local/var/$APPNAME</CLICON_XMLDB_DIR>
|
||||
<CLICON_STARTUP_MODE>init</CLICON_STARTUP_MODE>
|
||||
<CLICON_MODULE_LIBRARY_RFC7895>false</CLICON_MODULE_LIBRARY_RFC7895>
|
||||
<CLICON_CLISPEC_DIR>/usr/local/lib/$APPNAME/clispec</CLICON_CLISPEC_DIR>
|
||||
<CLICON_CLI_DIR>/usr/local/lib/$APPNAME/cli</CLICON_CLI_DIR>
|
||||
<CLICON_CLI_MODE>$APPNAME</CLICON_CLI_MODE>
|
||||
<CLICON_CLI_GENMODEL_COMPLETION>1</CLICON_CLI_GENMODEL_COMPLETION>
|
||||
<CLICON_CLI_GENMODEL_TYPE>VARS</CLICON_CLI_GENMODEL_TYPE>
|
||||
<CLICON_CLI_AUTOCLI_EXCLUDE>clixon-restconf</CLICON_CLI_AUTOCLI_EXCLUDE>
|
||||
<CLICON_CLI_LINESCROLLING>0</CLICON_CLI_LINESCROLLING>
|
||||
<CLICON_CLI_TAB_MODE>0</CLICON_CLI_TAB_MODE>
|
||||
</clixon-config>
|
||||
EOF
|
||||
|
||||
#cfg=/usr/local/etc/hello.xml # XXX
|
||||
# Kill previous
|
||||
sudo clixon_backend -z -f $cfg -s init
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue