Commit a2042a432c4419e9466696c052b37fa149b99ad0

Thomas de Grivel 2023-02-21T10:59:27

test

diff --git a/bin/rbpkg b/bin/rbpkg
index 3b5c6d1..9ec8cfd 100755
--- a/bin/rbpkg
+++ b/bin/rbpkg
@@ -22,9 +22,9 @@ Source directory commands :
 Build commands :
  configure        configure build for this system
  clean-configure  remove configure-done tag file
- build           .run parallel build
- clean-build     .remove object files
- test            -run tests
+ build            run parallel build
+ clean-build      remove object files
+ test             run tests
 
 Package commands : 
  fake            -install into fake installation directory
@@ -73,6 +73,8 @@ def rbpkg
     Rbpkg.build($ARGS)
   when "clean-build"
     Rbpkg.clean_build($ARGS)
+  when "test"
+    Rbpkg.test($ARGS)
   when "info"
     Rbpkg.info($ARGS)
   else
diff --git a/lib/rbpkg.rb b/lib/rbpkg.rb
index 7a5ca05..8f2a82e 100644
--- a/lib/rbpkg.rb
+++ b/lib/rbpkg.rb
@@ -173,6 +173,12 @@ module Rbpkg
   def self.target_dir
     "#{dir}/target/#{target}"
   end
+
+  def self.test(repos)
+    repos.each do |name|
+      Repos.repo(name).test()
+    end
+  end
 end
 
 def cmd(string)
diff --git a/lib/rbpkg/repo.rb b/lib/rbpkg/repo.rb
index fa41aad..426ee81 100644
--- a/lib/rbpkg/repo.rb
+++ b/lib/rbpkg/repo.rb
@@ -19,6 +19,7 @@ class Rbpkg::Repo
 
   def build
     if ! tag_present?("build-done")
+      configure()
       if File.file?("#{src_dir}/Makefile")
         cmd! "cd #{sh_quote(src_dir)} && make -j #{Rbpkg.ncpu}"
       elsif File.file?("#{src_dir}/CMakeLists.txt")
@@ -48,6 +49,8 @@ class Rbpkg::Repo
   end
 
   def clean_sources
+    tag_remove("build-done") if tag_present?("build-done")
+    tag_remove("configure-done") if tag_present?("configure-done")
     if File.directory?(src_dir)
       cmd! "rm -rf #{sh_quote(src_dir)}"
     end
@@ -181,6 +184,17 @@ class Rbpkg::Repo
     File.write(tag_path(tag), "#{Rbpkg.date}\n")
   end
 
+  def test
+    build()
+    if File.file?("#{src_dir}/Makefile")
+      cmd! "cd #{sh_quote(src_dir)} && make #{sh_quote(test_make_rule)}"
+    end
+  end
+
+  def test_make_rule
+    "test"
+  end
+
   def version
     if File.directory?(src_dir)
       "#{head}-#{hash}"