test list

This commit is contained in:
anil
2020-08-19 15:07:37 +02:00
parent bfcd2aacc5
commit cb293de686
242 changed files with 370216 additions and 0 deletions
@@ -0,0 +1,36 @@
## Running `wireshark` bugs
After running the container you need to follow the following
steps to prepare `SOSRepair` for running:
1. Copy `makeout`, `compile.sh`, `test.sh` and `tests-list` to
the container's `/experiment/`.
2. Copy `settings.py` to the container's `/opt/sosrepair/sosrepair`.
3. Unfortunately `wireshark` on `ManyBugs` dataset is preprocessed. So we need to
download it from git repository:
```
cd /experiment
rm -r src
git clone https://github.com/wireshark/wireshark.git src
cd src
./autogen.sh
```
4. In the container, reconfigure the project with coverage flags:
```
cd /experiment/src
./configure --disable-warnings-as-errors "CFLAGS=-fprofile-arcs -ftest-coverage" "CXXFLAGS=-fprofile-arcs -ftest-coverage" "LDFLAGS=-lgcov --coverage"
make clean
make
```
5. Run `/opt/sosrepair/prepare/setup.sh`.
6. Set proper permissions by running `sudo chmod -R 777 /opt/sosrepair/sosrepair`.
7. Setup environment variables:
```
export PYTHONPATH="/opt/sosrepair/bindings:${PYTHONPATH}"
export CPATH=":/opt/sosrepair/include"
export PATH="/opt/sosrepair/bin:$PATH"
```
8. You need to change permission of the test script:
```
chmod +x /experiment/wireshark-run-tests.sh
```
+8
View File
@@ -0,0 +1,8 @@
#!/bin/bash
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
cd $DIR/src
#make clean
(make && exit 0)|| exit 1
+10
View File
@@ -0,0 +1,10 @@
#!/bin/bash
CONTAINER=$1
BUG=$2
docker cp compile.sh $CONTAINER:/experiment/
docker cp $BUG/test.sh $CONTAINER:/experiment/
docker cp $BUG/tests-list.txt $CONTAINER:/experiment/
docker cp $BUG/settings.py $CONTAINER:/opt/sosrepair/sosrepair/
File diff suppressed because one or more lines are too long
@@ -0,0 +1,27 @@
I'm unable to compile snippets with clang-3.4.
When this is executed:
clang-3.4 -I/usr/include -I/experiment/src -I/usr/include/glib-2.0 -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/freetype2 -emit-llvm -c -g snippet.c
I get the error:
In file included from /usr/include/glib-2.0/glibconfig.h:11:
/usr/include/limits.h:123:16: fatal error: 'limits.h' file not found
# include_next <limits.h>
^
1 error generated.
When this:
clang-3.4 -I/experiment/src -I/usr/include/glib-2.0 -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/freetype2 -I/opt/sosrepair/llvm/lib/clang/5.0.2/include/ -emit-llvm -c -g snippet.c
I get error:
/opt/sosrepair/llvm/lib/clang/5.0.2/include/varargs.h:25:4: error: "Please use <stdarg.h>
....
Also at the beginning clang was unable to fine `glibconfig.h` so i had to run:
sudo ln -s /usr/lib/x86_64-linux-gnu/glib-2.0/include/glibconfig.h /usr/include/glib-2.0/
@@ -0,0 +1,84 @@
#include <klee/klee.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
char console[20];
int printf ( const char * format, ... ){
va_list args;
va_start (args, format);
vsnprintf (console, 20, format, args);
va_end (args);
return 0;
}
int fprintf ( FILE * stream, const char * format, ... ){
va_list args;
va_start (args, format);
if (stream == stdout)
vsnprintf (console, 20, format, args);
else
vfprintf (stream, format, args);
va_end (args);
return 0;
}
#define break
#include "/usr/include/stdio.h"
#include "/usr/include/stdlib.h"
#include "/usr/include/string.h"
#include "/usr/include/errno.h"
#include "/usr/include/glib-2.0/glib.h"
#include "/experiment/src/epan/packet.h"
#include "/experiment/src/epan/filesystem.h"
#include "/experiment/src/epan/plugins.h"
#include "/experiment/src/epan/report_err.h"
#include "/experiment/src/wsutil/privileges.h"
#include "/experiment/src/wsutil/wsgetopt.h"
#include "/experiment/src/svnversion.h"
typedef struct _capture_info {
const char *filename;
guint16 file_type;
int file_encap;
gint64 filesize;
guint64 packet_bytes;
double start_time;
double stop_time;
guint32 packet_count;
gboolean snap_set; /* If set in capture file header */
guint32 snaplen; /* value from the capture file header */
guint32 snaplen_min_inferred; /* If caplen < len for 1 or more rcds */
guint32 snaplen_max_inferred; /* ... */
gboolean drops_known;
guint32 drop_count;
double duration;
double packet_rate;
double packet_size;
double data_rate; /* in bytes */
gboolean in_order;
} capture_info;
void foo(gboolean cap_file_size, capture_info* cf_info, gboolean cap_packet_count, gboolean cap_data_size){
if (cap_packet_count) printf ("Number of packets: %u\n", cf_info->packet_count);
if (cap_file_size) printf ("File size: %" G_GINT64_MODIFIER "d bytes\n", cf_info->filesize);
if (cap_data_size) printf ("Data size: %" G_GINT64_MODIFIER "u bytes\n", cf_info->packet_bytes);
}
int main(){
gboolean cap_file_size;
klee_make_symbolic(&cap_file_size, sizeof(cap_file_size), "cap_file_size");
capture_info* cf_info = malloc( sizeof(capture_info ));
klee_make_symbolic(cf_info, sizeof(capture_info), "cf_info");
gboolean cap_packet_count;
klee_make_symbolic(&cap_packet_count, sizeof(cap_packet_count), "cap_packet_count");
gboolean cap_data_size;
klee_make_symbolic(&cap_data_size, sizeof(cap_data_size), "cap_data_size");
char console_out[20];
klee_make_symbolic(&console_out, sizeof(console_out), "console");
foo(cap_file_size, cf_info, cap_packet_count, cap_data_size);
klee_assume(strcmp(console_out, console) == 0);
return 0;
}
@@ -0,0 +1,100 @@
"""
This file includes all the settings that could be modified for running SearchRepair/SOSRepair
* LIBCLANG_PATH: The path to libclang build. It should be either a .so or .dylib file.
* GENERATE_DB_PATH: The path where the DB should be built from. SR will enumerate all C files in this path to build the
DB
* Z3_COMMAND: The z3 command on this machine.
* LARGEST_SNIPPET: The maximum number of lines that is considered as a snippet.
* SMALLEST_SNIPPET: The minimum number of lines that is considered as a snippet.
* DATABASE: Information about the database.
* LOGGING: Settings for logging.
* MAX_SUSPICIOUS_LINES: The number of suspicious lines tried before giving up.
* VALID_TYPES: The variable types that are right now supported by SR.
------ Settings related to file under repair -------
* TESTS_LIST: The path to a list of the tests that could be run on the file
* TEST_SCRIPT: The path to a script that will run the test
* COMPILE_SCRIPT: The path to a script that will compile the code
* FAULTY_CODE: The path to the faulty code (a C file)
* COMPILE_EXTRA_ARGS: The list of necessary arguments that should be passed to clang to properly parse the code
* MAKE_OUTPUT: The output of running `make` stored in a file (for the purpose of finding necessary arguments for compilation
automatically)
* METHOD_RANGE: The tuple of beginning and end of method with the fault (limits the search to the area)
* SOSREPAIR: If set to False it will only run SearchRepair features
* NUMBER_OF_TIMES_RERUNNING_TESTS: The number of times that the tests should be run to assure patch's correctness
* EXCLUDE_SCANF: If removing/replacing scanf in buggy code is going to be a problem, set this to True
"""
__author__ = 'Afsoon Afzal'
import logging
LIBCLANG_PATH = '/opt/sosrepair/llvm/lib/libclang.so'
GENERATE_DB_PATH = '/experiment/src'
Z3_COMMAND = '/opt/sosrepair/bin/z3'
LARGEST_SNIPPET = 7
SMALLEST_SNIPPET = 3
DATABASE = {
'db_name': 'testdocker',
'user': 'docker',
'password': '1234',
'host': '127.0.0.1'
}
LOGGING = {
'filename': 'logs/repair.log',
'level': logging.DEBUG
}
logging.basicConfig(**LOGGING)
MAX_SUSPICIOUS_LINES = 10
VALID_TYPES = ['int', 'short', 'long', 'char', 'float', 'double', 'long long', 'size_t']
TESTS_LIST = "/experiment/tests-list.txt"
TEST_SCRIPT = "/experiment/test.sh"
TEST_SCRIPT_TYPE = "/bin/bash"
COMPILE_SCRIPT = "/experiment/compile.sh"
FAULTY_CODE = "/experiment/src/epan/reassemble.c"
COMPILE_EXTRA_ARGS = [
"-DHAVE_CONFIG_H",
"-I/experiment/src/",
"-I/experiment/src/wsutil/",
"-I/usr/local/include",
# "-I/usr/include",
"-I/opt/sosrepair/llvm/lib/clang/5.0.2/include",
"-I/usr/local/include",
"-I/usr/include/gtk-2.0",
"-I/usr/lib/x86_64-linux-gnu/gtk-2.0/include",
"-I/usr/include/atk-1.0",
"-I/usr/include/cairo",
"-I/usr/include/gdk-pixbuf-2.0",
"-I/usr/include/pango-1.0",
"-I/usr/include/gio-unix-2.0/",
"-I/usr/include/freetype2",
"-I/usr/include/glib-2.0",
"-I/usr/lib/x86_64-linux-gnu/glib-2.0/include",
"-I/usr/include/pixman-1",
"-I/usr/include/libpng12",
"-I/usr/include/harfbuzz",
]
MAKE_OUTPUT = "/experiment/makeout"
METHOD_RANGE = (291, 316)
# IF SOS+
# METHOD_RANGE = (309, 310)
SOSREPAIR = True
NUMBER_OF_TIMES_RERUNNING_TESTS = 1
EXCLUDE_SCANF = False
BULK_RUN_PATH = ""
@@ -0,0 +1,82 @@
#!/bin/bash
run_abbrev=False
bugrev=37112
time_limit=240
dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
run_test()
{
cd $dir/src
../wireshark-run-tests.sh $1
RESULT=$?
if [ $RESULT = 0 ] ; then
echo "PASS"
else
echo "FAIL"
fi
cd ..
return 0
}
case $1 in
p1) run_test 1 && exit 0 ;;
p2) run_test 2 && exit 0 ;;
p3) run_test 3 && exit 0 ;;
p4) run_test 4 && exit 0 ;;
p5) run_test 5 && exit 0 ;;
p6) run_test 6 && exit 0 ;;
p7) run_test 7 && exit 0 ;;
p8) run_test 8 && exit 0 ;;
p9) run_test 9 && exit 0 ;;
p10) run_test 10 && exit 0 ;;
p11) run_test 11 && exit 0 ;;
p12) run_test 12 && exit 0 ;;
p13) run_test 13 && exit 0 ;;
p14) run_test 14 && exit 0 ;;
p15) run_test 15 && exit 0 ;;
p16) run_test 16 && exit 0 ;;
p17) run_test 17 && exit 0 ;;
p18) run_test 18 && exit 0 ;;
p19) run_test 19 && exit 0 ;;
p20) run_test 20 && exit 0 ;;
p21) run_test 21 && exit 0 ;;
p22) run_test 22 && exit 0 ;;
p23) run_test 23 && exit 0 ;;
p24) run_test 24 && exit 0 ;;
p25) run_test 25 && exit 0 ;;
p26) run_test 26 && exit 0 ;;
p27) run_test 27 && exit 0 ;;
p28) run_test 28 && exit 0 ;;
p29) run_test 29 && exit 0 ;;
p30) run_test 30 && exit 0 ;;
p31) run_test 31 && exit 0 ;;
p32) run_test 32 && exit 0 ;;
p33) run_test 33 && exit 0 ;;
p34) run_test 34 && exit 0 ;;
p35) run_test 35 && exit 0 ;;
p36) run_test 36 && exit 0 ;;
p37) run_test 37 && exit 0 ;;
p38) run_test 38 && exit 0 ;;
p39) run_test 39 && exit 0 ;;
p40) run_test 40 && exit 0 ;;
p41) run_test 41 && exit 0 ;;
p42) run_test 42 && exit 0 ;;
p43) run_test 43 && exit 0 ;;
p44) run_test 44 && exit 0 ;;
p45) run_test 45 && exit 0 ;;
p46) run_test 46 && exit 0 ;;
p47) run_test 47 && exit 0 ;;
p48) run_test 48 && exit 0 ;;
p49) run_test 49 && exit 0 ;;
p50) run_test 50 && exit 0 ;;
p51) run_test 51 && exit 0 ;;
p52) run_test 52 && exit 0 ;;
p53) run_test 53 && exit 0 ;;
p54) run_test 54 && exit 0 ;;
p55) run_test 55 && exit 0 ;;
p56) run_test 56 && exit 0 ;;
p57) run_test 57 && exit 0 ;;
p58) run_test 58 && exit 0 ;;
p59) run_test 59 && exit 0 ;;
p60) run_test 61 && exit 0 ;;
n1) run_test 60 && exit 0 ;;
esac
exit 1
@@ -0,0 +1,53 @@
n1
p1
p2
p3
p4
p5
p6
p7
p8
p9
p10
p11
p12
p13
p14
p15
p16
p17
p18
p19
p20
p21
p22
p23
p24
p25
p26
p27
p28
p29
p30
p31
p32
p33
p34
p35
p36
p37
p38
p39
p40
p41
p44
p45
p46
p47
p48
p49
p50
p55
p56
p59
p60
@@ -0,0 +1,79 @@
"""
This file includes all the settings that could be modified for running SearchRepair/SOSRepair
* LIBCLANG_PATH: The path to libclang build. It should be either a .so or .dylib file.
* GENERATE_DB_PATH: The path where the DB should be built from. SR will enumerate all C files in this path to build the
DB
* Z3_COMMAND: The z3 command on this machine.
* LARGEST_SNIPPET: The maximum number of lines that is considered as a snippet.
* SMALLEST_SNIPPET: The minimum number of lines that is considered as a snippet.
* DATABASE: Information about the database.
* LOGGING: Settings for logging.
* MAX_SUSPICIOUS_LINES: The number of suspicious lines tried before giving up.
* VALID_TYPES: The variable types that are right now supported by SR.
------ Settings related to file under repair -------
* TESTS_LIST: The path to a list of the tests that could be run on the file
* TEST_SCRIPT: The path to a script that will run the test
* COMPILE_SCRIPT: The path to a script that will compile the code
* FAULTY_CODE: The path to the faulty code (a C file)
* COMPILE_EXTRA_ARGS: The list of necessary arguments that should be passed to clang to properly parse the code
* MAKE_OUTPUT: The output of running `make` stored in a file (for the purpose of finding necessary arguments for compilation
automatically)
* METHOD_RANGE: The tuple of beginning and end of method with the fault (limits the search to the area)
* SOSREPAIR: If set to False it will only run SearchRepair features
* NUMBER_OF_TIMES_RERUNNING_TESTS: The number of times that the tests should be run to assure patch's correctness
* EXCLUDE_SCANF: If removing/replacing scanf in buggy code is going to be a problem, set this to True
"""
__author__ = 'Afsoon Afzal'
import logging
LIBCLANG_PATH = '/opt/sosrepair/llvm/lib/libclang.so'
GENERATE_DB_PATH = '/experiment/src'
Z3_COMMAND = '/opt/sosrepair/bin/z3'
LARGEST_SNIPPET = 7
SMALLEST_SNIPPET = 3
DATABASE = {
'db_name': 'testdocker',
'user': 'docker',
'password': '1234'
}
LOGGING = {
'filename': 'logs/repair.log',
'level': logging.DEBUG
}
logging.basicConfig(**LOGGING)
MAX_SUSPICIOUS_LINES = 10
VALID_TYPES = ['int', 'short', 'long', 'char', 'float', 'double', 'long long', 'size_t']
TESTS_LIST = "/experiment/tests-list.txt"
TEST_SCRIPT = "/experiment/test.sh"
TEST_SCRIPT_TYPE = "/bin/bash"
COMPILE_SCRIPT = "/experiment/compile.sh"
FAULTY_CODE = "/experiment/src/epan/reassemble.c"
COMPILE_EXTRA_ARGS = [
"-I/experiment/src",
"-I/usr/include",
]
MAKE_OUTPUT = "/experiment/makeout"
METHOD_RANGE = (290, 316)
SOSREPAIR = True
NUMBER_OF_TIMES_RERUNNING_TESTS = 1
EXCLUDE_SCANF = False
BULK_RUN_PATH = ""
@@ -0,0 +1,81 @@
#!/bin/bash
bugrev=37122
dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
run_test()
{
cd $dir/src
../wireshark-run-tests.sh $1
RESULT=$?
if [ $RESULT = 0 ] ; then
echo "PASS"
else
echo "FAIL"
fi
cd ..
return 0
}
case $1 in
p1) run_test 1 && exit 0 ;;
p2) run_test 2 && exit 0 ;;
p3) run_test 3 && exit 0 ;;
p4) run_test 4 && exit 0 ;;
p5) run_test 5 && exit 0 ;;
p6) run_test 6 && exit 0 ;;
p7) run_test 7 && exit 0 ;;
p8) run_test 8 && exit 0 ;;
p9) run_test 9 && exit 0 ;;
p10) run_test 10 && exit 0 ;;
p11) run_test 11 && exit 0 ;;
p12) run_test 12 && exit 0 ;;
p13) run_test 13 && exit 0 ;;
p14) run_test 14 && exit 0 ;;
p15) run_test 15 && exit 0 ;;
p16) run_test 16 && exit 0 ;;
p17) run_test 17 && exit 0 ;;
p18) run_test 18 && exit 0 ;;
p19) run_test 19 && exit 0 ;;
p20) run_test 20 && exit 0 ;;
p21) run_test 21 && exit 0 ;;
p22) run_test 22 && exit 0 ;;
p23) run_test 23 && exit 0 ;;
p24) run_test 24 && exit 0 ;;
p25) run_test 25 && exit 0 ;;
p26) run_test 26 && exit 0 ;;
p27) run_test 27 && exit 0 ;;
p28) run_test 28 && exit 0 ;;
p29) run_test 29 && exit 0 ;;
p30) run_test 30 && exit 0 ;;
p31) run_test 31 && exit 0 ;;
p32) run_test 32 && exit 0 ;;
p33) run_test 33 && exit 0 ;;
p34) run_test 34 && exit 0 ;;
p35) run_test 35 && exit 0 ;;
p36) run_test 36 && exit 0 ;;
p37) run_test 37 && exit 0 ;;
p38) run_test 38 && exit 0 ;;
p39) run_test 39 && exit 0 ;;
p40) run_test 40 && exit 0 ;;
p41) run_test 41 && exit 0 ;;
p42) run_test 42 && exit 0 ;;
p43) run_test 43 && exit 0 ;;
p44) run_test 44 && exit 0 ;;
p45) run_test 45 && exit 0 ;;
p46) run_test 46 && exit 0 ;;
p47) run_test 47 && exit 0 ;;
p48) run_test 48 && exit 0 ;;
p49) run_test 49 && exit 0 ;;
p50) run_test 50 && exit 0 ;;
p51) run_test 51 && exit 0 ;;
p52) run_test 52 && exit 0 ;;
p53) run_test 53 && exit 0 ;;
p54) run_test 54 && exit 0 ;;
p55) run_test 55 && exit 0 ;;
p56) run_test 56 && exit 0 ;;
p57) run_test 57 && exit 0 ;;
p58) run_test 58 && exit 0 ;;
p59) run_test 59 && exit 0 ;;
p60) run_test 61 && exit 0 ;;
n1) run_test 60 && exit 0 ;;
esac
exit 1
@@ -0,0 +1,53 @@
n1
p1
p2
p3
p4
p5
p6
p7
p8
p9
p10
p11
p12
p13
p14
p15
p16
p17
p18
p19
p20
p21
p22
p23
p24
p25
p26
p27
p28
p29
p30
p31
p32
p33
p34
p35
p36
p37
p38
p39
p40
p41
p44
p45
p46
p47
p48
p49
p50
p55
p56
p59
p60