From c28f85c1004176537546eebdc16e3e8ed9979575 Mon Sep 17 00:00:00 2001 From: Andre Maroneze <andre.oliveiramaroneze@cea.fr> Date: Tue, 2 Apr 2019 14:48:37 +0200 Subject: [PATCH] [tests] refactoring of pdg tests --- Makefile | 1 + tests/pdg/annot.c | 4 ++-- tests/pdg/array_struct.i | 2 +- tests/pdg/assigns.i | 2 +- tests/pdg/bts1194.c | 2 +- tests/pdg/call.c | 2 +- tests/pdg/calls_and_implicits.c | 2 +- tests/pdg/const.i | 2 +- tests/pdg/decl_dpds.c | 2 +- tests/pdg/doc_dot.c | 2 +- tests/pdg/dpds_intra.c | 20 ++++++++++---------- tests/pdg/dyn_dpds.c | 4 ++-- tests/pdg/globals.c | 6 +++--- tests/pdg/inter_alias2.c | 8 ++++---- tests/pdg/loops.c | 22 +++++++++++----------- tests/pdg/multiple_calls.c | 4 ++-- tests/pdg/no_body.c | 4 ++-- tests/pdg/oracle/const.res.oracle | 24 ++++++++++++------------ tests/pdg/pb_infinite_loop.c | 6 +++--- tests/pdg/postdom.c | 2 +- tests/pdg/sets.c | 2 +- tests/pdg/simple_call.c | 8 ++++---- tests/pdg/simple_intra_slice.c | 2 +- tests/pdg/test_config | 1 + tests/pdg/top_pdg_input.c | 2 +- tests/pdg/variadic.c | 2 +- 26 files changed, 70 insertions(+), 68 deletions(-) create mode 100644 tests/pdg/test_config diff --git a/Makefile b/Makefile index f517edfe058..46848a8dd43 100644 --- a/Makefile +++ b/Makefile @@ -1082,6 +1082,7 @@ PLUGIN_NAME:=Pdg PLUGIN_DIR:=src/plugins/pdg PLUGIN_TESTS_LIB:=tests/pdg/dyn_dpds.ml \ tests/pdg/sets.ml +PLUGIN_TESTS_DIRS:=pdg PLUGIN_CMO:= pdg_parameters \ ctrlDpds \ pdg_state \ diff --git a/tests/pdg/annot.c b/tests/pdg/annot.c index 1136ec925f7..7fadc29185a 100644 --- a/tests/pdg/annot.c +++ b/tests/pdg/annot.c @@ -1,6 +1,6 @@ /* run.config - OPT: -eva-show-progress -fct-pdg f1 -main f1 -journal-disable -pdg-print -pdg-verbose 2 - OPT: -eva-show-progress -fct-pdg loop -main loop -journal-disable -pdg-print -pdg-verbose 2 + STDOPT: +"-fct-pdg f1 -main f1" + STDOPT: +"-fct-pdg loop -main loop" */ int G; diff --git a/tests/pdg/array_struct.i b/tests/pdg/array_struct.i index 0e3fd525ed8..f57e1fde63e 100644 --- a/tests/pdg/array_struct.i +++ b/tests/pdg/array_struct.i @@ -1,5 +1,5 @@ /* run.config - OPT: -eva-show-progress -pdg -pdg-print -journal-disable -pdg-verbose 2 + STDOPT: +"-pdg" */ typedef struct { diff --git a/tests/pdg/assigns.i b/tests/pdg/assigns.i index 503e10488cc..eeefb6ac7a4 100644 --- a/tests/pdg/assigns.i +++ b/tests/pdg/assigns.i @@ -1,5 +1,5 @@ /* run.config - OPT: -journal-disable -eva-show-progress -pdg -pdg-print -calldeps -pdg-verbose 2 + STDOPT: +"-pdg -calldeps" */ unsigned int x, y; diff --git a/tests/pdg/bts1194.c b/tests/pdg/bts1194.c index e15d6e04378..3cebc895ed2 100644 --- a/tests/pdg/bts1194.c +++ b/tests/pdg/bts1194.c @@ -1,5 +1,5 @@ /* run.config - OPT: -eva -inout -eva-show-progress -pdg -pdg-print -calldeps -deps -then -slice-return main -then-last -print -eva-show-progress + STDOPT: +"-eva -inout -pdg -calldeps -deps -then -slice-return main -then-last -print -eva-show-progress" */ int Y, X; diff --git a/tests/pdg/call.c b/tests/pdg/call.c index bfe8cd61495..f6c2c5ce8a9 100644 --- a/tests/pdg/call.c +++ b/tests/pdg/call.c @@ -1,6 +1,6 @@ /* run.config GCC: - OPT: -lib-entry -main g -eva-show-progress -pdg -pdg-dot tests/pdg/call -journal-disable -pdg-print -pdg-verbose 2 + STDOPT: +"-lib-entry -main g -pdg -pdg-dot tests/pdg/call " */ /* Ne pas modifier : exemple utilisé dans le rapport. */ diff --git a/tests/pdg/calls_and_implicits.c b/tests/pdg/calls_and_implicits.c index 32af2e6dd2f..1beea648a97 100644 --- a/tests/pdg/calls_and_implicits.c +++ b/tests/pdg/calls_and_implicits.c @@ -1,6 +1,6 @@ /* run.config * GCC: - * OPT: -eva-show-progress -fct-pdg main -inout -journal-disable -pdg-print -pdg-verbose 2 + * STDOPT: +"-fct-pdg main -inout" * */ diff --git a/tests/pdg/const.i b/tests/pdg/const.i index 9c195693403..9b09ac698ac 100644 --- a/tests/pdg/const.i +++ b/tests/pdg/const.i @@ -1,5 +1,5 @@ /* run.config - STDOPT: #" -load-module pdg -calldeps -eva-show-progress -pdg -pdg-print" + STDOPT: #"-eva -pdg -out -input -deps -calldeps -eva-show-progress -pdg -pdg-print" */ struct T1 { diff --git a/tests/pdg/decl_dpds.c b/tests/pdg/decl_dpds.c index 1b828df756d..c3554288fcf 100644 --- a/tests/pdg/decl_dpds.c +++ b/tests/pdg/decl_dpds.c @@ -1,6 +1,6 @@ /* run.config GCC: - OPT: -eva-show-progress -fct-pdg main -journal-disable -pdg-print -pdg-verbose 2 + STDOPT: +"-fct-pdg main" */ extern int G; diff --git a/tests/pdg/doc_dot.c b/tests/pdg/doc_dot.c index 965debeac4e..74710f1cb5f 100644 --- a/tests/pdg/doc_dot.c +++ b/tests/pdg/doc_dot.c @@ -1,5 +1,5 @@ /* run.config - OPT: -lib-entry -main g -eva-show-progress -fct-pdg g -pdg-dot tests/pdg/doc -journal-disable -pdg-print -pdg-verbose 2 + STDOPT: +"-lib-entry -main g -fct-pdg g -pdg-dot tests/pdg/doc" */ /* To build the svg file: * dot -Tsvg tests/pdg/doc.g.dot > tests/pdg/doc.g.svg diff --git a/tests/pdg/dpds_intra.c b/tests/pdg/dpds_intra.c index b666b2cb330..9197f260b9d 100644 --- a/tests/pdg/dpds_intra.c +++ b/tests/pdg/dpds_intra.c @@ -1,18 +1,18 @@ /* run.config GCC: - OPT: -eva-show-progress -fct-pdg test_struct -journal-disable -pdg-print -pdg-verbose 2 - OPT: -eva-show-progress -fct-pdg test_if_simple -journal-disable -pdg-print -pdg-verbose 2 - OPT: -eva-show-progress -fct-pdg test_goto_simple -journal-disable -pdg-print -pdg-verbose 2 - OPT: -eva-show-progress -fct-pdg test_goto_arriere -journal-disable -pdg-print -pdg-verbose 2 - OPT: -eva-show-progress -fct-pdg test_goto_else -journal-disable -pdg-print -pdg-verbose 2 - OPT: -main test_ctrl_dpd_multiple -journal-disable -pdg-print -pdg-verbose 2 + STDOPT: +"-fct-pdg test_struct" + STDOPT: +"-fct-pdg test_if_simple" + STDOPT: +"-fct-pdg test_goto_simple" + STDOPT: +"-fct-pdg test_goto_arriere" + STDOPT: +"-fct-pdg test_goto_else" + STDOPT: +"-main test_ctrl_dpd_multiple " => ne passe pas - OPT: -eva-show-progress -fct-pdg test_simple_loop -journal-disable -pdg-print -pdg-verbose 2 - OPT: -eva-show-progress -fct-pdg main -journal-disable -pdg-print -pdg-verbose 2 - OPT: -eva-show-progress -fct-pdg multiple_global_inputs -journal-disable -pdg-print -pdg-verbose 2 + STDOPT: +"-fct-pdg test_simple_loop" + STDOPT: +"-fct-pdg main" + STDOPT: +"-fct-pdg multiple_global_inputs" */ /* bin/toplevel.opt -deps -main g tests/slicing/dpds_intra.c */ -/* bin/toplevel.opt -eva-show-progress -fct-pdg test_goto_simple tests/slicing/dpds_intra.c -pdg-dot */ +/* bin/toplevel.opt -fct-pdg test_goto_simple tests/slicing/dpds_intra.c -pdg-dot */ extern int G; diff --git a/tests/pdg/dyn_dpds.c b/tests/pdg/dyn_dpds.c index 20168cf1621..8c40c94f19d 100644 --- a/tests/pdg/dyn_dpds.c +++ b/tests/pdg/dyn_dpds.c @@ -1,12 +1,12 @@ /* run.config EXECNOW: make -s @PTEST_DIR@/@PTEST_NAME@.cmxs - OPT: -load-module @PTEST_DIR@/@PTEST_NAME@.cmxs -eva-show-progress -deps -journal-disable -pdg-print -pdg-verbose 2 + STDOPT: +"-load-module @PTEST_DIR@/@PTEST_NAME@.cmxs -deps" */ /* To have a look at the dot PDG : - bin/toplevel.byte -deps -pdg-dot pdg -eva-show-progress -fct-pdg main @PTEST_DIR@/@PTEST_NAME@.c ; + bin/toplevel.byte -deps -pdg-dot pdg -fct-pdg main @PTEST_DIR@/@PTEST_NAME@.c ; zgrviewer pdg.main.dot or use @PTEST_DIR@/@PTEST_NAME@.ml to test the dynamic dependencies. diff --git a/tests/pdg/globals.c b/tests/pdg/globals.c index 7e7bde7417c..da152f25a18 100644 --- a/tests/pdg/globals.c +++ b/tests/pdg/globals.c @@ -1,8 +1,8 @@ /* run.config GCC: - STDOPT: #"-load-module pdg -main g -pdg-print -pdg-verbose 2" - STDOPT: #"-load-module pdg -main h -pdg-print -pdg-verbose 2" - STDOPT: #"-load-module pdg -main f -pdg-print -pdg-verbose 2" + STDOPT: #"-load-module pdg -eva -out -input -deps -main g -pdg-print -pdg-verbose 2" + STDOPT: #"-load-module pdg -eva -out -input -deps -main h -pdg-print -pdg-verbose 2" + STDOPT: #"-load-module pdg -eva -out -input -deps -main f -pdg-print -pdg-verbose 2" */ struct Tstr; extern int X; diff --git a/tests/pdg/inter_alias2.c b/tests/pdg/inter_alias2.c index 6ebda529c9d..714662e3966 100644 --- a/tests/pdg/inter_alias2.c +++ b/tests/pdg/inter_alias2.c @@ -1,9 +1,9 @@ /* run.config * GCC: - * OPT: -eva-show-progress -eva -journal-disable -pdg-print -pdg-verbose 2 - * OPT: -calldeps -eva-show-progress -fct-pdg incr_ptr -journal-disable -pdg-print -pdg-verbose 2 - * OPT: -calldeps -eva-show-progress -fct-pdg f1 -journal-disable -pdg-print -pdg-verbose 2 - * OPT: -calldeps -eva-show-progress -fct-pdg f2 -journal-disable -pdg-print -pdg-verbose 2 + * STDOPT: +"-eva" + * STDOPT: +"-calldeps -fct-pdg incr_ptr" + * STDOPT: +"-calldeps -fct-pdg f1" + * STDOPT: +"-calldeps -fct-pdg f2" */ void incr_ptr (int *p) { *p += 1; diff --git a/tests/pdg/loops.c b/tests/pdg/loops.c index 394600f8f53..dfb6e1b63d0 100644 --- a/tests/pdg/loops.c +++ b/tests/pdg/loops.c @@ -1,14 +1,14 @@ /* run.config GCC: - OPT: -lib-entry -main simple -eva-show-progress -fct-pdg simple -journal-disable -pdg-print -pdg-verbose 2 - OPT: -lib-entry -main simple_with_break -eva-show-progress -fct-pdg simple_with_break -journal-disable -pdg-print -pdg-verbose 2 - OPT: -lib-entry -main infinite -eva-show-progress -fct-pdg infinite -journal-disable -pdg-print -pdg-verbose 2 - OPT: -lib-entry -main infinite2 -eva-show-progress -fct-pdg infinite2 -journal-disable -pdg-print -pdg-verbose 2 - OPT: -lib-entry -main maybe_infinite -eva-show-progress -fct-pdg maybe_infinite -journal-disable -pdg-print -pdg-verbose 2 - OPT: -lib-entry -main two_infinite_loops -eva-show-progress -fct-pdg two_infinite_loops -journal-disable -pdg-print -pdg-verbose 2 - OPT: -lib-entry -main loop_with_goto -eva-show-progress -fct-pdg loop_with_goto -journal-disable -pdg-print -pdg-verbose 2 - OPT: -lib-entry -main non_natural_loop -eva-show-progress -fct-pdg non_natural_loop -journal-disable -pdg-print -pdg-verbose 2 - OPT: -lib-entry -main dead_code -eva-show-progress -fct-pdg dead_code -journal-disable -pdg-print -pdg-verbose 2 + STDOPT: +"-lib-entry -main simple -fct-pdg simple " + STDOPT: +"-lib-entry -main simple_with_break -fct-pdg simple_with_break " + STDOPT: +"-lib-entry -main infinite -fct-pdg infinite " + STDOPT: +"-lib-entry -main infinite2 -fct-pdg infinite2 " + STDOPT: +"-lib-entry -main maybe_infinite -fct-pdg maybe_infinite " + STDOPT: +"-lib-entry -main two_infinite_loops -fct-pdg two_infinite_loops " + STDOPT: +"-lib-entry -main loop_with_goto -fct-pdg loop_with_goto " + STDOPT: +"-lib-entry -main non_natural_loop -fct-pdg non_natural_loop " + STDOPT: +"-lib-entry -main dead_code -fct-pdg dead_code " @@ -24,11 +24,11 @@ bin/toplevel.opt -lib-entry -main $F -deps -verbose tests/pdg/loops.c zgrviewer ./$F_cfg.dot Pour voir les postdominateurs : -bin/toplevel.opt -lib-entry -main $F -eva-show-progress -fct-pdg $F -dot-postdom p tests/pdg/loops.c ; +bin/toplevel.opt -lib-entry -main $F -fct-pdg $F -dot-postdom p tests/pdg/loops.c ; zgrviewer ./p.$F.dot Pour voir le PDG : -bin/toplevel.opt -lib-entry -main $F -eva-show-progress -fct-pdg $F -pdg-dot pdg tests/pdg/loops.c ; +bin/toplevel.opt -lib-entry -main $F -fct-pdg $F -pdg-dot pdg tests/pdg/loops.c ; zgrviewer ./pdg.$F.dot */ diff --git a/tests/pdg/multiple_calls.c b/tests/pdg/multiple_calls.c index d1e88beaab5..1a7660f575c 100644 --- a/tests/pdg/multiple_calls.c +++ b/tests/pdg/multiple_calls.c @@ -1,7 +1,7 @@ /* run.config GCC: - OPT: -inout -deps -main appel_ptr_fct -eva-show-progress -fct-pdg appel_ptr_fct -journal-disable -pdg-print -pdg-verbose 2 - OPT: -inout -deps -main appel_ptr_fct_bis -eva-show-progress -fct-pdg appel_ptr_fct_bis -journal-disable -pdg-print -pdg-verbose 2 + STDOPT: +"-inout -deps -main appel_ptr_fct -fct-pdg appel_ptr_fct " + STDOPT: +"-inout -deps -main appel_ptr_fct_bis -fct-pdg appel_ptr_fct_bis " */ extern int G1, G2, G3, G4; diff --git a/tests/pdg/no_body.c b/tests/pdg/no_body.c index 83b2ee049bc..003b2595d11 100644 --- a/tests/pdg/no_body.c +++ b/tests/pdg/no_body.c @@ -1,9 +1,9 @@ /* run.config * GCC: -* OPT: -eva-show-progress -fct-pdg main -inout -journal-disable -pdg-print -pdg-verbose 2 +* STDOPT: +"-fct-pdg main -inout " */ /* - * ledit bin/toplevel.top tests/slicing/no_body.c -eva-show-progress -fct-pdg main + * ledit bin/toplevel.top tests/slicing/no_body.c -fct-pdg main * #use "tests/slicing/select.ml";; * test "loop" (select_data "G");; */ diff --git a/tests/pdg/oracle/const.res.oracle b/tests/pdg/oracle/const.res.oracle index 22d4b94c015..0f2f3790c73 100644 --- a/tests/pdg/oracle/const.res.oracle +++ b/tests/pdg/oracle/const.res.oracle @@ -67,6 +67,18 @@ G3.M2 FROM G1.M2; G4; G5 \result FROM \nothing [from] ====== END OF CALLWISE DEPENDENCIES ====== +[inout] Out (internal) for function F1: + G3.M2 +[inout] Inputs for function F1: + G2.M2; G5 +[inout] Out (internal) for function F2: + G1.M1; V1 +[inout] Inputs for function F2: + G4 +[inout] Out (internal) for function main: + G1.M1; G2; G3.M2; V2 +[inout] Inputs for function main: + G1; G2.M2; G4; G5 [pdg] computing for function F1 [pdg] done for function F1 [pdg] computing for function F2 @@ -154,15 +166,3 @@ {n30}: In(G5) {n31}: In(G1.M2) {n32}: In(G4) -[inout] Out (internal) for function F1: - G3.M2 -[inout] Inputs for function F1: - G2.M2; G5 -[inout] Out (internal) for function F2: - G1.M1; V1 -[inout] Inputs for function F2: - G4 -[inout] Out (internal) for function main: - G1.M1; G2; G3.M2; V2 -[inout] Inputs for function main: - G1; G2.M2; G4; G5 diff --git a/tests/pdg/pb_infinite_loop.c b/tests/pdg/pb_infinite_loop.c index 5274ab98727..0dcf50f1923 100644 --- a/tests/pdg/pb_infinite_loop.c +++ b/tests/pdg/pb_infinite_loop.c @@ -1,8 +1,8 @@ /* run.config GCC: - OPT: -main test_infinite_loop -eva-show-progress -fct-pdg test_infinite_loop -journal-disable -pdg-print -pdg-verbose 2 - OPT: -main test_infinite_loop_2 -eva-show-progress -fct-pdg test_infinite_loop_2 -journal-disable -pdg-print -pdg-verbose 2 - OPT: -main test_exit -eva-show-progress -fct-pdg test_exit -journal-disable -pdg-print -pdg-verbose 2 + STDOPT: +"-main test_infinite_loop -fct-pdg test_infinite_loop " + STDOPT: +"-main test_infinite_loop_2 -fct-pdg test_infinite_loop_2 " + STDOPT: +"-main test_exit -fct-pdg test_exit " */ /* This test is a problem at the moment because the postdominators are Top diff --git a/tests/pdg/postdom.c b/tests/pdg/postdom.c index b6b0cddc3df..3a3caed0faf 100644 --- a/tests/pdg/postdom.c +++ b/tests/pdg/postdom.c @@ -1,5 +1,5 @@ /* run.config - OPT: -eva-show-progress -pdg -journal-disable -pdg-print -pdg-verbose 2 + STDOPT: +"-pdg" */ diff --git a/tests/pdg/sets.c b/tests/pdg/sets.c index 3efc61ce72b..7b8f05dda8a 100644 --- a/tests/pdg/sets.c +++ b/tests/pdg/sets.c @@ -1,6 +1,6 @@ /* run.config EXECNOW: make -s @PTEST_DIR@/@PTEST_NAME@.cmxs - OPT: -eva-show-progress -load-module @PTEST_DIR@/@PTEST_NAME@ -lib-entry -main f -pdg -inout -journal-disable -pdg-print -pdg-verbose 2 + STDOPT: +"-load-module @PTEST_DIR@/@PTEST_NAME@ -lib-entry -main f -pdg -inout " */ diff --git a/tests/pdg/simple_call.c b/tests/pdg/simple_call.c index 6997c09cc1d..38800935624 100644 --- a/tests/pdg/simple_call.c +++ b/tests/pdg/simple_call.c @@ -1,9 +1,9 @@ /* run.config GCC: - OPT: -eva-show-progress -fct-pdg main -journal-disable -pdg-print -pdg-verbose 2 - OPT: -main call_in_loop -eva-show-progress -fct-pdg call_in_loop -journal-disable -pdg-print -pdg-verbose 2 - OPT: -main call_mix_G1_G2 -eva-show-progress -fct-pdg call_mix_G1_G2 -journal-disable -pdg-print -pdg-verbose 2 - OPT: -main call_multiple_global_outputs -eva-show-progress -fct-pdg call_multiple_global_outputs -journal-disable -pdg-print -pdg-verbose 2 + STDOPT: +"-fct-pdg main " + STDOPT: +"-main call_in_loop -fct-pdg call_in_loop " + STDOPT: +"-main call_mix_G1_G2 -fct-pdg call_mix_G1_G2 " + STDOPT: +"-main call_multiple_global_outputs -fct-pdg call_multiple_global_outputs " */ extern int G, G1, G2; diff --git a/tests/pdg/simple_intra_slice.c b/tests/pdg/simple_intra_slice.c index 2ea6f3ee9d8..2cc5d17980e 100644 --- a/tests/pdg/simple_intra_slice.c +++ b/tests/pdg/simple_intra_slice.c @@ -1,6 +1,6 @@ /* run.config GCC: - OPT: -eva-show-progress -pdg -journal-disable -pdg-print -pdg-verbose 2 + STDOPT: +"-pdg " */ /* test conçu initialement comme test pour le slicing */ int Unknown; diff --git a/tests/pdg/test_config b/tests/pdg/test_config new file mode 100644 index 00000000000..864d6b8a7b6 --- /dev/null +++ b/tests/pdg/test_config @@ -0,0 +1 @@ +OPT: -journal-disable -eva-show-progress -pdg-print -pdg-verbose 2 diff --git a/tests/pdg/top_pdg_input.c b/tests/pdg/top_pdg_input.c index f999edabbd2..632bde8819a 100644 --- a/tests/pdg/top_pdg_input.c +++ b/tests/pdg/top_pdg_input.c @@ -1,5 +1,5 @@ /* run.config - STDOPT: +"-no-results-function no_results -eva-no-builtins-auto -load-module pdg -pdg -journal-disable -pdg-print -pdg-verbose 2 -then -main main_asm" + STDOPT: +"-eva -pdg -out -input -deps -no-results-function no_results -eva-no-builtins-auto -load-module pdg -pdg -journal-disable -pdg-print -pdg-verbose 2 -then -main main_asm" */ volatile int nondet; int no_results() {return 1;} diff --git a/tests/pdg/variadic.c b/tests/pdg/variadic.c index 10ce0d25095..12a04b83b35 100644 --- a/tests/pdg/variadic.c +++ b/tests/pdg/variadic.c @@ -1,5 +1,5 @@ /* run.config -* OPT: -eva-show-progress -pdg -journal-disable -pdg-print -pdg-verbose 2 +* STDOPT: +"-pdg " */ // __builtin_va_start and co do not appear in PDG output because Value forgets to register them in the table of called functions. This is a bug of Value -- GitLab