fUnit 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/{LICENSE → COPYING} +21 -21
- data/README +26 -2
- data/Rakefile +97 -0
- data/docs/html/classes/Funit.html +390 -0
- data/docs/html/classes/Funit/Assertions.html +285 -0
- data/docs/html/classes/Funit/Compiler.html +160 -0
- data/docs/html/classes/Funit/Depend.html +441 -0
- data/docs/html/classes/Funit/TestSuite.html +417 -0
- data/docs/html/created.rid +1 -0
- data/docs/html/files/COPYING.html +563 -0
- data/docs/html/files/README.html +151 -0
- data/docs/html/files/lib/funit/assertions_rb.html +101 -0
- data/docs/html/files/lib/funit/fortran_deps_rb.html +107 -0
- data/docs/html/files/lib/funit/functions_rb.html +101 -0
- data/docs/html/files/lib/funit/test_suite_rb.html +101 -0
- data/docs/html/files/lib/funit_rb.html +111 -0
- data/docs/html/fr_class_index.html +31 -0
- data/docs/html/fr_file_index.html +33 -0
- data/docs/html/fr_method_index.html +59 -0
- data/docs/html/index.html +24 -0
- data/docs/html/rdoc-style.css +208 -0
- data/examples/CFD/FluxFunctions.f90 +35 -0
- data/examples/CFD/FluxFunctionsMT.f90 +336 -0
- data/examples/CFD/FluxFunctionsMT.ftk +49 -0
- data/examples/CFD/Gammas.f90 +8 -0
- data/examples/CFD/GasModel.f90 +17 -0
- data/examples/CFD/GasModelMT.f90 +173 -0
- data/examples/CFD/GasModelMT.ftk +22 -0
- data/examples/CFD/TestRunner +0 -0
- data/examples/CFD/TestRunner.f90 +23 -0
- data/examples/CFD/fluxfunctions.mod +45 -0
- data/examples/CFD/gammas.mod +20 -0
- data/examples/CFD/gasmodel.mod +30 -0
- data/examples/CFD/gasmodelmt.mod +27 -0
- data/examples/StopWatch/StopWatch.f90 +50 -0
- data/examples/StopWatch/StopWatchMT.f90 +343 -0
- data/examples/StopWatch/StopWatchMT.ftk +73 -0
- data/examples/StopWatch/TestRunner +0 -0
- data/examples/StopWatch/TestRunner.f90 +23 -0
- data/examples/StopWatch/stopwatch.mod +34 -0
- data/examples/StopWatch/stopwatchmt.mod +27 -0
- data/lib/funit.rb +1 -6
- data/lib/funit/fortran_deps.rb +112 -0
- data/lib/funit/functions.rb +2 -5
- data/tests/tc_fortran_deps.rb +2 -2
- metadata +73 -22
- data/INSTALL +0 -19
- data/lib/fortran_deps.rb +0 -109
data/INSTALL
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
Prerequisites
|
2
|
-
-------------
|
3
|
-
|
4
|
-
1) A Fortran 90/95/2003 compiler.
|
5
|
-
|
6
|
-
2) The Ruby language -- see http://www.ruby-lang.org/
|
7
|
-
|
8
|
-
3) RubyGems package manager -- see http://rubyforge.org/projects/rubygems/
|
9
|
-
|
10
|
-
|
11
|
-
Installation
|
12
|
-
------------
|
13
|
-
|
14
|
-
gem install funit
|
15
|
-
|
16
|
-
|
17
|
-
At some point, we plan to make installation easier by creating
|
18
|
-
a single executable with Erik Veenstra's RubyScript2Exe
|
19
|
-
<http://www.erikveen.dds.nl/rubyscript2exe/>.
|
data/lib/fortran_deps.rb
DELETED
@@ -1,109 +0,0 @@
|
|
1
|
-
# This scripts finds dependencies for f90 code
|
2
|
-
|
3
|
-
raise "Need Ruby version >= 1.8, current using #{VERSION}" unless String.instance_methods.include? "match"
|
4
|
-
|
5
|
-
class Depend
|
6
|
-
|
7
|
-
attr_reader :file_dependencies, :source_files
|
8
|
-
|
9
|
-
def initialize( searchPath = %w[ ../lib . ] )
|
10
|
-
@parsed = Array.new
|
11
|
-
@hash = build_hash_of_modules_in_files_within searchPath
|
12
|
-
@file_dependencies = Hash.new
|
13
|
-
@source_files = Array.new
|
14
|
-
end
|
15
|
-
|
16
|
-
def modules_used_in( file )
|
17
|
-
modules = IO.readlines( file ).map do |line|
|
18
|
-
$1.downcase if line.match( /^\s*use\s+(\w+)/i )
|
19
|
-
end.uniq.compact
|
20
|
-
end
|
21
|
-
|
22
|
-
def modules_defined_in( file )
|
23
|
-
modules = IO.readlines( file ).map do |line|
|
24
|
-
$1.downcase if line.match( /^\s*module\s+(\w+)/i )
|
25
|
-
end.uniq.compact
|
26
|
-
end
|
27
|
-
|
28
|
-
def build_dictionary_of_modules_in( files )
|
29
|
-
file_containing_module = Hash.new
|
30
|
-
files.each do |file|
|
31
|
-
modules_defined_in( file ).each{ |mod| file_containing_module[mod]=file }
|
32
|
-
end
|
33
|
-
file_containing_module
|
34
|
-
end
|
35
|
-
|
36
|
-
def fortran_files_within( search_path = %w[ ../lib . ] )
|
37
|
-
source = search_path.map{ |path| Dir[path+"/*.[fF]90"] }
|
38
|
-
source.flatten!.uniq!
|
39
|
-
source.delete_if{ |file| File.lstat(file).symlink? }
|
40
|
-
source.delete_if{ |file| file.match(/lmpi_module_template.F90/) }
|
41
|
-
end
|
42
|
-
|
43
|
-
def build_hash_of_modules_in_files_within( searchPath = %w[../lib .] )
|
44
|
-
build_dictionary_of_modules_in( fortran_files_within( searchPath ) )
|
45
|
-
end
|
46
|
-
|
47
|
-
def makefile_dependency_line( source )
|
48
|
-
realSource = source.sub(/PHYSICS_DUMMY/,'PHYSICS_MODULES')# What's this?
|
49
|
-
sourceNoPath = File.basename source
|
50
|
-
@source_files.push sourceNoPath.gsub(%r|^.*/|,'')
|
51
|
-
output = ''
|
52
|
-
if (File.expand_path(source) != File.expand_path(sourceNoPath))
|
53
|
-
output += sourceNoPath+ ": " + realSource + "\n"
|
54
|
-
output += "\tln -sf "+realSource+" .\n"
|
55
|
-
end
|
56
|
-
output += source.gsub(/\.(f|F)90$/, ".o").gsub(%r|^.*/|,"" ) +
|
57
|
-
": " + source.gsub(%r|^.*/|,"" )
|
58
|
-
modules_used_in( source ).each do |use|
|
59
|
-
unless @hash[use]
|
60
|
-
unless ( use=~/f90_unix/ || use=~/nas_system/ )
|
61
|
-
$stderr.puts "Warning: unable to locate module #{use} used in #{source}." \
|
62
|
-
if $DEBUG
|
63
|
-
end
|
64
|
-
next
|
65
|
-
end
|
66
|
-
output = output + " \\\n " +
|
67
|
-
@hash[use].gsub(/\.(f|F)90$/, ".o").gsub(%r|^.*/|,"" )
|
68
|
-
end
|
69
|
-
output+"\n"
|
70
|
-
end
|
71
|
-
|
72
|
-
def dependencies( start )
|
73
|
-
modules = modules_used_in( start )
|
74
|
-
@parsed = @parsed || [start]
|
75
|
-
newSourceFiles = modules.collect{ |mod| @hash[mod] }.compact
|
76
|
-
makefile_dependency_line(start) +
|
77
|
-
newSourceFiles.collect do |file|
|
78
|
-
next if @parsed.include?(file)
|
79
|
-
@parsed.push file
|
80
|
-
dependencies file
|
81
|
-
end.to_s
|
82
|
-
end
|
83
|
-
|
84
|
-
def source_file_dependencies( head_f90 )
|
85
|
-
modules_head_uses = modules_used_in( head_f90 )
|
86
|
-
required_f90s = modules_head_uses.map{ |mod| @hash[mod] }.compact
|
87
|
-
@file_dependencies[head_f90] = required_f90s
|
88
|
-
required_f90s.each do |required_f90|
|
89
|
-
next if @parsed.include?(required_f90)
|
90
|
-
source_file_dependencies( required_f90 )
|
91
|
-
end
|
92
|
-
@parsed.push head_f90
|
93
|
-
end
|
94
|
-
|
95
|
-
def required_source_files( head_f90 )
|
96
|
-
@parsed.clear
|
97
|
-
source_file_dependencies( head_f90 )
|
98
|
-
sources = Array.new
|
99
|
-
while !@file_dependencies.empty? do
|
100
|
-
no_dependents_pair = @file_dependencies.detect{ |h,d| d == [] }
|
101
|
-
no_dependents = no_dependents_pair.first
|
102
|
-
sources.push no_dependents
|
103
|
-
@file_dependencies.delete(no_dependents){ |el| "#{el} not found" }
|
104
|
-
@file_dependencies.each_value{ |deps| deps.delete(no_dependents) }
|
105
|
-
end
|
106
|
-
sources
|
107
|
-
end
|
108
|
-
|
109
|
-
end
|