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
708fd956
Commit
708fd956
authored
2 years ago
by
Loïc Correnson
Committed by
Patrick Baudin
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[bin] test script helper
parent
d3eb8d49
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
+196
-0
196 additions, 0 deletions
bin/test.sh
with
196 additions
and
0 deletions
bin/test.sh
0 → 100755
+
196
−
0
View file @
708fd956
#!/bin/sh
##########################################################################
# #
# This file is part of Frama-C. #
# #
# Copyright (C) 2007-2022 #
# CEA (Commissariat à l'énergie atomique et aux énergies #
# alternatives) #
# #
# you can redistribute it and/or modify it under the terms of the GNU #
# Lesser General Public License as published by the Free Software #
# Foundation, version 2.1. #
# #
# It is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU Lesser General Public License for more details. #
# #
# See the GNU Lesser General Public License version 2.1 #
# for more details (enclosed in the file licenses/LGPLv2.1). #
# #
##########################################################################
CONFIG
=
"<all>"
UPDATE
=
VERBOSE
=
TESTS
=
if
[
!
-d
"
$FRAMAC_WP_QUALIF
"
]
then
echo
"Warning: FRAMAC_WP_QUALIF not set"
FRAMAC_WP_CACHE
=
replay
else
FRAMAC_WP_CACHE
=
offline
FRAMAC_WP_CACHEDIR
=
$FRAMAC_WP_QUALIF
fi
# --------------------------------------------------------------------------
# --- Help Message
# --------------------------------------------------------------------------
function
Usage
{
echo
"USAGE"
echo
""
echo
"./bin/test.sh [OPTIONS|TESTS]..."
echo
""
echo
"TESTS SPECIFICATION"
echo
""
echo
" If no test is specified, run all tests in all config."
echo
" Tip: use shell completion"
echo
""
echo
" <DIR> all tests in directory"
echo
" <FILE> single test file"
echo
""
echo
"OPTIONS"
echo
""
echo
" -r|--clean clean (remove all) test results"
echo
" -p|--ptests prepare (all) dune files"
echo
" -v|--verbose display (next) tests output"
echo
" -u|--update run tests and update wp-cache"
echo
" -d|--default run tests from default config only"
echo
" -c|--config <name> run tests from specified config only"
echo
""
echo
" -h|--help print this help"
echo
""
echo
"VARIABLES"
echo
""
echo
" FRAMAC_WP_QUALIF"
echo
" Clone of git@git.frama-c.com:frama-c/wp-cache.git"
echo
" Please, always push updates to #master branch"
echo
""
}
# --------------------------------------------------------------------------
# --- Test Dir Processing
# --------------------------------------------------------------------------
function
TestDir
{
case
"
$CONFIG
"
in
"<all>"
)
ALIAS
=
$1
/ptests
;;
"<default>"
)
ALIAS
=
$1
/ptests_config
;;
*
)
ALIAS
=
$1
/ptests_config_
$CONFIG
;;
esac
echo
"dune build @
$ALIAS
"
dune build @
$ALIAS
if
[
$?
!=
0
]
then
exit
$?
fi
}
# --------------------------------------------------------------------------
# --- Test File Processing
# --------------------------------------------------------------------------
function
TestFile
{
DIR
=
$(
dirname
$1
)
FILE
=
$(
basename
$1
)
if
[
"
$CONFIG
"
==
"<all>"
]
then
echo
"Warning: can not run single test in all config"
fi
case
"
$CONFIG
"
in
"<all>"
|
"<default>"
)
RESULT
=
result
;;
*
)
RESULT
=
result_
$CONFIG
;;
esac
if
[
"
$VERBOSE
"
==
"yes"
]
then
ALIAS
=
$DIR
/
$RESULT
/
$FILE
else
ALIAS
=
$DIR
/
$RESULT
/
${
FILE
%.*
}
.wtests
fi
echo
"dune build @
$ALIAS
"
dune build @
$ALIAS
if
[
$?
!=
0
]
then
exit
$?
fi
}
# --------------------------------------------------------------------------
# --- Tests Processing
# --------------------------------------------------------------------------
function
RunTests
{
while
[
"
$1
"
!=
""
]
do
if
[
-d
$1
]
then
TestDir
$1
elif
[
-f
$1
]
then
TestFile
$1
else
echo
"ERROR: don't known what to do with '
$1
'"
echo
"USAGE: bin/test.sh -h"
exit
1
fi
shift
done
}
# --------------------------------------------------------------------------
# --- Command Line Processing
# --------------------------------------------------------------------------
while
[
"
$1
"
!=
""
]
do
case
"
$1
"
in
"-h"
|
"-help"
|
"--help"
)
Usage
exit
0
;;
"-r"
|
"--clean"
)
echo
"Cleaning all tests"
make clean-tests
;;
"-p"
|
"--ptests"
)
make run-ptests
;;
"-u"
|
"--update"
)
UPDATE
=
yes
FRAMAC_WP_CACHE
=
update
;;
"-v"
|
"--verbose"
)
VERBOSE
=
yes
;;
"-d"
|
"--default"
)
CONFIG
=
"<default>"
;;
"-c"
|
"--config"
)
CONFIG
=
$2
shift
;;
*
)
TESTS+
=
"
$1
"
;;
esac
shift
done
RunTests
$TESTS
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