1
0
Fork 0
mirror of https://github.com/bolero-MURAKAMI/Sprout synced 2024-11-12 21:09:01 +00:00

fix testspr: add --compiler-option

This commit is contained in:
bolero-MURAKAMI 2014-01-11 20:27:55 +09:00
parent e7b8d74c0f
commit 0f5ed91e03
3 changed files with 31 additions and 10 deletions

View file

@ -10,5 +10,6 @@
#include <sprout/config.hpp>
#include <sprout/workaround/recursive_function_template.hpp>
#include <sprout/workaround/base_class_construct.hpp>
#endif // #ifndef SPROUT_WORKAROUND_HPP

View file

@ -23,15 +23,17 @@ def main():
parser.add_option('--clang_version', type='string', default='.')
parser.add_option('--gcc_root', type='string', default='/usr/local')
parser.add_option('--clang_root', type='string', default='/usr/local')
parser.add_option('--compile_options', type='string', default='')
parser.add_option('--all_options', type='string', default='')
parser.add_option('--test_cpp', type='string')
parser.add_option('--serialized_std_options', type='string', default='{}')
parser.add_option('--serialized_compiler_specific_options', type='string', default='{}')
parser.add_option('--serialized_version_specific_options', type='string', default='{}')
parser.add_option('--max_procs', type='int', default=0)
(opts, args) = parser.parse_args()
std_options = eval(opts.serialized_std_options)
version_specific_options = eval(opts.serialized_version_specific_options)
compiler_specific_options = eval(opts.serialized_compiler_specific_options)
def format_command(name, version, root):
base = "%s-%s" % (name, version) if version != "." else name
@ -40,11 +42,13 @@ def main():
execute_log = "%s/test.%s.execute.log" % (opts.stagedir, base.replace('.', ''))
compiler = "%s/%s/bin/%s++" % (root, base, name.rstrip('c')) if version != "." else "%s++" % name.rstrip('c')
return "%s -o %s" \
" %s %s %s" \
" %s %s" \
" %s %s" \
" %s > %s 2>&1" \
" && %s > %s 2>&1" \
% (compiler, bin,
std_options.get(base, ''), opts.compile_options, version_specific_options.get(base, ''),
std_options.get(base, ''), opts.all_options,
compiler_specific_options.get(name, ''), version_specific_options.get(base, ''),
opts.test_cpp, compile_log,
bin, execute_log
)
@ -54,11 +58,13 @@ def main():
build,
[format_command('gcc', version, opts.gcc_root)
for version in opts.gcc_version.split(' ')
]
] if opts.gcc_version != ' '
else []
+
[format_command('clang', version, opts.clang_root)
for version in opts.clang_version.split(' ')
]
] if opts.clang_version != ' '
else []
))
if __name__ == "__main__":

View file

@ -21,6 +21,8 @@ force=0
use_help=0
std="c++11"
declare -a common_options=()
declare -a compiler_options=()
declare -A compiler_specific_options=()
declare -a version_options=()
declare -A version_specific_options=(
# [clang-3.3]='-ftemplate-depth=512'
@ -53,7 +55,7 @@ get_std_option() {
fi
}
args=`getopt -o S:g:c:O:V:D:I:P:f -l stagedir:,gcc-version:,clang-version:,gcc-root:,clang-root:,std:,option:,version-option:,define:,include:,max-procs:,force,help -- "$@"`
args=`getopt -o S:g:c:O:C:V:D:I:P:f -l stagedir:,gcc-version:,clang-version:,gcc-root:,clang-root:,std:,option:,compiler-option:,version-option:,define:,include:,max-procs:,force,help -- "$@"`
if [ "$?" -ne 0 ]; then
echo >&2 "error: options parse error. See 'test.sh --help'"
exit 1
@ -68,6 +70,7 @@ while [ -n "$1" ]; do
--clang-root) clang_root="$2"; shift 2;;
--std) std="$2"; shift 2;;
-O|--option) common_options=("${common_options[@]}" "$2"); shift 2;;
-C|--compiler-option) compiler_options=("${compiler_options[@]}" "$2"); shift 2;;
-V|--version-option) version_options=("${version_options[@]}" "$2"); shift 2;;
-D|--define) user_macros=("${user_macros[@]}" "$2"); shift 2;;
-I|--include) include_paths=("${include_paths[@]}" "$2"); shift 2;;
@ -104,6 +107,9 @@ if [ ${use_help} -ne 0 ]; then
echo ""
echo " -O, --option=<opt> Add compile option."
echo ""
echo " -C, --compiler-option=<opt> Add compiler specific compile option."
echo " Example; 'clang -ftemplate-depth=512'"
echo ""
echo " -V, --version-option=<opt> Add version specific compile option."
echo " Example; 'clang-3.3 -ftemplate-depth=512'"
echo ""
@ -129,6 +135,7 @@ echo " gcc-root = '${gcc_root}'"
echo " clang-root = '${clang_root}'"
echo " std = '${std}'"
echo " common-options = (${common_options[*]})"
echo " compiler-options = (${compiler_options[*]})"
echo " version-options = (${version_options[*]})"
echo " user-macros = (${user_macros[*]})"
echo " include-paths = (${include_paths[*]})"
@ -141,7 +148,7 @@ done
for include_path in ${include_paths}; do
include_options="${include_options} -I${include_path}"
done
compile_options="-v -Wall -pedantic ${define_options} ${include_options} ${common_options[*]}"
all_options="-v -Wall -pedantic ${define_options} ${include_options} ${common_options[*]}"
vo=0
vkey=""
for option in ${version_options}; do
@ -204,12 +211,12 @@ if [ -z "${max_procs}" ]; then
fail_count=0
for version in ${gcc_version}; do
std_option=`get_std_option "gcc" "${version}" "${std}"`
compile "gcc" "${version}" "${test_cpp}" "${std_option} ${compile_options}" "${gcc_root}"
compile "gcc" "${version}" "${test_cpp}" "${std_option} ${all_options} ${compiler_specific_options[gcc]}" "${gcc_root}"
let fail_count=${fail_count}+$?
done
for version in ${clang_version}; do
std_option=`get_std_option "clang" "${version}" "${std}"`
compile "clang" "${version}" "${test_cpp}" "${std_option} ${compile_options}" "${clang_root}"
compile "clang" "${version}" "${test_cpp}" "${std_option} ${all_options} ${compiler_specific_options[clang]}" "${clang_root}"
let fail_count=${fail_count}+$?
done
if [ ${fail_count} -ne 0 ]; then
@ -220,6 +227,12 @@ if [ -z "${max_procs}" ]; then
else
echo " processing in parallel mode."
echo -n " "
serialized_compiler_specific_options={`
for key in $(echo ${!compiler_specific_options[*]}); do
echo \'${key}\':\'${compiler_specific_options[${key}]}\',
done
echo \'_\':\'\'
`}
serialized_version_specific_options={`
for key in $(echo ${!version_specific_options[*]}); do
echo \'${key}\':\'${version_specific_options[${key}]}\',
@ -251,8 +264,9 @@ else
"--stagedir=${stagedir}" \
"--gcc_version=${gcc_version}" "--clang_version=${clang_version}" \
"--gcc_root=${gcc_root}" "--clang_root=${clang_root}" \
"--compile_options=${compile_options}" "--test_cpp=${test_cpp}" \
"--all_options=${all_options}" "--test_cpp=${test_cpp}" \
"--serialized_std_options=${serialized_std_options}" \
"--serialized_compiler_specific_options=${serialized_compiler_specific_options}" \
"--serialized_version_specific_options=${serialized_version_specific_options}" \
"--max_procs=${max_procs}"
fail_count=$?