ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: "jaruga (Jun Aruga)" <noreply@ruby-lang.org>
To: ruby-core@neon.ruby-lang.org
Subject: [ruby-core:110881] [Ruby master Misc#19149] Minimal covered tests with the --enable-yjit case?
Date: Thu, 24 Nov 2022 16:26:56 +0000 (UTC)	[thread overview]
Message-ID: <redmine.issue-19149.20221124162655.11018@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-19149.20221124162655.11018@ruby-lang.org

Issue #19149 has been reported by jaruga (Jun Aruga).

----------------------------------------
Misc #19149: Minimal covered tests with the --enable-yjit case?
https://bugs.ruby-lang.org/issues/19149

* Author: jaruga (Jun Aruga)
* Status: Open
* Priority: Normal
----------------------------------------
In the [Fedora Ruby's RPM recipe file](https://src.fedoraproject.org/rpms/ruby/blob/rawhide/f/ruby.spec), we were running the commands below.

```
$ ./autogen.sh
$ ./configure ...
$ make
$ make check
```

## What is the minimal covered tests?

Now the we want to add the `--enable-yjit` option. Could you tell me what is the minimal covered test commands in the `--enable-yjit` case?

```
$ ./autogen.sh
$ ./configure --enable-yjit ...
$ make
$ ??
```

Then do we need to run the `make check` 2 times with both with yjit and without yjit as follows? The yjit command options `--yjit-call-threshold=1 --yjit-verify-ctx` comes from the <https://github.com/ruby/ruby/blob/d2fa67de81f66cb42cfeebc81a03c57a4621c09a/.github/workflows/yjit-ubuntu.yml#L59>.

```
$ make check
$ make check RUN_OPTS="--yjit-call-threshold=1 --yjit-verify-ctx"
```

Or is it good enough to run the `make check` and the specific tests with the yjit options as follows?

```
$ make check
$ make test-all RUN_OPTS="--yjit-call-threshold=1 --yjit-verify-ctx" TESTS="test/ruby/{test_yjit_exit_locations.rb,test_yjit.rb}"
```

Or is it good enough to run the `make check` with the YJIT options as follows?

```
$ make check RUN_OPTS="--yjit-call-threshold=1 --yjit-verify-ctx"
```

## YJIT command options

Could you explain why the command options `--yjit-call-threshold=1 --yjit-verify-ctx` above is better to test the YJIT cases rather than just `--yjit`?

## Ideal situation

I want to see the just running `make check` covers necessary cases in YJIT. Because it is convenience, and I think users tend to be satisfied with only running the `make check`. What do you think?

```
$ ./autogen.sh
$ ./configure --enable-yjit ...
$ make
$ make check
```

I tried to inject the YJIT command options in a test file for that. Perhaps it might be like this. But so far I am not succeeded.

```
diff --git a/test/lib/jit_support.rb b/test/lib/jit_support.rb
index 26f8542dc2..3fce402e32 100644
--- a/test/lib/jit_support.rb
+++ b/test/lib/jit_support.rb
@@ -69,8 +69,10 @@ def supported?
   end
 
   def yjit_supported?
+    return @yjit_supported if defined?(@yjit_supported)
     # e.g. x86_64-linux, x64-mswin64_140, x64-mingw32, x64-mingw-ucrt
-    RUBY_PLATFORM.match?(/^(x86_64|x64|arm64|aarch64)-/)
+    @yjit_supported = RbConfig::CONFIG["YJIT_SUPPORT"] != 'no' &&
+      RUBY_PLATFORM.match?(/^(x86_64|x64|arm64|aarch64)-/)
   end
 
   def remove_mjit_logs(stderr)
diff --git a/test/ruby/test_yjit.rb b/test/ruby/test_yjit.rb
index 9ab058d97b..10c8e3b891 100644
--- a/test/ruby/test_yjit.rb
+++ b/test/ruby/test_yjit.rb
@@ -8,7 +8,7 @@
 require 'tmpdir'
 require_relative '../lib/jit_support'
 
-return unless defined?(RubyVM::YJIT) && RubyVM::YJIT.enabled?
+return unless JITSupport.yjit_supported?
 
 # Tests for YJIT with assertions on compilation and side exits
 # insipired by the MJIT tests in test/ruby/test_mjit.rb
```




-- 
https://bugs.ruby-lang.org/

       reply	other threads:[~2022-11-24 16:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-24 16:26 jaruga (Jun Aruga) [this message]
2022-11-24 18:26 ` [ruby-core:110883] [Ruby master Misc#19149] Minimal covered tests with the --enable-yjit case? maximecb (Maxime Chevalier-Boisvert)
2022-11-25 10:41 ` [ruby-core:111008] " jaruga (Jun Aruga)
2022-11-25 15:22 ` [ruby-core:111009] " jaruga (Jun Aruga)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.issue-19149.20221124162655.11018@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    --cc=ruby-core@neon.ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).