Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ported to Vita target #197

Merged
merged 10 commits into from
Apr 20, 2024
Merged

feat: ported to Vita target #197

merged 10 commits into from
Apr 20, 2024

Conversation

nikarh
Copy link
Contributor

@nikarh nikarh commented Apr 17, 2024

Fixes #160

Notes

  • signal-hook does not compile and won't work on Vita, pthread_kill is a stub in Vita newlib
  • Pipes in Vita newlib do not guarantee that after the write completes, the payload is immediately available on the other side of the pipe. This PR temporarily removes the NONBLOCK flag from the read side of the pipe when wait detects notified before polling

Copy link
Member

@notgull notgull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a test for this in CI? Just a cargo check would suffice.

Also, do you have a way of testing this on the actual Vita software?

src/poll.rs Outdated Show resolved Hide resolved
@nikarh
Copy link
Contributor Author

nikarh commented Apr 19, 2024

Can we add a test for this in CI? Just a cargo check would suffice.

Also, do you have a way of testing this on the actual Vita software?

Running tests requires an actual piece of hardware (no way to run in qemu, since Vita runs a proprietary OS that demands specific hardware). Cargo check though is absolutely doable, will add it.

Currently, I run tests on a physical device using cargo-vita tool which does these things in a single command:

  • Compiles rust test code and links it with VITASDK toolchain gcc to an ELF (this is essentially cargo build with a bunch of flags against the target, linker is defined in the target spec)
  • Transforms the usual ELF into Sony ELF (by calling a number of tools from VITASDK toolchain)
  • Uploads the Sony ELF to Vita via FTP (usually all devs who target Vita run a userspace module on the device that keeps an FTP server and a TCP command server)
  • Sends a "run this app" command to the TCP command server

At the same time, I run another plain text TCP socket server on my computer, and Vita runs a module that pipes stdin and stdout to that TCP socket, making it possible to see test results.

@nikarh nikarh requested a review from notgull April 19, 2024 08:59
@nikarh
Copy link
Contributor Author

nikarh commented Apr 19, 2024

Fixed the comment, added check to CI and enabled CI check for tier 3 nightly targets

Copy link
Member

@notgull notgull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm assuming the tests pass when you run it on actual hardware, right?

src/poll.rs Outdated Show resolved Hide resolved
@nikarh
Copy link
Contributor Author

nikarh commented Apr 20, 2024

I'm assuming the tests pass when you run it on actual hardware, right?

Yes, I run them on the actual hardware, and all of them pass (except for the many_connections due to fd limits on the system, but it also passes if I reduce 100 to 60)

Copy link
Member

@notgull notgull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! NetBSD failure looks spurious

@notgull notgull merged commit 9e46c84 into smol-rs:master Apr 20, 2024
25 of 26 checks passed
steps:
- uses: actions/checkout@v4
- name: Install Rust
run: rustup update stable
run: rustup update ${{ matrix.rust }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of adding +nightly to all cargo command calls, I recommended using && rustup default ${{ matrix.rust }} here.

notgull added a commit that referenced this pull request Apr 22, 2024
Previously in the "cross" CI job, checks would use "+nightly" to ensure
that the nightly compiler is used. However this adds a lot of noise. In
order to clean up CI this commit replaces "+nightly" with "rustup
default nightly" at the start of the job.

cc #197 (comment)

Signed-off-by: John Nunley <[email protected]>
notgull added a commit that referenced this pull request Apr 23, 2024
Previously in the "cross" CI job, checks would use "+nightly" to ensure
that the nightly compiler is used. However this adds a lot of noise. In
order to clean up CI this commit replaces "+nightly" with "rustup
default nightly" at the start of the job.

cc #197 (comment)

Signed-off-by: John Nunley <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Add support for PS Vita
3 participants