telyn/ps2runner

Build ps2run - the execution harness script

Closed this issue · 1 comments

telyn commented

This is gonna be called ps2harness (ps2exec was already taken), and will live inside the ps2runner docker image.

Intended usage:

ps2harness [--ee | --iop] some-binary.elf

Runs some-binary.elf, passing the program's exit code and stdout/stderr output back through. 
Think of it like the `ssh` command, when you use it with a program to run:

$ ssh myserver bash -c 'echo Goodbye && exit 1'
Goodbye
$ echo $?
1

Likewise, if you have the following C program compiled for the EE as goodbye.elf:

#include<stdio.h>
int main(int argc, char **argv) { 
  printf("Goodbye\n");
  return 1;
}

then you could run:

$ ps2harness --ee goodbye.elf
Goodbye
$ echo $?
1

ps2harness uses ps2client under-the-hood, so ensure PS2HOSTNAME is set correctly for your network.
telyn commented

It's built! I had to implement a library to send the exit code over the network for EE programs. That's now done - it's libps2run and the instructions are in README/the help text from ps2run the shell script.

The shell script ps2run forwards the application's stdout and stderr (as received by ps2client) to stderr, as well as capturing the exit code and forwarding that. So if the program performs printf("Hello!"); exit 9 on the PS2, the shell script outputs "Hello!" and exits with exit code 9.