swiftlang / swift

The Swift Programming Language
https://swift.org
Apache License 2.0
67.51k stars 10.35k forks source link

[SR-364] gyb self-tests look broken #42984

Open gribozavr opened 8 years ago

gribozavr commented 8 years ago
Previous ID SR-364
Radar None
Original Reporter @gribozavr
Type Bug
Additional Detail from JIRA | | | |------------------|-----------------| |Votes | 1 | |Component/s | Compiler | |Labels | Bug, InPythonCode | |Assignee | None | |Priority | Medium | md5: fc11b54c84e8abd1ef03f0d3e60c4452

Issue Description:

gyb self-tests look broken:

$ ./utils/gyb --verbose-test
1 items had no tests:
    __main__
0 tests in 1 items.
0 passed and 0 failed.
Test passed.
ec882e32-f2b6-4d2a-849c-98d6c7df0cfb commented 8 years ago

Also:

$ utils/gyb --test
# ...ten minutes pass
^CTraceback (most recent call last):
  File "./utils/gyb", line 3, in <module>
    gyb.main()
  File "/Users/bgesiak/GitHub/apple/swift/utils/gyb.py", line 1060, in main
    ast = parseTemplate(args.file.name, args.file.read())
KeyboardInterrupt

These tests probably need to be looked at. In order to keep them from breaking again it might also be a good idea to add them to validation-test.

dabrahams commented 7 years ago

They're not actually broken; it's just that when you request testing that is simply added to everything else the tool does, and by default it reads from standard input. Pipe echo into it and it will exit after printing a line directive. We could change it to always exit after testing, but right now as you point out, testing isn't separately integrated into the build, so the only way to get tests to run as part of the build is to run them as part of gyb's normal execution in the build system.

Patches to make those changes would be most welcome, of course!