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
+23
View File
@@ -0,0 +1,23 @@
## Running `gzip` 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. In the container, reconfigure the project with coverage flags:
```
cd /experiment/src
./configure "CFLAGS=-m32 -fprofile-arcs -ftest-coverage" "CXXFLAGS=-m32 -fprofile-arcs -ftest-coverage" "LDFLAGS=-m32 -lgcov"
make clean
make
```
4. Run `/opt/sosrepair/prepare/setup.sh`.
5. Set proper permissions by running `sudo chmod -R 777 /opt/sosrepair/sosrepair`.
6. Setup environment variables:
```
export PYTHONPATH="/opt/sosrepair/bindings:${PYTHONPATH}"
export CPATH=":/opt/sosrepair/include"
export PATH="/opt/sosrepair/bin:$PATH"
```
+19
View File
@@ -0,0 +1,19 @@
#!/bin/bash
TIME_LIMIT=60
HERE_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
PATCH_EXE=$1
PATCH_DIR=$(dirname "$PATCH_EXE")
PROJECT_DIR="$HERE_DIR/src"
# Remove the object file for the affected source code file
# cp "$PATCH_DIR/inflate.c" "$PROJECT_DIR/inflate.c" && \
pushd "$PROJECT_DIR" && \
rm -f inflate.o && \
# Clear the results of any test executions for any previous patches
# pushd tests && \
# make clean && \
# popd && \
# Rebuild the rest of the project
timeout $TIME_LIMIT make || 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/
@@ -0,0 +1,80 @@
"""
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/inflate.c"
COMPILE_EXTRA_ARGS = [
"-I/usr/include",
]
MAKE_OUTPUT = "/experiment/makeout"
METHOD_RANGE = (300, 492)
# IF SOS+
# METHOD_RANGE = (338, 339)
SOSREPAIR = True
NUMBER_OF_TIMES_RERUNNING_TESTS = 1
EXCLUDE_SCANF = False
BULK_RUN_PATH = ""
@@ -0,0 +1,24 @@
#!/bin/bash
TEST_ID=$1
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
run_test()
{
cd $DIR/src
timeout 5 perl $DIR/gzip-run-tests.pl $1
RESULT=$?
if [ $RESULT = 0 ] ; then
echo "PASS"
else
echo "FAIL"
fi
cd ..
return 0
}
case $TEST_ID in
p1) run_test 1 && exit 0 ;;
p2) run_test 4 && exit 0 ;;
n1) run_test 3 && exit 0 ;;
esac
exit 1
@@ -0,0 +1,5 @@
For running SOS+ on this bug, we manually helped in finding
correct set of live variables. Variable `ifd` is global variable
therefore not considered by SOS+ as a live variable.
We manually changed code in `fault_localization/suspicious_block.py`
to include `ifd` as a variable.
@@ -0,0 +1,80 @@
"""
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/gzip.c"
COMPILE_EXTRA_ARGS = [
"-I/usr/include",
]
MAKE_OUTPUT = "/experiment/makeout"
METHOD_RANGE = (608, 692)
# IF SOS+
# METHOD_RANGE = (653, 654)
SOSREPAIR = True
NUMBER_OF_TIMES_RERUNNING_TESTS = 1
EXCLUDE_SCANF = False
BULK_RUN_PATH = ""
@@ -0,0 +1,25 @@
#!/bin/bash
TEST_ID=$1
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
run_test()
{
cd $DIR/src
timeout 5 /usr/bin/perl $DIR/gzip-run-tests.pl $1
RESULT=$?
if [ $RESULT = 0 ] ; then
echo "PASS"
else
echo "FAIL"
fi
cd ..
return 0
}
case $TEST_ID in
p1) run_test 1 && exit 0 ;;
p2) run_test 3 && exit 0 ;;
p3) run_test 4 && exit 0 ;;
n1) run_test 7 && exit 0 ;;
esac
exit 1
@@ -0,0 +1,80 @@
"""
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/gzip.c"
COMPILE_EXTRA_ARGS = [
"-I/usr/include",
]
MAKE_OUTPUT = "/experiment/makeout"
METHOD_RANGE = (1254, 1438)
# IF SOS+
# METHOD_RANGE = (1269,1270)
SOSREPAIR = True
NUMBER_OF_TIMES_RERUNNING_TESTS = 1
EXCLUDE_SCANF = False
BULK_RUN_PATH = ""
@@ -0,0 +1,27 @@
#!/bin/bash
TEST_ID=$1
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
run_test()
{
cd $DIR/src
timeout 5 perl $DIR/gzip-run-tests.pl $1
RESULT=$?
if [ $RESULT = 0 ] ; then
echo "PASS"
else
echo "FAIL"
fi
cd ..
return 0
}
case $TEST_ID in
p1) run_test 1 && exit 0 ;;
p2) run_test 3 && exit 0 ;;
p3) run_test 4 && exit 0 ;;
p4) run_test 7 && exit 0 ;;
p5) run_test 9 && exit 0 ;;
n1) run_test 8 && exit 0 ;;
esac
exit 1
@@ -0,0 +1,6 @@
n1
p1
p2
p3
p4
p5
@@ -0,0 +1,80 @@
"""
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/gzip.c"
COMPILE_EXTRA_ARGS = [
"-I/usr/include",
]
MAKE_OUTPUT = "/experiment/makeout"
METHOD_RANGE = (409, 585)
# IF SOS+
# METHOD_RANGE = (546, 547)
SOSREPAIR = True
NUMBER_OF_TIMES_RERUNNING_TESTS = 1
EXCLUDE_SCANF = False
BULK_RUN_PATH = ""
@@ -0,0 +1,30 @@
#!/bin/bash
TEST_ID=$1
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
run_test()
{
cd $DIR/src
timeout 5 perl $DIR/gzip-run-tests.pl $1
RESULT=$?
if [ $RESULT = 0 ] ; then
echo "PASS"
else
echo "FAIL"
fi
cd ..
return 0
}
case $TEST_ID in
p1) run_test 1 && exit 0 ;;
p2) run_test 3 && exit 0 ;;
p3) run_test 4 && exit 0 ;;
p4) run_test 5 && exit 0 ;;
p5) run_test 7 && exit 0 ;;
p6) run_test 8 && exit 0 ;;
p7) run_test 9 && exit 0 ;;
p8) run_test 12 && exit 0 ;;
n1) run_test 6 && exit 0 ;;
esac
exit 1
@@ -0,0 +1,9 @@
n1
p1
p2
p3
p4
p5
p6
p7
p8
+79
View File
@@ -0,0 +1,79 @@
Making all in lib
make[1]: Entering directory `/experiment/src/lib'
GEN arg-nonnull.h
GEN c++defs.h
GEN configmake.h
GEN warn-on-use.h
GEN fcntl.h
GEN stdio.h
GEN string.h
GEN sys/stat.h
GEN sys/time.h
GEN time.h
GEN unistd.h
GEN wchar.h
GEN wctype.h
make all-recursive
make[2]: Entering directory `/experiment/src/lib'
make[3]: Entering directory `/experiment/src/lib'
GEN charset.alias
GEN ref-add.sed
GEN ref-del.sed
CC exitfail.o
CC freadahead.o
CC freading.o
CC localcharset.o
CC close-stream.o
CC xalloc-die.o
CC closein.o
CC closeout.o
CC creat-safer.o
CC dup-safer.o
CC fcntl.o
CC fd-safer.o
CC fflush.o
CC fpurge.o
CC fseeko.o
CC gettime.o
CC open-safer.o
CC pipe-safer.o
CC quotearg.o
CC utimens.o
CC xmalloc.o
CC yesno.o
AR libgzip.a
make[3]: Leaving directory `/experiment/src/lib'
make[2]: Leaving directory `/experiment/src/lib'
make[1]: Leaving directory `/experiment/src/lib'
Making all in doc
make[1]: Entering directory `/experiment/src/doc'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/experiment/src/doc'
make[1]: Entering directory `/experiment/src'
CC bits.o
CC crypt.o
CC deflate.o
CC gzip.o
CC inflate.o
CC lzw.o
CC trees.o
CC unlzh.o
CC unlzw.o
CC unpack.o
CC unzip.o
CC util.o
CC zip.o
GEN gunzip
GEN gzexe
GEN zcat
GEN zcmp
GEN zdiff
GEN zegrep
GEN zfgrep
GEN zforce
GEN zgrep
GEN zless
GEN zmore
GEN znew
CCLD gzip
make[1]: Leaving directory `/experiment/src'
+24
View File
@@ -0,0 +1,24 @@
#!/bin/bash
TEST_ID=$1
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
run_test()
{
cd $DIR/src
timeout 5 perl $DIR/gzip-run-tests.pl $1
RESULT=$?
if [ $RESULT = 0 ] ; then
echo "PASS"
else
echo "FAIL"
fi
cd ..
return 0
}
case $TEST_ID in
p1) run_test 1 && exit 0 ;;
p2) run_test 4 && exit 0 ;;
n1) run_test 3 && exit 0 ;;
esac
exit 1