This should work better to run the program only when it is created.
main = Program( "main", [ "main.cc" ] )
test = Command( target = "testoutput",
source = "./main",
action = "./main > $TARGET" )
Depends( test, main )
And use AlwaysBuild () to run it every time, as @doublep pointed out as follows:
main = Program( "main", [ "main.cc" ] )
test = Command( target = "testoutput",
source = "./main",
action = "./main > $TARGET" )
AlwaysBuild( test )
And if you want to see the contents of the test output, you can do this:
(, Linux Python)
main = Program( "main", [ "main.cc" ] )
test = Command( target = "testoutput",
source = "./main",
action = ["./main > $TARGET",
"cat $TARGET"] )
AlwaysBuild( test )