Skip to content

partest' jvm/natives.scala missbehave on non-intel arches #12099

Open
@judovana

Description

@judovana

On ppc64le or aarch64:
...
!! 31 - jvm/natives.scala
...
Other tests are ok.

reproduction steps

// ensure jdk8 is your jdk, with jdk11 the tesr may pass
wget https://piccolo.link/sbt-1.3.4.tgz
wget https://github.com/scala/scala/archive/v2.12.12.tar.gz
tar -xf sbt-1.3.4.tgz
tar -xf v2.12.12.tar.gz
pushd scala-2.12.12
bash ../sbt/bin/sbt partest
popd

problem

When partest is run by jdk8 on non intels, it download intel binaries.
I run scala on ppc64le and aarch64.
I'm not sure why the issue is not observable when run by jdk11, nor was lookng on what sbt is doing here.

Thanx for any hint!

Activity

eed3si9n

eed3si9n commented on Jul 28, 2020

@eed3si9n
Member

I'm not sure if this is much of a hint, but scala/test/files/jvm/natives.scala tests Java Native - https://github.com/scala/scala/blob/v2.12.12/test/files/jvm/natives.scala

  val libName =
    if (sysType == "Mac OS X")
      "natives"
    else
      "natives-" + sysWordSize

  System.loadLibrary(libName)

That means your build needs to build libnatives-64.so - https://github.com/scala/scala/blob/v2.12.12/test/files/jvm/mkLibNatives.sh. Make sure that part works.

judovana

judovana commented on Jul 28, 2020

@judovana
Author

Ok, that part clearly do not work.
There is clearly downlaoded file:
.../scala-partest/scala-2.12.12/test/files/jvm/libnatives-64.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped

Thanx for pointer. Will lookm ore to that mkLibNatives.sh

judovana

judovana commented on Jul 28, 2020

@judovana
Author

Seeing the cygwin/darwin resolution and seeing the CC_OPTIONS="-c -arch ppc -arch i386 -arch x86_64" makes me a bit worried...
I will try to re-dust my rotting.. no rusting:) ... C knowledge.

eed3si9n

eed3si9n commented on Jul 28, 2020

@eed3si9n
Member

Yes. There's libnatives-64.so pre-built and checked in to scala/scala, but it's x86-64. So I guess the test currently assumes you're on Intel. I have no idea why it would work on JDK 11 for you.

judovana

judovana commented on Jul 28, 2020

@judovana
Author

I see. Well using intel prebuild binary on non intell really sounds like a bug.
I also cinsider passing on jdk11 as bug. Very likely the jdk11 is failing to open the library, but the error is somehow surpassed.

lrytz

lrytz commented on Jul 29, 2020

@lrytz
Member

I really think this test is not worth the trouble it causes. On macOS you get

image

So I think we should remove it, and possibly replace it by a bytecode test in https://github.com/scala/scala/blob/2.13.x/test/junit/scala/tools/nsc/backend/jvm/BytecodeTest.scala

judovana

judovana commented on Jul 29, 2020

@judovana
Author

Oh gosh:)

judovana

judovana commented on Jul 29, 2020

@judovana
Author

I belive such a test should be around, although it is more Java test then scala test.
However this test should be skipped if there is no gcc/msvc.
And if there is, the native hsould be compiled. I dont know, but hope, that self compiled library would be ok on Mac.

judovana

judovana commented on Jul 29, 2020

@judovana
Author

Can I somehow run only the jvm/natives.scala or at least only jvm group?

lrytz

lrytz commented on Jul 29, 2020

@lrytz
Member
$ sbt
> partest test/files/jvm/natives.scala

But again, I really think asserting the bytecode structure would be the better way forward for testing this feature. Running native code is going to cause maintenance burden again and again, and I wouldn't like the team to spend time on this.

judovana

judovana commented on Jul 29, 2020

@judovana
Author

Eh.. that do not work... Not even files/jvm/natives.scala or jvm/natives.scala or natives.scala. Those I tried first. I addition the partest --help, as documented on readme.md is not working (or I'm misinterpreting it)

Any other dealing with this issue is up to scala team. I can fix the partest natives so it passes on nonintels (where running it alone would help) but I'm unable to write test asserting bytecode for you, You have gave me most of what I needed, and provided great support. Thank you. Crossing fingers to move on whatever you feel best for sacala. The issue can be closed now as wont fix, or wait until the test is removed/replaced/fixed.

lrytz

lrytz commented on Jul 29, 2020

@lrytz
Member

partest --help, as documented on readme.md is not working (or I'm misinterpreting it)

That's weird.. did you make sure to run it within the sbt console? If you pass it to sbt you'd need to add quotes

$ sbt "partest test/files/jvm/natives.scala"

otherwise sbt takes it as two commands.

I'll try to do the bytecode test soon. Having natives.scala fail is confusing contributors too many times.

self-assigned this
on Jul 29, 2020
judovana

judovana commented on Jul 29, 2020

@judovana
Author

Oh, the quotes did the job. Sorry for confusion. Readme.md is really not clear about it and sbt is not exactly wide-known tool.
Also the "partest --help" works, only it is longest wait for help ever:)
Tyvm, good luck with bytecode check.

added this to the Backlog milestone on Jul 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @lrytz@SethTisue@eed3si9n@judovana

      Issue actions

        partest' jvm/natives.scala missbehave on non-intel arches · Issue #12099 · scala/bug