From 5cb895f465fbd198a6a36d55fdafde9839d14d83 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Tue, 30 Apr 2019 22:25:45 -0400 Subject: [PATCH] add gen_large_project rake task for testing rscons performance on a large project --- .gitignore | 1 + Rakefile.rb | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/.gitignore b/.gitignore index f348116..ab10117 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ /doc/ /pkg/ /test/ +/large_project/ diff --git a/Rakefile.rb b/Rakefile.rb index b047d5f..b0d20fe 100644 --- a/Rakefile.rb +++ b/Rakefile.rb @@ -41,4 +41,50 @@ YARD::Rake::YardocTask.new do |yard| yard.files = ['lib/**/*.rb'] end +task :gen_large_project, [:size] => :build_dist do |task, args| + size = (args.size || 1000).to_i + FileUtils.rm_rf("large_project") + FileUtils.mkdir_p("large_project/src") + size.times do |i| + File.open("large_project/src/fn#{i}.c", "w") do |fh| + fh.puts(<<-EOF) + int fn#{i}(void) + { + return #{i}; + } + EOF + end + File.open("large_project/src/fn#{i}.h", "w") do |fh| + fh.puts %[int fn#{i}(void);] + end + end + File.open("large_project/src/main.c", "w") do |fh| + size.times do |i| + fh.puts %[#include "fn#{i}.h"] + end + fh.puts <<-EOF + int main(int argc, char * argv[]) + { + int result = 0; + EOF + size.times do |i| + fh.puts %[result += fn#{i}();] + end + fh.puts <<-EOF + return result; + } + EOF + end + File.open("large_project/Rsconscript", "w") do |fh| + fh.puts < :spec