add unit test for a simple fortran project

This commit is contained in:
Radovan Bast 2015-06-01 15:49:13 +02:00
parent d325282a76
commit 340f47b9cb
4 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,7 @@
[project]
name: example
[fortran]
source: https://github.com/scisoft/autocmake/raw/master/modules/UseFortran.cmake
docopt: --fc=<FC> Fortran compiler [default: gfortran].
export: 'FC=%s' % arguments['--fc']

View File

@ -0,0 +1 @@
add_executable(example example.f90)

View File

@ -0,0 +1,4 @@
program example
implicit none
print *, 'Hello World!'
end program

View File

@ -24,3 +24,17 @@ def test_cxx():
stdout, stderr = exe('make')
stdout, stderr = exe('./bin/example')
assert 'Hello World!' in stdout
#-------------------------------------------------------------------------------
def test_fortran():
os.chdir(os.path.join(HERE, 'fortran', 'cmake'))
stdout, stderr = exe('wget https://github.com/scisoft/autocmake/raw/master/bootstrap.py')
stdout, stderr = exe('python bootstrap.py --update')
stdout, stderr = exe('python bootstrap.py ..')
os.chdir(os.path.join(HERE, 'fortran'))
stdout, stderr = exe('python setup.py --fc=gfortran')
os.chdir(os.path.join(HERE, 'fortran', 'build'))
stdout, stderr = exe('make')
stdout, stderr = exe('./bin/example')
assert 'Hello World!' in stdout