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
c35077ae
Commit
c35077ae
authored
2 years ago
by
Patrick Baudin
Browse files
Options
Downloads
Patches
Plain Diff
[Script] improves 'bin/tests.sh --verbose'
parent
6012a7aa
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bin/test.sh
+43
-21
43 additions, 21 deletions
bin/test.sh
with
43 additions
and
21 deletions
bin/test.sh
+
43
−
21
View file @
c35077ae
...
...
@@ -27,7 +27,8 @@ VERBOSE=
UPDATE
=
LOGS
=
TESTS
=
COUNT
=
LOG_ERR
=
.test-errors.log
FRAMAC_WP_CACHE_GIT
=
git@git.frama-c.com:frama-c/wp-cache.git
...
...
@@ -120,17 +121,16 @@ function Cmd
function
SetEnv
{
if
[
"
$FRAMAC_WP_CACHE
"
=
""
]
then
if
[
"
$FRAMAC_WP_CACHE
"
=
""
]
;
then
FRAMAC_WP_CACHE
=
offline
Echo
"Set FRAMAC_WP_CACHE=
$FRAMAC_WP_CACHE
"
fi
if
[
"
$FRAMAC_WP_CACHEDIR
"
=
""
]
then
if
[
"
$FRAMAC_WP_CACHEDIR
"
=
""
]
;
then
FRAMAC_WP_CACHEDIR
=
./.wp-cache
Echo
"Set FRAMAC_WP_CACHEDIR=
$FRAMAC_WP_CACHEDIR
"
fi
}
function
CloneCache
...
...
@@ -147,6 +147,25 @@ function PullCache
Run git
-C
$FRAMAC_WP_CACHEDIR
pull
--rebase
}
# --------------------------------------------------------------------------
# --- Test Dir Alias
# --------------------------------------------------------------------------
rm
-rf
$LOG_ERR
function
TestAlias
{
if
[
"
$VERBOSE
"
!=
"yes"
]
;
then
Run dune build
$@
elif
[
"
$LOG_ERR
"
=
""
]
;
then
Run build
--display
short
else
# note: the Run function cannot performs redirection
echo
"> build --display short
$@
2> >(tee -a
$LOG_ERR
>&2)"
dune build
--display
short
$@
2>
>(
tee
-a
$LOG_ERR
>
&2
)
fi
}
# --------------------------------------------------------------------------
# --- Test Dir Processing
# --------------------------------------------------------------------------
...
...
@@ -169,7 +188,7 @@ function TestDir
;;
esac
Head
"Running test on directory
$1
$CFG
"
Run dune build
@
$ALIAS
TestAlias
@
$ALIAS
}
# --------------------------------------------------------------------------
...
...
@@ -192,14 +211,13 @@ function TestFile
CFG
=
"(config
$CONFIG
)"
;;
esac
if
[
"
$LOGS
"
=
"yes"
]
then
if
[
"
$LOGS
"
=
"yes"
]
;
then
ALIAS
=
$DIR
/
$RESULT
/
$FILE
else
ALIAS
=
$DIR
/
$RESULT
/
${
FILE
%.*
}
.wtests
fi
Head
"Running test on file
$1
$CFG
"
Cmd dune build
@
$ALIAS
TestAlias
@
$ALIAS
}
# --------------------------------------------------------------------------
...
...
@@ -210,14 +228,15 @@ function RunTests
{
while
[
"
$1
"
!=
""
]
do
if
[
-d
$1
]
then
if
[
-d
$1
]
;
then
TestDir
$1
elif
[
-f
$1
]
then
elif
[
-f
$1
]
;
then
TestFile
$1
else
ErrorUsage
"ERROR: don't known what to do with '
$1
'"
case
$1
in
@
*
)
Head
"Running test on alias
$1
"
;
TestAlias
$1
;;
*
)
ErrorUsage
"ERROR: don't known what to do with '
$1
'"
;;
esac
fi
shift
done
...
...
@@ -231,21 +250,27 @@ function RunTests
function
CountTests
{
#-- Count number of .res.log files
if
[
"
$COUNT
"
=
"yes"
]
;
then
if
[
"
$VERBOSE
"
=
"yes"
]
;
then
if
[
-f
"
$LOG_ERR
"
]
;
then
echo
"# Number of executed frama-c-wtests=
$(
grep
-c
"^frama-c-wtests "
$LOG_ERR
)
"
Cmd
rm
-f
$LOG_ERR
fi
BUILD
=
_build/default
Head
"Number of .res.log files by test directory..."
Head
"Number of
*
.res.log files by test directory..."
NB
=
for
dir
in
tests src/plugins/
*
/tests
;
do
if
[
!
-d
"
$dir
"
]
;
then
if
[
-d
"
$dir
"
]
;
then
NB
=
"
$((
find
$BUILD
/
$dir
-
name
\*
.res.log
2
>
/
dev/null
)
|
wc
-
l
)
"
[ "
$NB
" = "
0
"] || echo "
-
$dir
=
$NB
"
[ "
$NB
" = "
0
"
] || echo "
-
$dir
=
$NB
"
fi
done
[ "
$NB
" != "" ] || echo "
-
<none>
"
fi
#-- Check wp-cache status
if [ "
$UPDATE
" = "
yes
" ]; then
Head "
Check
$FRAMAC_WP_CACHEDIR
status
"
...
...
@@ -296,9 +321,6 @@ do
"
-
a
"|"
--
all
")
TESTS="
tests src/plugins/
*/
tests
"
;;
"
-
n
"|"
--
count
")
COUNT=yes
;;
*)
TESTS+="
$1
"
;;
...
...
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