telyn / ps2runner

Remote test harness for PS2, using an IRToy and ps2link
4 stars 1 forks source link

Build ps2run - the execution harness script #3

Closed telyn closed 4 years ago

telyn commented 4 years ago

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 4 years ago

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.