[PATCH] D49268: [clang-doc] Create a script to generate tests
Julie Hockett via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 13 09:19:45 PDT 2018
juliehockett added a comment.
In https://reviews.llvm.org/D49268#1161268, @lebedev.ri wrote:
> Did you meant to commit `clang-tools-extra/clang-doc/test_cases/` ?
> I can't tell whether it is a temporary directory or not.
It is, it's the code for the actual test cases that are generated (so that if anyone not me is working on this, they can easily generate the same test code, with only minor adjustments, for their changes if necessary). Maybe it would make more sense to move this to the `test` dir.
================
Comment at: clang-tools-extra/clang-doc/gen_tests.py:62
+ test_file = os.path.join(test_cases_path, 'test.cpp')
+ shutil.copyfile(test_case_path, test_file)
+ return test_file
----------------
lebedev.ri wrote:
> Ah, i see, so this happens sequentially, using the same source location for each test.
Yup, so that the resulting file has the right USR for the one that depends on the filename (n.b. that particular issue should go away after D48908, since afaik the only USRs that depend on filename are function-internals)
================
Comment at: clang-tools-extra/clang-doc/gen_tests.py:131-133
+ clang_doc_path = os.path.dirname(__file__)
+ test_cases_path = os.path.join(clang_doc_path, 'test_cases')
+ tests_path = os.path.join(clang_doc_path, '..', 'test', 'clang-doc')
----------------
lebedev.ri wrote:
> Will the script work regardless of the `pwd` it is called from?
Yup, `__file__` is the location of this script, i.e. `<path to cte>/clang-doc/gen_tests.py`
================
Comment at: clang-tools-extra/clang-doc/gen_tests.py:138
+ for test_case_path in glob.glob(os.path.join(test_cases_path, '*')):
+ if test_case_path.endswith('compile_flags.txt'):
+ continue
----------------
lebedev.ri wrote:
> Probably also `compile_commands.json`
See note on the test_cases above, since the `test_cases` file only has `compile_flags.txt`, but I'll add it in case that changes in the future
https://reviews.llvm.org/D49268
More information about the cfe-commits
mailing list