From 015e9af8440447cb06a11734025d79b624b48fb9 Mon Sep 17 00:00:00 2001 From: Miro ILIAS Date: Mon, 3 Aug 2015 20:15:19 +0200 Subject: [PATCH] simple fortran test for checking the generated "git_info.h" - with form according to Rado's order --- test/fc_gitinfo/cmake/autocmake.cfg | 14 ++++++++++++++ test/fc_gitinfo/src/CMakeLists.txt | 2 ++ test/fc_gitinfo/src/example.F90 | 11 +++++++++++ test/test.py | 5 +++++ 4 files changed, 32 insertions(+) create mode 100644 test/fc_gitinfo/cmake/autocmake.cfg create mode 100644 test/fc_gitinfo/src/CMakeLists.txt create mode 100644 test/fc_gitinfo/src/example.F90 diff --git a/test/fc_gitinfo/cmake/autocmake.cfg b/test/fc_gitinfo/cmake/autocmake.cfg new file mode 100644 index 0000000..dcdbc36 --- /dev/null +++ b/test/fc_gitinfo/cmake/autocmake.cfg @@ -0,0 +1,14 @@ +[project] +name: example + +[fc] +source: ../../../modules/fc.cmake + +[default_build_paths] +source: ../../../modules/default_build_paths.cmake + +[src] +source: ../../../modules/src.cmake + +[git] +source: ../../../modules/git_info/git_info.cmake diff --git a/test/fc_gitinfo/src/CMakeLists.txt b/test/fc_gitinfo/src/CMakeLists.txt new file mode 100644 index 0000000..04891bc --- /dev/null +++ b/test/fc_gitinfo/src/CMakeLists.txt @@ -0,0 +1,2 @@ +include_directories("${PROJECT_BINARY_DIR}") +add_executable(example example.F90) diff --git a/test/fc_gitinfo/src/example.F90 b/test/fc_gitinfo/src/example.F90 new file mode 100644 index 0000000..4e92fb6 --- /dev/null +++ b/test/fc_gitinfo/src/example.F90 @@ -0,0 +1,11 @@ +program example + implicit none + logical :: test_ok +! file generated on run-time +#include "git_info.h" + test_ok = len(GIT_COMMIT_HASH) > 0 .and. & + len(GIT_COMMIT_AUTHOR) > 0 .and. & + len(GIT_COMMIT_DATE) > 0 .and. & + len(GIT_BRANCH) > 0 + if (test_ok) print *,'Test OK!' +end program diff --git a/test/test.py b/test/test.py index ebb6556..ce579fb 100644 --- a/test/test.py +++ b/test/test.py @@ -132,6 +132,11 @@ def test_fc(): stdout, stderr = configure_build_and_exe('fc', 'python setup.py --fc=gfortran') assert 'Hello World!' in stdout + +def test_fc_gitinfo(): + stdout, stderr = configure_build_and_exe('fc_gitinfo', 'python setup.py --fc=gfortran') + assert 'Test OK!' in stdout + # ------------------------------------------------------------------------------