On Sat, Apr 24, 2021 at 07:46:32PM +0200, Evgeni Golov wrote:
> Moin,
> 
> On Sat, Apr 17, 2021 at 10:20:45PM +0200, Paul Gevers wrote:
> > Librarian::Mock::Cli
> >   version
> > autopkgtest [04:30:22]: ERROR: timed out on command "su -s /bin/bash
> 
> poking around this…
> the tests pass fine as long the deb is not installed (so it's only
> running from the source checkout), and freeze instantly when it is.
> 
> (I can repro in a clean bullseye container, without autopkgtest/debci
> involved at all: rake -f debian/ruby-tests.rake)

So the issue is that when it runs the tests with the installed code, it
can't find the "root" of the project in [1] and tries to traverse in an
endless loop (as the original code assumes the tests are run in-tree).

Trivial patch that "fixes" it is the following:
diff --git lib/librarian/rspec/support/cli_macro.rb 
lib/librarian/rspec/support/cli_macro.rb
index 21ffb3f..2cf91e1 100644
--- lib/librarian/rspec/support/cli_macro.rb
+++ lib/librarian/rspec/support/cli_macro.rb
@@ -51,7 +51,7 @@ module Librarian
         def self.included(base)
           base.instance_exec do
             let(:project_path) do
-              project_path = Pathname.new(__FILE__).expand_path
+              project_path = Pathname.pwd.expand_path
               project_path = project_path.dirname until 
project_path.join("Rakefile").exist?
               project_path
             end


But I still find that super ugly and not sure it's the right approach
here.

[1] 
https://github.com/voxpupuli/librarian/blob/v0.6.4/lib/librarian/rspec/support/cli_macro.rb#L54-L55

Reply via email to