add unit test for a simple fortran project
This commit is contained in:
parent
d325282a76
commit
340f47b9cb
7
test/fortran/cmake/autocmake.cfg
Normal file
7
test/fortran/cmake/autocmake.cfg
Normal 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']
|
1
test/fortran/src/CMakeLists.txt
Normal file
1
test/fortran/src/CMakeLists.txt
Normal file
@ -0,0 +1 @@
|
||||
add_executable(example example.f90)
|
4
test/fortran/src/example.f90
Normal file
4
test/fortran/src/example.f90
Normal file
@ -0,0 +1,4 @@
|
||||
program example
|
||||
implicit none
|
||||
print *, 'Hello World!'
|
||||
end program
|
14
test/test.py
14
test/test.py
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user