Can't pass the tutorial test
blank-black opened this issue · comments
Hi Sergey,
After I setting up the oracle, assert.json, src/distance.c, src/Makefile from the tutorial, I run angelix /angelix/test/src distance.c oracle 1 2 3 --assert assert.json --verbose
and it shows:
root@9f2c2b97a49e:/angelix/test# angelix /angelix/test/src distance.c oracle 1 2 3 --assert assert.json --verbose
INFO repair option group_by_score = False
INFO repair option klee_max_depth = None
INFO repair option path_solving_timeout = 60000
INFO repair option synthesis_ptr_vars = False
INFO repair option redundant_test = False
INFO repair option ignore_infer_errors = False
INFO repair option instr_printf = None
INFO repair option defect = ['if-conditions', 'assignments']
INFO repair option synthesis_bool_only = False
INFO repair option synthesis_func_params = False
INFO repair option mute_test_message = False
INFO repair option max_z3_trials = 2
INFO repair option localize_from_bottom = False
INFO repair option initial_tests = 1
INFO repair option synthesis_timeout = 30000
INFO repair option mute_warning = False
INFO repair option semfix = False
INFO repair option klee_timeout = None
INFO repair option ignore_trans_errors = False
INFO repair option build_before_instr = False
INFO repair option max_angelic_paths = None
INFO repair option invalid_localization = False
INFO repair option synthesis_used_vars = True
INFO repair option group_size = 1
INFO repair option init_uninit_vars = False
INFO repair option synthesis_global_vars = False
INFO repair option all_tests = False
INFO repair option localization = jaccard
INFO repair option klee_ignore_errors = False
INFO repair option mute_build_message = False
INFO repair option ignore_trivial = False
INFO repair option klee_max_forks = None
INFO repair option klee_solver_timeout = None
INFO repair option verbose = True
INFO repair option klee_debug = False
INFO repair option test_timeout = None
INFO repair option use_nsynth = False
INFO repair option localize_only = False
INFO repair option synthesis_levels = ['alternatives', 'integer-constants', 'boolean-constants']
INFO repair option suspicious = 20
INFO repair option generate_all = False
INFO repair option klee_search = None
INFO repair option use_semfix_syn = False
INFO project configuring validation source
INFO project building json compilation database from validation source
make:distance' is up to date. INFO testing running test '1' of validation source INFO testing running test '2' of validation source INFO testing running test '3' of validation source INFO project configuring frontend source INFO transformation instrumenting repairable of frontend source Skipping /angelix/test/.angelix/frontend/distance.c. Compile command not found. INFO project building frontend source make:
distance' is up to date.
INFO repair running positive tests for debugging
INFO testing running test '1' of frontend source
INFO testing running test '2' of frontend source
INFO repair running negative tests for debugging
INFO testing running test '3' of frontend source
INFO repair repair test suite: ['1', '2', '3']
INFO repair validation test suite: ['1', '2', '3']
WARNING repair no suspicious expressions localized
INFO repair no patch generated in 0s
FAIL
No idea where gets wrong.
Boyang
The previous Makefile can't work well on my docker, it shows Makefile:5: *** missing separator. Stop.
when running make.
So I changed it to:
distance:distance.o
gcc distance.o -o distance
distance.o:distance.c
gcc -I. -c distance.c -o distance.o
But it seems like failed again:
root@9f2c2b97a49e:/angelix/test# angelix /angelix/test/src distance.c oracle 1 2 3 --assert assert.json --verbose
INFO repair option synthesis_levels = ['alternatives', 'integer-constants', 'boolean-constants']
INFO repair option ignore_trans_errors = False
INFO repair option localize_from_bottom = False
INFO repair option mute_test_message = False
INFO repair option initial_tests = 1
INFO repair option synthesis_bool_only = False
INFO repair option defect = ['if-conditions', 'assignments']
INFO repair option group_by_score = False
INFO repair option mute_warning = False
INFO repair option synthesis_ptr_vars = False
INFO repair option synthesis_func_params = False
INFO repair option klee_search = None
INFO repair option synthesis_timeout = 30000
INFO repair option klee_max_forks = None
INFO repair option use_semfix_syn = False
INFO repair option mute_build_message = False
INFO repair option max_z3_trials = 2
INFO repair option ignore_infer_errors = False
INFO repair option group_size = 1
INFO repair option build_before_instr = False
INFO repair option klee_debug = False
INFO repair option generate_all = False
INFO repair option init_uninit_vars = False
INFO repair option instr_printf = None
INFO repair option suspicious = 20
INFO repair option test_timeout = None
INFO repair option klee_max_depth = None
INFO repair option use_nsynth = False
INFO repair option all_tests = False
INFO repair option klee_ignore_errors = False
INFO repair option semfix = False
INFO repair option path_solving_timeout = 60000
INFO repair option localize_only = False
INFO repair option verbose = True
INFO repair option invalid_localization = False
INFO repair option synthesis_used_vars = True
INFO repair option localization = jaccard
INFO repair option ignore_trivial = False
INFO repair option synthesis_global_vars = False
INFO repair option klee_timeout = None
INFO repair option klee_solver_timeout = None
INFO repair option max_angelic_paths = None
INFO repair option redundant_test = False
INFO project configuring validation source
INFO project building json compilation database from validation source
gcc -I. -c distance.c -o distance.o
gcc distance.o -o distance
INFO testing running test '1' of validation source
INFO testing running test '2' of validation source
INFO testing running test '3' of validation source
INFO project configuring frontend source
INFO transformation instrumenting repairable of frontend source
/angelix/test/.angelix/frontend/distance.c:21:10: warning: implicit declaration of function 'atoi' is invalid in C99 [-Wimplicit-function-declaration]
x1 = atoi(argv[1]);
^
5 9 5 14
x1 > x2
6 14 6 19
x1 - x2
8 14 8 19
x2 - x1
9 9 9 14
y1 > y2
10 14 10 19
y1 - y2
12 14 12 19
y1 - y2
13 9 13 14
dx > dy
1 warning generated.
INFO project building frontend source
gcc -I. -c distance.c -o distance.o
gcc distance.o -o distance
distance.o: In function `distance':
distance.c:(.text+0x3d): undefined reference to `angelix_trace_and_load'
distance.c:(.text+0x6c): undefined reference to `angelix_trace_and_load'
distance.c:(.text+0x9c): undefined reference to `angelix_trace_and_load'
distance.c:(.text+0xcc): undefined reference to `angelix_trace_and_load'
distance.c:(.text+0xfb): undefined reference to `angelix_trace_and_load'
distance.o:distance.c:(.text+0x12b): more undefined references to `angelix_trace_and_load' follow
collect2: error: ld returned 1 exit status
make: *** [distance] Error 1
WARNING project compilation of .angelix/frontend returned non-zero code
INFO repair running positive tests for debugging
INFO testing running test '1' of frontend source
/angelix/src/tools/angelix-run-test: line 19: ./distance: No such file or directory
INFO testing running test '2' of frontend source
/angelix/src/tools/angelix-run-test: line 19: ./distance: No such file or directory
INFO repair running negative tests for debugging
INFO testing running test '3' of frontend source
/angelix/src/tools/angelix-run-test: line 19: ./distance: No such file or directory
INFO repair repair test suite: ['1', '2', '3']
INFO repair validation test suite: ['1', '2', '3']
WARNING repair no suspicious expressions localized
INFO repair no patch generated in 0s
FAIL
Thanks for your reply.
I changed it to:
root@9f2c2b97a49e:/angelix/test# cat src/Makefile
CC=gcc
CFLAGS=-I.
distance:distance.o
$(CC) distance.o -o distance
distance.o:distance.c
$(CC) $(CFLAGS) -c distance.c -o distance.o
It seems like the compiling works but patch generating failed finally:
root@9f2c2b97a49e:/angelix/test# angelix /angelix/test/src distance.c oracle 1 2 3 --assert assert.json --verbose
INFO repair option localization = jaccard
INFO repair option verbose = True
INFO repair option max_z3_trials = 2
INFO repair option group_size = 1
INFO repair option use_nsynth = False
INFO repair option synthesis_levels = ['alternatives', 'integer-constants', 'boolean-constants']
INFO repair option klee_solver_timeout = None
INFO repair option semfix = False
INFO repair option instr_printf = None
INFO repair option test_timeout = None
INFO repair option synthesis_ptr_vars = False
INFO repair option localize_only = False
INFO repair option all_tests = False
INFO repair option synthesis_timeout = 30000
INFO repair option suspicious = 20
INFO repair option klee_timeout = None
INFO repair option max_angelic_paths = None
INFO repair option klee_max_forks = None
INFO repair option synthesis_func_params = False
INFO repair option ignore_trans_errors = False
INFO repair option init_uninit_vars = False
INFO repair option ignore_infer_errors = False
INFO repair option use_semfix_syn = False
INFO repair option localize_from_bottom = False
INFO repair option mute_warning = False
INFO repair option generate_all = False
INFO repair option path_solving_timeout = 60000
INFO repair option synthesis_used_vars = True
INFO repair option group_by_score = False
INFO repair option mute_build_message = False
INFO repair option synthesis_bool_only = False
INFO repair option klee_ignore_errors = False
INFO repair option klee_search = None
INFO repair option build_before_instr = False
INFO repair option mute_test_message = False
INFO repair option invalid_localization = False
INFO repair option synthesis_global_vars = False
INFO repair option initial_tests = 1
INFO repair option ignore_trivial = False
INFO repair option defect = ['if-conditions', 'assignments']
INFO repair option klee_max_depth = None
INFO repair option redundant_test = False
INFO repair option klee_debug = False
INFO project configuring validation source
INFO project building json compilation database from validation source
gcc -I. -c distance.c -o distance.o
gcc distance.o -o distance
INFO testing running test '1' of validation source
INFO testing running test '2' of validation source
INFO testing running test '3' of validation source
INFO project configuring frontend source
INFO transformation instrumenting repairable of frontend source
/angelix/test/.angelix/frontend/distance.c:21:10: warning: implicit declaration of function 'atoi' is invalid in C99 [-Wimplicit-function-declaration]
x1 = atoi(argv[1]);
^
5 9 5 14
x1 > x2
6 14 6 19
x1 - x2
8 14 8 19
x2 - x1
9 9 9 14
y1 > y2
10 14 10 19
y1 - y2
12 14 12 19
y1 - y2
13 9 13 14
dx > dy
1 warning generated.
INFO project building frontend source
angelix-compiler --test -I. -c distance.c -o distance.o
[angelix-compiler] gcc -include /angelix/src/runtime/runtime.h '-I.' '-c' 'distance.c' '-o' 'distance.o' -L/angelix/build/lib/test -langelix -L/angelix/src/klee/Release+Asserts/lib -lkleeRuntest
angelix-compiler --test distance.o -o distance
[angelix-compiler] gcc -include /angelix/src/runtime/runtime.h 'distance.o' '-o' 'distance' -L/angelix/build/lib/test -langelix -L/angelix/src/klee/Release+Asserts/lib -lkleeRuntest
INFO repair running positive tests for debugging
INFO testing running test '1' of frontend source
INFO testing running test '2' of frontend source
INFO repair running negative tests for debugging
INFO testing running test '3' of frontend source
INFO repair repair test suite: ['1', '2', '3']
INFO repair validation test suite: ['1', '2', '3']
INFO localization selected expressions [(12, 14, 12, 19)] with group score 1.0
INFO localization selected expressions [(6, 14, 6, 19)] with group score 0.5
INFO localization selected expressions [(5, 9, 5, 14)] with group score 0.33333
INFO localization selected expressions [(9, 9, 9, 14)] with group score 0.33333
INFO localization selected expressions [(13, 9, 13, 14)] with group score 0.33333
INFO repair considering suspicious expressions [(12, 14, 12, 19)]
INFO reduction selected 1 tests
INFO reduction selected passing tests: []
INFO reduction selected failing tests: ['3']
INFO project configuring backend source
INFO transformation instrumenting suspicious of backend source
/angelix/test/.angelix/backend/distance.c:21:10: warning: implicit declaration of function 'atoi' is invalid in C99 [-Wimplicit-function-declaration]
x1 = atoi(argv[1]);
^
12 14 12 19
y1 - y2
1 warning generated.
INFO project building backend source
angelix-compiler --klee -I. -c distance.c -o distance.o
[angelix-compiler] llvm-gcc -include /angelix/src/runtime/runtime.h -emit-llvm -g -O0 -D ANGELIX_SYMBOLIC_RUNTIME '-I.' '-c' 'distance.c' '-o' 'distance.o'
angelix-compiler --klee distance.o -o distance
[angelix-compiler] llvm-ld --disable-opt 'distance.o' '-o' 'distance' -L/angelix/build/lib/klee -langelix
INFO inference inferring specification for test '3'
INFO testing running test '3' of backend source with KLEE
mv: 'klee.log' and '/angelix/test/.angelix/backend/klee.log' are the same file
mv: './klee-out-0' and '/angelix/test/.angelix/backend/klee-out-0' are the same file
INFO inference sleeping for 1 second...
INFO inference solving path .angelix/backend/klee-out-0/test000001.smt2
INFO inference value 'stdout' executed 0 times while 1 required
INFO inference solving path .angelix/backend/klee-out-0/test000002.smt2
INFO inference value 'stdout' executed 0 times while 1 required
INFO inference found 0 angelic paths for test '3'
INFO repair considering suspicious expressions [(6, 14, 6, 19)]
INFO reduction selected 1 tests
INFO reduction selected passing tests: []
INFO reduction selected failing tests: ['3']
INFO project configuring backend source
INFO transformation instrumenting suspicious of backend source
/angelix/test/.angelix/backend/distance.c:21:10: warning: implicit declaration of function 'atoi' is invalid in C99 [-Wimplicit-function-declaration]
x1 = atoi(argv[1]);
^
6 14 6 19
x1 - x2
1 warning generated.
INFO project building backend source
angelix-compiler --klee -I. -c distance.c -o distance.o
[angelix-compiler] llvm-gcc -include /angelix/src/runtime/runtime.h -emit-llvm -g -O0 -D ANGELIX_SYMBOLIC_RUNTIME '-I.' '-c' 'distance.c' '-o' 'distance.o'
angelix-compiler --klee distance.o -o distance
[angelix-compiler] llvm-ld --disable-opt 'distance.o' '-o' 'distance' -L/angelix/build/lib/klee -langelix
INFO inference inferring specification for test '3'
INFO testing running test '3' of backend source with KLEE
mv: 'klee.log' and '/angelix/test/.angelix/backend/klee.log' are the same file
mv: './klee-out-0' and '/angelix/test/.angelix/backend/klee-out-0' are the same file
INFO inference sleeping for 1 second...
INFO inference solving path .angelix/backend/klee-out-0/test000001.smt2
INFO inference value 'stdout' executed 0 times while 1 required
INFO inference solving path .angelix/backend/klee-out-0/test000002.smt2
INFO inference value 'stdout' executed 0 times while 1 required
INFO inference found 0 angelic paths for test '3'
INFO repair considering suspicious expressions [(5, 9, 5, 14)]
INFO reduction selected 1 tests
INFO reduction selected passing tests: []
INFO reduction selected failing tests: ['3']
INFO project configuring backend source
INFO transformation instrumenting suspicious of backend source
/angelix/test/.angelix/backend/distance.c:21:10: warning: implicit declaration of function 'atoi' is invalid in C99 [-Wimplicit-function-declaration]
x1 = atoi(argv[1]);
^
5 9 5 14
x1 > x2
1 warning generated.
INFO project building backend source
angelix-compiler --klee -I. -c distance.c -o distance.o
[angelix-compiler] llvm-gcc -include /angelix/src/runtime/runtime.h -emit-llvm -g -O0 -D ANGELIX_SYMBOLIC_RUNTIME '-I.' '-c' 'distance.c' '-o' 'distance.o'
angelix-compiler --klee distance.o -o distance
[angelix-compiler] llvm-ld --disable-opt 'distance.o' '-o' 'distance' -L/angelix/build/lib/klee -langelix
INFO inference inferring specification for test '3'
INFO testing running test '3' of backend source with KLEE
mv: 'klee.log' and '/angelix/test/.angelix/backend/klee.log' are the same file
mv: './klee-out-0' and '/angelix/test/.angelix/backend/klee-out-0' are the same file
INFO inference sleeping for 1 second...
INFO inference solving path .angelix/backend/klee-out-0/test000001.smt2
INFO inference value 'stdout' executed 0 times while 1 required
INFO inference solving path .angelix/backend/klee-out-0/test000002.smt2
INFO inference value 'stdout' executed 0 times while 1 required
INFO inference found 0 angelic paths for test '3'
INFO repair considering suspicious expressions [(9, 9, 9, 14)]
INFO reduction selected 1 tests
INFO reduction selected passing tests: []
INFO reduction selected failing tests: ['3']
INFO project configuring backend source
INFO transformation instrumenting suspicious of backend source
/angelix/test/.angelix/backend/distance.c:21:10: warning: implicit declaration of function 'atoi' is invalid in C99 [-Wimplicit-function-declaration]
x1 = atoi(argv[1]);
^
9 9 9 14
y1 > y2
1 warning generated.
INFO project building backend source
angelix-compiler --klee -I. -c distance.c -o distance.o
[angelix-compiler] llvm-gcc -include /angelix/src/runtime/runtime.h -emit-llvm -g -O0 -D ANGELIX_SYMBOLIC_RUNTIME '-I.' '-c' 'distance.c' '-o' 'distance.o'
angelix-compiler --klee distance.o -o distance
[angelix-compiler] llvm-ld --disable-opt 'distance.o' '-o' 'distance' -L/angelix/build/lib/klee -langelix
INFO inference inferring specification for test '3'
INFO testing running test '3' of backend source with KLEE
mv: 'klee.log' and '/angelix/test/.angelix/backend/klee.log' are the same file
mv: './klee-out-0' and '/angelix/test/.angelix/backend/klee-out-0' are the same file
INFO inference sleeping for 1 second...
INFO inference solving path .angelix/backend/klee-out-0/test000001.smt2
INFO inference value 'stdout' executed 0 times while 1 required
INFO inference found 0 angelic paths for test '3'
INFO repair considering suspicious expressions [(13, 9, 13, 14)]
INFO reduction selected 1 tests
INFO reduction selected passing tests: []
INFO reduction selected failing tests: ['3']
INFO project configuring backend source
INFO transformation instrumenting suspicious of backend source
/angelix/test/.angelix/backend/distance.c:21:10: warning: implicit declaration of function 'atoi' is invalid in C99 [-Wimplicit-function-declaration]
x1 = atoi(argv[1]);
^
13 9 13 14
dx > dy
1 warning generated.
INFO project building backend source
angelix-compiler --klee -I. -c distance.c -o distance.o
[angelix-compiler] llvm-gcc -include /angelix/src/runtime/runtime.h -emit-llvm -g -O0 -D ANGELIX_SYMBOLIC_RUNTIME '-I.' '-c' 'distance.c' '-o' 'distance.o'
angelix-compiler --klee distance.o -o distance
[angelix-compiler] llvm-ld --disable-opt 'distance.o' '-o' 'distance' -L/angelix/build/lib/klee -langelix
INFO inference inferring specification for test '3'
INFO testing running test '3' of backend source with KLEE
mv: 'klee.log' and '/angelix/test/.angelix/backend/klee.log' are the same file
mv: './klee-out-0' and '/angelix/test/.angelix/backend/klee-out-0' are the same file
INFO inference sleeping for 1 second...
INFO inference solving path .angelix/backend/klee-out-0/test000001.smt2
INFO inference value 'stdout' executed 0 times while 1 required
INFO inference solving path .angelix/backend/klee-out-0/test000002.smt2
INFO inference value 'stdout' executed 0 times while 1 required
INFO inference found 0 angelic paths for test '3'
INFO repair no patch generated in 13s
FAIL
In order to fix this bug, the group size should be set to 2, because it requires a multi-line change. Please try --group-size 2. I will update the tutorial
Do you mean adding it at the end of the command?
root@9f2c2b97a49e:/angelix/test# angelix /angelix/test/src distance.c oracle 1 2 3 --assert assert.json --group-size 2
INFO project configuring validation source
INFO project building json compilation database from validation source
INFO testing running test '1' of validation source
INFO testing running test '2' of validation source
INFO testing running test '3' of validation source
INFO project configuring frontend source
INFO transformation instrumenting repairable of frontend source
INFO project building frontend source
INFO repair running positive tests for debugging
INFO testing running test '1' of frontend source
INFO testing running test '2' of frontend source
INFO repair running negative tests for debugging
INFO testing running test '3' of frontend source
INFO repair repair test suite: ['1', '2', '3']
INFO repair validation test suite: ['1', '2', '3']
INFO localization selected expressions [(9, 9, 9, 14), (12, 14, 12, 19)] with group score 1.3333
INFO localization selected expressions [(5, 9, 5, 14), (6, 14, 6, 19)] with group score 0.83333
INFO localization selected expressions [(13, 9, 13, 14)] with group score 0.33333
INFO repair considering suspicious expressions [(9, 9, 9, 14), (12, 14, 12, 19)]
INFO reduction selected 1 tests
INFO reduction selected passing tests: []
INFO reduction selected failing tests: ['3']
INFO project configuring backend source
INFO transformation instrumenting suspicious of backend source
INFO project building backend source
INFO inference inferring specification for test '3'
INFO testing running test '3' of backend source with KLEE
INFO inference sleeping for 1 second...
INFO inference solving path .angelix/backend/klee-out-0/test000001.smt2
INFO inference value 'stdout' executed 0 times while 1 required
INFO inference solving path .angelix/backend/klee-out-0/test000003.smt2
INFO inference value 'stdout' executed 0 times while 1 required
INFO inference solving path .angelix/backend/klee-out-0/test000002.smt2
INFO inference value 'stdout' executed 0 times while 1 required
INFO inference found 0 angelic paths for test '3'
INFO repair considering suspicious expressions [(5, 9, 5, 14), (6, 14, 6, 19)]
INFO reduction selected 1 tests
INFO reduction selected passing tests: []
INFO reduction selected failing tests: ['3']
INFO project configuring backend source
INFO transformation instrumenting suspicious of backend source
INFO project building backend source
INFO inference inferring specification for test '3'
INFO testing running test '3' of backend source with KLEE
INFO inference sleeping for 1 second...
INFO inference solving path .angelix/backend/klee-out-0/test000001.smt2
INFO inference value 'stdout' executed 0 times while 1 required
INFO inference solving path .angelix/backend/klee-out-0/test000003.smt2
INFO inference value 'stdout' executed 0 times while 1 required
INFO inference solving path .angelix/backend/klee-out-0/test000002.smt2
INFO inference value 'stdout' executed 0 times while 1 required
INFO inference found 0 angelic paths for test '3'
INFO repair considering suspicious expressions [(13, 9, 13, 14)]
INFO reduction selected 1 tests
INFO reduction selected passing tests: []
INFO reduction selected failing tests: ['3']
INFO project configuring backend source
INFO transformation instrumenting suspicious of backend source
INFO project building backend source
INFO inference inferring specification for test '3'
INFO testing running test '3' of backend source with KLEE
INFO inference sleeping for 1 second...
INFO inference solving path .angelix/backend/klee-out-0/test000001.smt2
INFO inference value 'stdout' executed 0 times while 1 required
INFO inference solving path .angelix/backend/klee-out-0/test000002.smt2
INFO inference value 'stdout' executed 0 times while 1 required
INFO inference found 0 angelic paths for test '3'
INFO repair no patch generated in 8s
FAIL
Sure, it just like you discussed in another issue, 1 fail, others pass.
root@9f2c2b97a49e:/angelix# make test
python3 tests/tests.py
..F..............
======================================================================
FAIL: test_deletebreak (__main__.TestAngelix)
----------------------------------------------------------------------
Traceback (most recent call last):
File "tests/tests.py", line 126, in test_deletebreak
self.assertEqual(result, 'SUCCESS')
AssertionError: 'FAIL' != 'SUCCESS'
- FAIL
+ SUCCESS
----------------------------------------------------------------------
Ran 17 tests in 81.928s
FAILED (failures=1)
make: *** [test] Error 1
test.zip
I think most of the information is the same as you, except for the minor diff of Makefile.
Why don't you have ANGELIX_OUTPUT
as in the tutorial?
Oh, the ANGELIX_OUTPUT
need to be added manually? I thought it introduced automatically.
Sorry for that.
But I think it will make the tools hard to implement automatically in a large program. It may need large manual work.
Unfortunately, C does not have a standard testing framework, so in general it is not possible to say if a program passes or fails a given test without some annotations. But these annotations are only needed for the return values/assertions.
Thanks for your reply!