I'd approach this by trying to craft a Makefile recipe to carry out the steps you want, including passing the binary to be tested as a command to
ssh. Something along the lines of (note that this is totally untested and probably overly complicated):
.PHONY: transfer remote_execute test_on_remote
test_on_remote: $(OUTPUT) transfer remote_execute
$(SCP_CMD) $(LOCAL_PATH)$(OUTPUT) $(HOST_URI):$(HOST_PATH)$(OUTPUT)
$(SSH_CMD) $(HOST_URI) "$(HOST_PATH)$(OUTPUT)"
Obviously you'd need to add some rules here to compile your binary as well. Just typing
make should then compile, transfer and run your binary. You may prefer to use
rsync instead of
scp if, for example, you had supporting files that need copying over as well as the binary to be tested.
A possible alternative to running the binary through
ssh for testing might be to install
gdbserver on your Pi and start it through
ssh and then connect to it with the cross-compiler
gdb on your development machine.