You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cmd/compile: short tests are not short enough #26469
The first one we should fix @dr2chase .
All the ones around 0.30 sec just invoke the compiler and run the result. Some of the files are largeish, but most aren't (map.go for TestMap is 45 lines, for example). Maybe there's some way we could batch all these tests into a single compile to amortize the cost of invoking the compiler (&linker?).
TestGenFlowGraph generates 766 functions, compiles that, and runs it. For each function the runner first interprets it up to 4096 steps (it depends on the function, most are 512) and if that terminates, calls the function and compares the results.
One way to speed it up would be to quit testing it for GO_SSA_PHI_LOC_CUTOFF=0, because it turns out that we ignore that parameter now.
The TestFormats test could be run in non-short mode only as long as we run it from time to time. It does verify that the various format strings used in compiler errors use the correct format strings, etc.
: we have a longtest builder which will run this test on every commit.
@randall77 are you sure? Do you have windows longtest builder? Most changes to Go repo and tools are developed on non-Windows computers. So Go Team developers do not see Windows problems that their changes introduce.
Yes, we run the longtest builder on every commit. The longtest builder is linux/amd64, there's no windows one (or arm, or ...).
The TestFormats test isn't architecture-dependent (except that it doesn't (or may not? not sure) test files which are excluded on linux/amd64).
Yes, we run the longtest builder on every commit. The longtest builder is linux/amd64, there's no windows one (or arm, or ...).
I doubt anyone checks long tests on windows. I rarely do it myself, because I hardly have time for short tests. Just as an exercise, I run long test for cmd/go for current tip:
The approach taken by the last few changes that make basic arithmetic tests depend on the testing package look not really useful to me, except as a experiment.
When the logic to run the test framework works, much of the compiler and runtime are already implicitly tested. So given those are failing, the testing package probably gives segfaults first or behaves funny before any useful test code is even run.
This also makes implementing a new Go compiler step by step harder and my even make porting harder since the unit of code that needs to work before these tests now run is much bigger.
All in all this approach to testing the compiler really confuses me.
I guess it depends on what you see these tests as being useful for.
I seem them mainly as regression tests, making sure that the compiler handles all the weird edge cases correctly. Sure the testing package wouldn't work if the compiler wasn't mostly correct already, but there's lots of wiggle room between mostly correct and all correct. For example, does testing use 16-bit right unsigned shifts?
And before incorporating the testing package, these tests still assumed that most of the runtime package compiles successfully. So it's not like they used to depend on nothing.
I can see the argument that not depending on testing makes it easier to use the tests for developing a new architecture port. I just don't think new ports happen that often, and the window between runtime working and runtime+testing working isn't that large.
Activity
randall77 commentedon Jul 19, 2018
cmd/compilehas only one test:we could maybe run this in non-short mode only. @griesemer
Slow compiler tests (>.1 sec):
The first one we should fix @dr2chase .
All the ones around 0.30 sec just invoke the compiler and run the result. Some of the files are largeish, but most aren't (map.go for TestMap is 45 lines, for example). Maybe there's some way we could batch all these tests into a single compile to amortize the cost of invoking the compiler (&linker?).
dr2chase commentedon Jul 19, 2018
TestGenFlowGraph generates 766 functions, compiles that, and runs it. For each function the runner first interprets it up to 4096 steps (it depends on the function, most are 512) and if that terminates, calls the function and compares the results.
One way to speed it up would be to quit testing it for GO_SSA_PHI_LOC_CUTOFF=0, because it turns out that we ignore that parameter now.
That cuts the test time in half with no loss of information....
gopherbot commentedon Jul 19, 2018
Change https://golang.org/cl/125075 mentions this issue:
cmd/compile: don't run gc/ssa_test/TestGenFlowGraph in short modecmd/compile: don't run gc/ssa_test/TestGenFlowGraph in short mode
griesemer commentedon Jul 19, 2018
The TestFormats test could be run in non-short mode only as long as we run it from time to time. It does verify that the various format strings used in compiler errors use the correct format strings, etc.
randall77 commentedon Jul 19, 2018
@griesemer: we have a longtest builder which will run this test on every commit.
gopherbot commentedon Jul 19, 2018
Change https://golang.org/cl/125037 mentions this issue:
cmd/compile: run fmt test only in long modecmd/compile: run fmt test only in long mode
ysmolski commentedon Jul 19, 2018
Should we put a general recommendation about wether test falls under short category somewhere. Is threshold on 1 second or 0.1 seconds?
alexbrainman commentedon Jul 20, 2018
@randall77 are you sure? Do you have windows longtest builder? Most changes to Go repo and tools are developed on non-Windows computers. So Go Team developers do not see Windows problems that their changes introduce.
Alex
randall77 commentedon Jul 21, 2018
Yes, we run the longtest builder on every commit. The longtest builder is linux/amd64, there's no windows one (or arm, or ...).
The
TestFormatstest isn't architecture-dependent (except that it doesn't (or may not? not sure) test files which are excluded on linux/amd64).alexbrainman commentedon Jul 21, 2018
I doubt anyone checks long tests on windows. I rarely do it myself, because I hardly have time for short tests. Just as an exercise, I run long test for cmd/go for current tip:
and the test did not even finish.
But the short test is fine:
If you remove tests from long test, they will slowly become broken.
Alex
gopherbot commentedon Jul 31, 2018
Change https://golang.org/cl/126995 mentions this issue:
cmd/compile: unify compilation of compiler testsgopherbot commentedon Jul 31, 2018
Change https://golang.org/cl/127055 mentions this issue:
cmd/compile: move over more compiler tests to new test infrastructuregopherbot commentedon Jul 31, 2018
Change https://golang.org/cl/127095 mentions this issue:
cmd/compile: move autogenerated tests to new infrastructuregopherbot commentedon Jul 31, 2018
Change https://golang.org/cl/127115 mentions this issue:
cmd/compile: move more compiler tests to new test infrastructuregopherbot commentedon Jul 31, 2018
Change https://golang.org/cl/127116 mentions this issue:
cmd/compile: move last compile tests to new test infrastructurenightlyone commentedon Aug 1, 2018
The approach taken by the last few changes that make basic arithmetic tests depend on the testing package look not really useful to me, except as a experiment.
When the logic to run the test framework works, much of the compiler and runtime are already implicitly tested. So given those are failing, the testing package probably gives segfaults first or behaves funny before any useful test code is even run.
This also makes implementing a new Go compiler step by step harder and my even make porting harder since the unit of code that needs to work before these tests now run is much bigger.
All in all this approach to testing the compiler really confuses me.
randall77 commentedon Aug 1, 2018
I guess it depends on what you see these tests as being useful for.
I seem them mainly as regression tests, making sure that the compiler handles all the weird edge cases correctly. Sure the
testingpackage wouldn't work if the compiler wasn't mostly correct already, but there's lots of wiggle room between mostly correct and all correct. For example, doestestinguse 16-bit right unsigned shifts?And before incorporating the
testingpackage, these tests still assumed that most of theruntimepackage compiles successfully. So it's not like they used to depend on nothing.I can see the argument that not depending on
testingmakes it easier to use the tests for developing a new architecture port. I just don't think new ports happen that often, and the window betweenruntimeworking andruntime+testingworking isn't that large.cmd/compile: unify compilation of compiler tests
cmd/compile: move over more compiler tests to new test infrastructure
cmd/compile: move autogenerated tests to new infrastructure
cmd/compile: move more compiler tests to new test infrastructure