Subject: Re: bug#29187: flymake ruby and perl tests fail on rhel7.4

From: [email-masked] (João Távora)
Date: Wed, 08 Nov 2017 11:35:47 +0000

Glenn Morris <[email-masked]> writes:

> João Távora wrote:
>
>> Wow, subtle stuff. My ruby (2.3) doesn't crash. Does yours also fail if
>> you use a absolute path after -wc instead of a relative one?
>
> Still fails.
>
>> So I guess all that's missing is a fix to the ruby case. If the absolute
>> path doesn't fix it, I think we can fake a dummy HOME
>
> This works for me:
>

Thanks. Hmmm, trying to decide if this should be done just for the tests
or in the ruby backend in general. I lean towards your solution, since
this is appars to be a ruby bug anyway. WDYT?

>
> --- i/test/lisp/progmodes/flymake-tests.el
> +++ w/test/lisp/progmodes/flymake-tests.el
> @@ -120,11 +120,17 @@ flymake-tests--wait-for-backends
>  (ert-deftest ruby-backend ()
>    "Test the ruby backend"
>    (skip-unless (executable-find "ruby"))
> -  (flymake-tests--with-flymake ("test.rb")
> -    (flymake-goto-next-error)
> -    (should (eq 'flymake-warning (face-at-point)))
> -    (flymake-goto-next-error)
> -    (should (eq 'flymake-error (face-at-point)))))
> +  ;; Some versions of ruby fail if HOME doesn't exist (bug#29187).
> +  (let* ((tempdir (make-temp-file "flymake-tests-ruby" t))
> +         (process-environment (cons (format "HOME=%s" tempdir)
> +                                    process-environment)))
> +    (unwind-protect
> +        (flymake-tests--with-flymake ("test.rb")
> +          (flymake-goto-next-error)
> +          (should (eq 'flymake-warning (face-at-point)))
> +          (flymake-goto-next-error)
> +          (should (eq 'flymake-error (face-at-point))))
> +      (delete-directory tempdir t))))
>  
>  (ert-deftest different-diagnostic-types ()
>    "Test GCC warning via function predicate."