Skip to content

Commit

Permalink
Add --force options + tests (issue #7)
Browse files Browse the repository at this point in the history
  • Loading branch information
clementval committed Feb 1, 2016
1 parent af53805 commit 70082de
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 13 deletions.
21 changes: 15 additions & 6 deletions driver/bin/clawfc.in
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ STOP_TRANSLATOR=false
STOP_BACKEND=false
STOP_COMPILE=false
STOP_DEPENDENCIES=false
FORCE_TRANSLATION=false

### Set options ###
# e.g.) clawfc -I/usr/lib a.f b.F c.f90 d.F90 e.o --tmp --Wlfoo lib.a -omp -o a.out
Expand Down Expand Up @@ -104,22 +105,30 @@ omni_set_trap
for file in "${f_files[@]}"
do
FILE=("${file}")
NUM_DIRECTIVES=$(grep --count --ignore-case "!\$claw" "${FILE}")
if [ $NUM_DIRECTIVES = "0" ]
if ! [ $FORCE_TRANSLATION == true ]
then
echo "Warning: file ${FILE} does not contains any code transformation. Skip ..."
if [ "${#output_dir}" != "0" ]
NUM_DIRECTIVES=$(grep --count --ignore-case "!\$claw" "${FILE}")
if [ $NUM_DIRECTIVES = "0" ]
then
cp ${FILE} ${output_dir}/${FILE}
echo "Warning: file ${FILE} does not contains any code transformation. Skip ..."
if [ "${#output_dir}" != "0" ]
then
cp ${FILE} ${output_dir}/${FILE}
else
cp ${FILE} ${output_file}
fi
else
cp ${FILE} ${output_file}
f_files_transformation+=("${FILE}")
fi
else
f_files_transformation+=("${FILE}")
fi
done


### TODO check if f_files_transformation has any files in ...


### Preprocessor ###
[ $ONLY_PP = true -a -f "${output_file}" ] && omni_exec rm "${output_file}"
[ $ENABLE_CPP = true ] && OMNI_FPP_OPT="$OMNI_FPP_OPT $CPP_OPT"
Expand Down
5 changes: 4 additions & 1 deletion driver/libexec/claw_f_lib.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ CLAW Fortran compiler options:
--version : print version.
-h,--help : print usage.
--show-env : show environment variables.
--no-dep : don't generate .mod or .xmod file for dependencies
--no-dep : don't generate .mod or .xmod file for dependencies.
-f,--force : forece the translation of files without directives.
--tmp : output parallel code (__omni_tmp__<file>).
--dry : only print processing status (not compile).
--debug : save intermediate files in __omni_tmp__.
Expand Down Expand Up @@ -116,6 +117,8 @@ function claw_f_set_parameters()
claw_f_print_help `basename $0`; exit 0;;
--show-env)
claw_f_show_env; exit 0;;
-f|--force)
FORCE_TRANSLATION=true;;
--no-dep)
RESOLVE_DEPENDENCIES=false;;
--tmp)
Expand Down
1 change: 1 addition & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ add_subdirectory(loops)
add_subdirectory(fortran)
add_subdirectory(utilities)
add_subdirectory(openacc)
add_subdirectory(options)
2 changes: 1 addition & 1 deletion test/base_test.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ endif()
# Create intermediate representation in XcodeML Fortran format
add_custom_command(
OUTPUT ${OUTPUT_FILE}
COMMAND ${CLAWFC} --debug -J ${XMOD_DIR} --Wx-d -o ${OUTPUT_FILE} ${ORIGINAL_FILE}
COMMAND ${CLAWFC} ${OPTIONAL_FLAGS} --debug -J ${XMOD_DIR} --Wx-d -o ${OUTPUT_FILE} ${ORIGINAL_FILE}
DEPENDS ${ORIGINAL_FILE}
COMMENT "Translating CLAW directive with ${CLAWFC}"
)
Expand Down
5 changes: 0 additions & 5 deletions test/openacc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
cmake_minimum_required(VERSION 2.8)

enable_language (Fortran)
enable_testing ()

add_subdirectory(continuation)
1 change: 1 addition & 0 deletions test/options/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
add_subdirectory(force)
3 changes: 3 additions & 0 deletions test/options/force/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
set(TEST_NAME force)
set(OPTIONAL_FLAGS "--force")
include(${CMAKE_SOURCE_DIR}/test/base_test.cmake)
4 changes: 4 additions & 0 deletions test/options/force/original_code.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
PROGRAM force_dummy
! dummy test
PRINT*, 'Dummy program for force option'
END PROGRAM force_dummy
5 changes: 5 additions & 0 deletions test/options/force/reference.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
PROGRAM force_dummy

PRINT * ,"Dummy program for force option"
END PROGRAM force_dummy

0 comments on commit 70082de

Please sign in to comment.