4 ms·
And here's a makefile implementation with a statically typed language: #run test and output to a .testresult file when the test is modified %.testresult: %
by flukus 6y ago
And here's a makefile implementation with a statically typed language:
#run test and output to a .testresult file when the test is modified
%.testresult: %.test
$< > $@ 2>&1
#depends on a .testresult file for each test
test: $(ALL_TEST_RESULTS)
cat $(ALL_TEST_RESULTS)
Sure the dynamic typing introduces many problems, but surely you could have something a bit more half way like "%.testresult: %.test $(DEPENENDENCIES) $(METAPROGRAMMING_MAGIC_DEPENDENCIES)", then only hopefully rare changes to the core files require the full test suite to be rerun. Seems like dynamic typing is the core of their problem though and this is a crazy complicated solution to try and work around that.
- jolmg 6y ago> $< 2&1> $@ I'm not really well versed in Makefiles, but that seems to pass the argument "2" to the testing program, launching it in the background with "&", and then doing a redirection for the stdout of an empty command to the target file with "1>". I think you meant $< > $@ 2>&1 which could also be $< &> $@ I can't see how your example relates to static or dynamic typing, though.
- flukus 6y agoFixed, the former is correct, the latter I think is a bashism that may not work. Unfortunately I plucked that from a project in a very broken state. > I can't see how your example relates to static or dynamic typing, though. Because with static typing you know the object/file graph at compile time and only affected tests need to be run. In that example the .test files will only be built when their dependencies change and .testresult will only be created if .test is built, everything is incremental and "make test" won't execute any tests if there are no changes that could affect them.
- joshuamorton 6y agoYou know this in dynamic languages too, based on imports. So if you have the build graph represented for your dynamic language, you get the same result. This is just a poor (poor, poor) buggy implementation of Bazel.