...
- fruit.f90 - fruit source code
- mod - directory used to store .mod files
- <your_module>.f90 - your actual module
- <your_module>_test.f90 - file with unit tests for your module
- fruit_geneator.rb - script used to generate test driver and basket files
- Makefile - used to compile and run all tests
Prepare environment
You will need to load module 'ruby' to use auto-generating scripts.
Code Block |
---|
module load ruby
module load itm-gcc/7.3.0 #gcc is needed to build ruby libraries |
Install requirements
FRUIT source code
Code Block |
---|
cd <project_dir>/test
wget https://raw.githubusercontent.com/mortele/FRUIT/master/src/fruit.f90 |
Info | ||
---|---|---|
| ||
While compiling fruit.f90 an error "Logicals must be compared with .eqv. instead of .eq." may occure. In this case you will need to modify fruit.f90 lines 912 and 913 editing ".eq." to ".eqv.". This step is needed to be done only once, during first run. You can try to compile fruit.f90 at this step by calling gfortran compiler: |
...
Rake
Code Block |
---|
sudogem install aptrake --user-install |
You will need to add gem to PATH in order to run gem packages.
Code Block |
---|
cd ~ nano .bashrc #add line at the end of ruby-full ruby --version |
Rake
file
export PATH="~/.gem/ruby/3.1.0/bin:$PATH"
#ctrl + O to save file
#ctrl + X to exit nano
source ~/.bashrc |
Bundler
Code Block |
---|
gem install bundler --user-install
gem install json --user-install |
Code Block |
sudo gem install rake |
Fruit_processor_gem
Download fruit_
...
This could be downloaded to any location, just to install additional ruby package.
...
processor_gem
NOTE: you You will need to download whole repository and extract fruit_processor_gem, or download one folder from github online editor.
To download one folder:
- Open in your browser https://github.dev/mortele/FRUIT/tree/master/fruit_processor_gem
- Login if asked
- Right click fruit_processor_gem directory on the project explorer panel and click download
To download whole repository:
and install ruby gem. It is used to auto-detect test files and generate test drivers.
You will install it only once and it will apply to any project where you use it.
Code Block |
---|
cd <somewhere outside project>
git clone --recursive |
Code Block |
git clone https://github.com/mortele/FRUIT |
Install fruit_
...
processor_gemcd fruit_pr
Code Block |
---|
cd ./fruit_processor_gem #or cd FRUIT/fruit_processor_gem sudo rake install |
rake_base.rb
You will need to download rake_base.rb file from FRUIT repository in order to run fruit_generator script. You will never modify it's content.
...
This is file with build instruction. You will not have to nanoto modify it unless you stick to project structure. Just copy it's content and save as Makefile in <project_dir>/test directory.
Code Block |
---|
#file <project_dir>/test/Makefile
compiler=gfortran
option=-Wall -Wtabs -Wextra -Wno-tabs -pedantic -fbounds-check -Wuninitialized -O -g \
-Wno-unused-parameter -cpp
fruit_code = ./fruit.f90
code = ../src/*.f90 ./*_test.f90
code_gen = fruit_basket_gen.f90 fruit_driver_gen.f90
all_code = $(fruit_code) $(code) $(code_gen)
driver = fruit_driver
all : build run
build : $(driver)
fruit_basket_gen.f90 : $(code)
ruby fruit_generator.rb
fruit_driver_gen.f90 : $(code)
ruby fruit_generator.rb
fruit_driver : $(all_code)
$(compiler) $(option) $(all_code) -J ../mod -o fruit_driver
clean :
rm -f *.o *.mod *.obj fruit_driver
rm -f fruit_driver_gen.f90
rm -f fruit_basket_gen.f90
rm -f result.xml result_tmp.xml
run : $(driver)
./$(driver)
.PHONY : all clean run |
...
Code Block |
---|
cd <project_dir>/test make |
NOTE: While compiling fruit.f90 an error "Logicals must be compared with .eqv. instead of .eq." may occure. In this case you will need to modify fruit.f90 lines 912 and 913 editing ".eq." to ".eqv.". This step is needed to be done only once, during first run.