Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frama-c
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
pub
frama-c
Commits
a0980fbe
Commit
a0980fbe
authored
3 years ago
by
Patrick Baudin
Browse files
Options
Downloads
Patches
Plain Diff
[ptests] expands macros as early as possible
parent
2900471f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ptests/ptests.ml
+44
-26
44 additions, 26 deletions
ptests/ptests.ml
tests/test_config
+2
-1
2 additions, 1 deletion
tests/test_config
with
46 additions
and
27 deletions
ptests/ptests.ml
+
44
−
26
View file @
a0980fbe
...
...
@@ -896,7 +896,7 @@ end = struct
let
make_custom_opts
=
let
space
=
Str
.
regexp
" "
in
fun
stdopts
s
->
fun
~
file
stdopts
s
->
let
rec
aux
opts
s
=
try
Scanf
.
sscanf
s
"%_[ ]%1[+#
\\
-]%_[ ]%S%_[ ]%s@
\n
"
...
...
@@ -909,7 +909,7 @@ end = struct
with
|
Scanf
.
Scan_failure
_
->
if
s
<>
""
then
lock_eprintf
"unknown STDOPT configuration string: %s
\n
%!"
s
;
lock_eprintf
"
%s:
unknown STDOPT configuration string: %s
\n
%!"
file
s
;
opts
|
End_of_file
->
opts
in
...
...
@@ -925,27 +925,30 @@ end = struct
(* how to process options *)
let
config_exec
~
warn
~
once
~
file
dir
s
current
=
let
s
=
Macros
.
expand
current
.
dc_macros
s
in
{
current
with
dc_execnow
=
scan_execnow
~
warn
~
once
~
file
dir
current
.
dc_macros
current
.
dc_timeout
s
::
current
.
dc_execnow
}
let
config_macro
~
file
_dir
s
current
=
let
config_macro
=
let
regex
=
Str
.
regexp
"[
\t
]*
\\
([^
\t
@]+
\\
)
\\
([
\t
]+
\\
(.*
\\
)
\\
|$
\\
)"
in
Mutex
.
lock
str_mutex
;
if
Str
.
string_match
regex
s
0
then
begin
let
name
=
Str
.
matched_group
1
s
in
let
def
=
try
Str
.
matched_group
3
s
with
Not_found
->
(* empty text *)
""
in
Mutex
.
unlock
str_mutex
;
if
!
verbosity
>=
4
then
lock_printf
"%% - New macro %s with definition %s
\n
%!"
name
def
;
{
current
with
dc_macros
=
Macros
.
add_expand
name
def
current
.
dc_macros
}
end
else
begin
Mutex
.
unlock
str_mutex
;
lock_eprintf
"%s: cannot understand MACRO definition: %s
\n
%!"
file
s
;
current
end
fun
~
file
_dir
s
current
->
let
s
=
Macros
.
expand
current
.
dc_macros
s
in
Mutex
.
lock
str_mutex
;
if
Str
.
string_match
regex
s
0
then
begin
let
name
=
Str
.
matched_group
1
s
in
let
def
=
try
Str
.
matched_group
3
s
with
Not_found
->
(* empty text *)
""
in
Mutex
.
unlock
str_mutex
;
if
!
verbosity
>=
4
then
lock_printf
"%% - New macro %s with definition %s
\n
%!"
name
def
;
{
current
with
dc_macros
=
Macros
.
add_expand
name
def
current
.
dc_macros
}
end
else
begin
Mutex
.
unlock
str_mutex
;
lock_eprintf
"%s: cannot understand MACRO definition: %s
\n
%!"
file
s
;
current
end
let
update_module_libs_name
s
=
"@PTEST_DIR@/"
^
(
Filename
.
remove_extension
s
)
^
(
if
!
use_byte
then
".cmo"
else
".cmxs"
)
...
...
@@ -992,17 +995,21 @@ end = struct
update_macros
(
fun
name
->
name
)
"-load-module="
"PTEST_PLUGIN"
"PTEST_LOAD_PLUGIN"
let
config_module
~
file
dir
s
current
=
let
deps
=
str_split_list
(
Macros
.
expand
current
.
dc_macros
s
)
in
let
s
=
Macros
.
expand
current
.
dc_macros
s
in
let
deps
=
str_split_list
s
in
let
current
=
update_module_macros
current
deps
in
add_make_modules
~
file
dir
deps
current
let
config_libs_script_plugin
update
~
file
dir
s
current
=
let
deps
=
str_split_list
(
Macros
.
expand
current
.
dc_macros
s
)
in
let
s
=
Macros
.
expand
current
.
dc_macros
s
in
let
deps
=
str_split_list
s
in
update
current
deps
let
config_options
=
[
"CMD"
,
(
fun
~
file
:_
_
s
current
->
{
current
with
dc_default_toplevel
=
s
});
(
fun
~
file
:_
_
s
current
->
let
s
=
Macros
.
expand
current
.
dc_macros
s
in
{
current
with
dc_default_toplevel
=
s
});
"OPT"
,
(
fun
~
file
_
s
current
->
...
...
@@ -1010,6 +1017,7 @@ end = struct
lock_eprintf
"%s: a NOFRAMAC directive has been defined before a sub-test defined by a 'OPT' directive (That NOFRAMAC directive could be misleading.).@."
file
;
let
s
=
Macros
.
expand
current
.
dc_macros
s
in
let
t
=
{
toplevel
=
current
.
dc_default_toplevel
;
opts
=
s
;
...
...
@@ -1028,11 +1036,12 @@ end = struct
lock_eprintf
"%s: a NOFRAMAC directive has been defined before a sub-test defined by a 'STDOPT' directive (That NOFRAMAC directive could be misleading.).@."
file
;
let
s
=
Macros
.
expand
current
.
dc_macros
s
in
let
new_top
=
List
.
map
(
fun
command
->
{
toplevel
=
current
.
dc_default_toplevel
;
opts
=
make_custom_opts
command
.
opts
s
;
opts
=
make_custom_opts
~
file
command
.
opts
s
;
logs
=
command
.
logs
@
current
.
dc_default_log
;
macros
=
current
.
dc_macros
;
exit_code
=
current
.
dc_exit_code
;
...
...
@@ -1044,10 +1053,13 @@ end = struct
dc_default_log
=
!
default_parsing_env
.
current_default_log
});
"FILEREG"
,
(
fun
~
file
:_
_
s
current
->
{
current
with
dc_test_regexp
=
s
});
(
fun
~
file
:_
_
s
current
->
let
s
=
Macros
.
expand
current
.
dc_macros
s
in
{
current
with
dc_test_regexp
=
s
});
"FILTER"
,
(
fun
~
file
:_
_
s
current
->
let
s
=
Macros
.
expand
current
.
dc_macros
s
in
let
s
=
trim_right
s
in
match
current
.
dc_filter
with
|
None
when
s
=
""
->
{
current
with
dc_filter
=
None
}
...
...
@@ -1055,7 +1067,9 @@ end = struct
|
Some
filter
->
{
current
with
dc_filter
=
Some
(
s
^
" | "
^
filter
)
});
"EXIT"
,
(
fun
~
file
:_
_
s
current
->
{
current
with
dc_exit_code
=
Some
s
});
(
fun
~
file
:_
_
s
current
->
let
s
=
Macros
.
expand
current
.
dc_macros
s
in
{
current
with
dc_exit_code
=
Some
s
});
"GCC"
,
(
fun
~
file
_
_
acc
->
...
...
@@ -1080,10 +1094,14 @@ end = struct
"PLUGIN"
,
config_libs_script_plugin
update_plugin_macros
;
"LOG"
,
(
fun
~
file
:_
_
s
current
->
{
current
with
dc_default_log
=
s
::
current
.
dc_default_log
});
(
fun
~
file
:_
_
s
current
->
let
s
=
Macros
.
expand
current
.
dc_macros
s
in
{
current
with
dc_default_log
=
s
::
current
.
dc_default_log
});
"TIMEOUT"
,
(
fun
~
file
:_
_
s
current
->
{
current
with
dc_timeout
=
s
});
(
fun
~
file
:_
_
s
current
->
let
s
=
Macros
.
expand
current
.
dc_macros
s
in
{
current
with
dc_timeout
=
s
});
"NOFRAMAC"
,
(
fun
~
file
_
_
current
->
...
...
This diff is collapsed.
Click to expand it.
tests/test_config
+
2
−
1
View file @
a0980fbe
MACRO: EVA_PLUGINS from,inout,eva,scope,variadic
MACRO: EVA_OPTIONS -eva-show-progress -eva-msg-key=-summary -eva-auto-loop-unroll 0
MACRO: EVA_CONFIG @EVA_OPTIONS@ -machdep x86_32
MACRO: EVA_TEST -eva @EVA_CONFIG@ -out -input -deps
PLUGIN: @EVA_PLUGINS@
OPT:
-eva @EVA_CONFIG@ -out -input -deps
OPT:
@EVA_TEST@
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