This Android example worked for me:
- Build for arm64-v8a and generate a .bdf file
- Load the generated .bdf file in
cpptest IDE - Do static analysis
| https://asciinema.org/a/q4opufgOywGvUf5V7DX9ZFUug |
| openjdk version "11.0.18" 2023-01-17 LTS | |
| OpenJDK Runtime Environment Zulu11.62+17-CA (build 11.0.18+10-LTS) | |
| OpenJDK 64-Bit Server VM Zulu11.62+17-CA (build 11.0.18+10-LTS, mixed mode) |
| #include <jni.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| static int zeroMethod() { return 0; } | |
| static void assignmentRemainderOfMethodResult() { | |
| int a = 5; | |
| a %= zeroMethod(); // VIOLATION | |
| } |
| export PS1="\n\e[44;1;37m\w \e[0m\n$ " |
| add_configs () | |
| { | |
| if [ ! -d $1 ]; then | |
| echo "*** cannot find ***"; | |
| return; | |
| fi; | |
| local x=$(find $1 -type d -name configs); | |
| tar xf ~/configs.tar -C $x/c++test --strip-components=1 | |
| } |
| int main(int argc, char *argv[]) | |
| { | |
| int count = 0; | |
| if (argc > 1) { | |
| char *ch = argv[1]; | |
| while (*ch != '\0') { | |
| if (*ch >= 'A' && *ch <= 'Z') { | |
| count++; | |
| } | |
| ch++; |
This Android example worked for me:
cpptest IDE| name: demo | |
| on: | |
| push: | |
| branches: [master, main] | |
| pull_request: | |
| branches: [master, main] | |
| workflow_dispatch: | |
| jobs: | |
| italian: | |
| name: Run Parasoft Static Analysis |
| #!/bin/sh | |
| /opt/parasoft/dtp/jre/bin/java \ | |
| -cp /opt/parasoft/dtp/tomcat/lib/*:/opt/parasoft/dtp/tomcat/webapps/pst/WEB-INF/lib/* \ | |
| -Djava.library.path="/opt/parasoft/dtp/lib/native" \ | |
| -DuseExternalLock=false \ | |
| toolkit.modules.main.pcc.MachineIdWrapper |
| #!/bin/sh | |
| # | |
| # C/C++ Standard | |
| cpptestcli -list-configs | grep 'builtin://' | while read c;do | |
| echo "*** $c ***" | |
| r=`echo "$c"|tr -d '()/'|tr ': ' '-_'` | |
| cpptestcli -config "$c" -bdf cpptestscan.bdf -report $r | tee /tmp/scan.log | |
| cp /tmp/scan.log $r | |
| done |