[graalvm-users] Testing polyglot libs

Gilles Duboscq gilles.m.duboscq at oracle.com
Thu Jun 14 09:16:28 PDT 2018


See below regarding native images:

On 14/06/18 17:55, Chris Seaton wrote:
> It sounds like you are trying the correct things, and thanks for your perseverance and questions.
> 
>> On 14 Jun 2018, at 16:25, Rodrigo Botafogo <rodrigo.a.botafogo at gmail.com> wrote:
>>
>> Hello,
>>
>> I'm trying to set up testing for my polyglot lib and I'm having a hard time.  Sorry if I should post somewhere else...
>>
>> So I tried to test with rspec, but rspec will run ruby somehow and does not pass to ruby the --polyglot --jvm flags.
> 
> You should be able to run `--polyglot --native` if you rebuild the ruby image after installing both R and Ruby, by running `gu rebuild-images ruby`.

If you need polyglot as well, it's good to also rebuilt it by adding it to the rebuild-images command:
`gu rebuild-images ruby polyglot`

However, in your specific case (using R) it might be best to stick to --jvm mode as R is not integrated into the polyglot native image by default.
(if you're adventurous you can add "R" to the `supported_languages` list in `jre/lib/svm/bin/rebuild-images` but that's not tested at all!!)

 Gilles

> 
>> Polyglot complains that R is not a known language.  I've googled around and could not find an easy way to make rspec pass flags to ruby.  
> 
> How are you running RSpec? Are you using `bundle` or `rake`?
> 
> Can you run `ruby --polyglot --jvm -S rspec`?
> 
> Or there is the environment variable `TRUFFLERUBYOPT` - try putting `--jvm --polyglot` into that, like `TRUFFLERUBYOPT='--jvm --polyglot' rspec`.
> 
>> Next I tried minitest, since in this case I call ruby directly with the required flags... but polyglot complains that R cannot execute in multithreaded,
> 
> I’m afraid this is a limitation of FastR at the moment - it just doesn’t support multiple threads. GraalJS also does not support multiple threads.
> 
>> so I passed -Xsingle_threaded to ruby and minitest complains that it only runs in a multithreaded environment.
> 
> Can you somehow run minitest without it trying to create threads? What does it use the threads for? And what does its complaint look like?
> 
>> Any suggestions how to move forward?
>>
>>
>> Thanks
>>
>>
>>
>>
>> -- 
>> Rodrigo Botafogo
>> _______________________________________________
>> GraalVM-Users mailing list
>> GraalVM-Users at oss.oracle.com
>> https://oss.oracle.com/mailman/listinfo/graalvm-users
> 
> 
> _______________________________________________
> GraalVM-Users mailing list
> GraalVM-Users at oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/graalvm-users
> 



More information about the GraalVM-Users mailing list