feat: automated InfiniSim sessions through a control pipe#188
feat: automated InfiniSim sessions through a control pipe#188muesli wants to merge 1 commit intoInfiniTimeOrg:mainfrom
Conversation
When started with `--enable-fifo`, InfiniSim will listen for incoming control commands on `/tmp/infinisim_[pid].fifo`. This lets us remote control InfiniSim, so we can run through an entire test plan and take screenshots of each step along the way. I've added the following commands: - tap <x> <y>: emulates a tap at the specified coords - button: emulates the hardware side button - swipe `[up|down|left|right]` - prepare: session with weather data, heartrate, voltage, and steps - screenshot <path>: save screenshot at specified path
|
awesome stuff! one question I have immediately? Why a tmp file? We could use stdin aa well and let the user pipe the file into infinisim. Would that have drawbacks? |
Indeed and it's still a valid alternative. The only drawback is tighter coupling, which is the reason I went with a named pipe. It lets me keep the simulator running while working on different test plans and having them executed one after another. I'll happily switch over to a more traditional stdin pipe should you prefer that. |
|
I think I know not enough for good judgment on what is better. Please help me to better understand. with stdin or regular files I could let the simulator execute/process a file at a time and in case of a file it stays there for the next run. How is the user interaction with a named pipe? Do I need to guess the right created filename? |
|
I currently slightly lean towards regular text files and stdin (maybe because I know files 😅) orthogonally: we could add an exit keyword to close the sim after processing the file and I think InfiniEmu has a similar feature as well. Could you have a look if it differs or if we could even support the same style/instruction set? |
You would typically start up the ./build/infinisim --enable-fifo &
SIM_PID=$!You then know its fifo location: SIM_FIFO="/tmp/infinisim_${SIM_PID}.fifo"Once that path exists, you can start writing to the fifo to trigger actions inside InfiniSim: echo "swipe up" > "$SIM_FIFO"
echo "screenshot somefile.png" > "$SIM_FIFO" |

When started with
--enable-fifo, InfiniSim will listen for incoming control commands on/tmp/infinisim_[pid].fifo.This lets us remote control InfiniSim, so we can run through an entire test plan and take screenshots of each step along the way.
I've added the following commands:
[up|down|left|right]