For some reason, I need to compile and test my project on a remote server.
One solution I use is ssh + make, this is the r_makefile script I currently use
# usage: make -f r_makefile
all.remote: a.remote b.remote makefile.remote
%.remote: %.c
scp $< remotehost:~/work/test
touch $@
makefile.remote: makefile
scp $< remotehost:~/work/test
touch $@
test: all.remote
ssh remotehost 'cd work/test && make test'
And the makefile.
CC = gcc
objects = a.o b.o
a: $(objects)
$(CC) $(objects) -o a
a.o: a.c
b.o: b.c
test: a
./a
It works fine for me now, but I have to keep track of both makefile and r_makefile. As the code grows(which makes my makefile more complicated), it becomes hard to modify the r_makefile.
I wonder if there is a tool could do this for me, or automatically generate the r_makefile. I currently use git for version control.
What is the best practice for remote compilation and test, is there another way to achieve this goal?
The best practice for remote tests is using DejaGnu. The project is (understated) a little scarce on documentation, but quite powerful, and supports remote tests out of the box.