Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Z
zafl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Open Source Software
zafl
Commits
2ab13ef3
Commit
2ab13ef3
authored
6 years ago
by
Anh Nguyen-Tuong
Browse files
Options
Downloads
Patches
Plain Diff
Add more graph tests
parent
2160168b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
afl_transforms/tools/zax/test/test_graph.sh
+40
-19
40 additions, 19 deletions
afl_transforms/tools/zax/test/test_graph.sh
afl_transforms/tools/zax/test/test_mystrlen2.cpp
+34
-0
34 additions, 0 deletions
afl_transforms/tools/zax/test/test_mystrlen2.cpp
libzafl
+1
-1
1 addition, 1 deletion
libzafl
with
75 additions
and
20 deletions
afl_transforms/tools/zax/test/test_graph.sh
+
40
−
19
View file @
2ab13ef3
cd
$(
dirname
$(
realpath
$0
)
)
PUT
=
test_mystrlen.exe
MYARG
=
"0123456789abcdef"
PUT2
=
test_mystrlen2.exe
MYARG
=
"0123456789abcdef1"
ZAFL_PUT
=
"
$PUT
.zafl
$PUT
.zafl.c
$PUT
.zafl.g
$PUT
.zafl.d
$PUT
.zafl.d.g
$PUT
.zafl.c.d.g"
ZAFL_PUT2
=
"
$PUT2
.zafl
$PUT2
.zafl.c
$PUT2
.zafl.g
$PUT2
.zafl.d
$PUT2
.zafl.d.g
$PUT2
.zafl.c.d.g"
log_msg
()
{
...
...
@@ -40,25 +43,30 @@ build_one()
build_all
()
{
g++ test_mystrlen.cpp
-o
$PUT
g++ test_mystrlen2.cpp
-o
$PUT2
build_one
$PUT
$PUT
.zafl
-v
-t
$PUT
.analysis
build_one
$PUT
$PUT
.zafl.c
-c
-v
-t
$PUT
.analysis.c
build_one
$PUT
$PUT
.zafl.g
-g
-v
-t
$PUT
.analysis.g
build_one
$PUT
$PUT
.zafl.d
-d
-v
-t
$PUT
.analysis.d
build_one
$PUT
$PUT
.zafl.d.g
-d
-g
-v
-t
$PUT
.analysis.d.g
build_one
$PUT
$PUT
.zafl.c.d.g
-d
-g
-v
-t
$PUT
.analysis.c.d.g
for
p
in
$PUT
$PUT2
do
build_one
$p
$p
.zafl
-v
-t
$p
.analysis
build_one
$p
$p
.zafl.c
-c
-v
-t
$p
.analysis.c
build_one
$p
$p
.zafl.g
-g
-v
-t
$p
.analysis.g
build_one
$p
$p
.zafl.d
-d
-v
-t
$p
.analysis.d
build_one
$p
$p
.zafl.d.g
-d
-g
-v
-t
$p
.analysis.d.g
build_one
$p
$p
.zafl.c.d.g
-d
-g
-v
-t
$p
.analysis.c.d.g
done
}
clean_all
()
{
rm
-fr
${
PUT
}*
rm
-fr
${
PUT
}*
${
PUT2
}*
}
verify_output
()
{
./
$PUT
$MYARG
TR
>
$PUT
.output.orig
./
$PUT
$MYARG
>
$PUT
.output.orig
./
$PUT2
$MYARG
>
$PUT2
.output.orig
for
p
in
$ZAFL_PUT
for
p
in
$ZAFL_PUT
do
echo
"Program under test:
$p
"
./
${
p
}
$MYARG
>
$p
.output
...
...
@@ -66,7 +74,16 @@ verify_output()
if
[
!
$?
-eq
0
]
;
then
log_error
"output verification failure:
$p
.output"
fi
done
for
p
in
$ZAFL_PUT2
do
echo
"Program under test:
$p
"
./
${
p
}
$MYARG
>
$p
.output
diff
$PUT2
.output.orig
$p
.output
if
[
!
$?
-eq
0
]
;
then
log_error
"output verification failure:
$p
.output"
fi
done
log_msg
"output verified"
...
...
@@ -74,25 +91,28 @@ verify_output()
verify_afl_map
()
{
for
p
in
$ZAFL_PUT
orig_zafl
=
$1
shift
all_configs
=
$*
for
p
in
$all_configs
do
echo
"Computing trace maps for input
$MYARG
"
afl-showmap
-o
$p
.map
--
./
$p
$MYARG
cut
-d
':'
-f2
$p
.map |
sort
-r
|
head
-n
1
>
$p
.max_count
done
for
p
in
$
ZAFL_PUT
for
p
in
$
all_configs
do
diff
$
PUT
.zafl.max_count
$p
.max_count
>
/dev/null 2>&1
diff
$
orig_zafl
.zafl.max_count
$p
.max_count
>
/dev/null 2>&1
if
[
$?
-eq
0
]
;
then
max
=
$(
cat
$
PUT
.zafl.max_count
)
log_msg
"maximum afl edge value for
$
PUT
.zafl and
$p
match (
$max
)"
max
=
$(
cat
$
orig_zafl
.zafl.max_count
)
log_msg
"maximum afl edge value for
$
orig_zafl
.zafl and
$p
match (
$max
)"
else
echo
-n
"Maximum count for
$
PUT
: "
cat
$
PUT
.zafl.max_count
echo
-n
"Maximum count for
$
orig_zafl
: "
cat
$
orig_zafl
.zafl.max_count
echo
-n
"Maximum count for
$p
: "
cat
$p
.max_count
log_error
"maximum afl edge value does not match for
$
PUT
.zafl and
$p
"
log_error
"maximum afl edge value does not match for
$
orig_zafl
.zafl and
$p
"
fi
done
}
...
...
@@ -101,5 +121,6 @@ clean_all
check_afl
build_all
verify_output
verify_afl_map
verify_afl_map
$PUT
$ZAFL_PUT
verify_afl_map
$PUT2
$ZAFL_PUT2
clean_all
This diff is collapsed.
Click to expand it.
afl_transforms/tools/zax/test/test_mystrlen2.cpp
0 → 100644
+
34
−
0
View file @
2ab13ef3
#include
<iostream>
using
namespace
std
;
int
x
=
0
;
volatile
int
identity
(
int
x
)
{
return
x
;
}
size_t
my_strlen
(
char
*
arg
)
{
int
count
=
0
;
while
(
*
arg
!=
'\0'
)
{
if
(
count
%
99
)
x
*=
count
;
else
if
(
count
%
98
)
x
+=
count
;
count
++
;
arg
++
;
}
return
count
;
}
int
main
(
int
argc
,
char
**
argv
)
{
if
(
argc
>
1
)
cout
<<
"length: "
<<
my_strlen
(
argv
[
1
])
<<
endl
;
cout
<<
"x: "
<<
x
<<
endl
;
}
This diff is collapsed.
Click to expand it.
libzafl
@
6f6f7350
Compare
af935c06
...
6f6f7350
Subproject commit
af935c06d97490f3c8aae53aabea895e32850adf
Subproject commit
6f6f7350dc73d7305b58353b638be10148667015
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment