On 1 August 2018 at 11:21, Simon Marchi <simon.mar...@ericsson.com> wrote:
> On 2018-08-01 01:30 PM, Alex L wrote: > > Is there a particular reason why this commit didn't have a corresponding > test included? > > Cheers, > > Alex > > Back when we made the corresponding change in "onChangeConfiguration", > there was no > straightforward way to make a lit test for it: > > https://reviews.llvm.org/D39571?id=124024#inline-359345 > > I am not sure, but I think the issue was that we had to hard-code the > length of the > messages we sent. Since we had to use temp directory names, the length > was not > known in advance. I don't think we have that limitation anymore. > Yes, I believe this limitation doesn't exist anymore. > > We would need to create a temporary directory hierarchy, and then refer to > it in > the messages we send to switch between build configurations. Is it > something that > sounds possible with lit? Do you know about other tests doing something > similar? > I think it's be possible, albeit in a more complicated way than the regular Clangd test. We just need to generate a new test file that we can give to the Clangd from the included test file. I think this kind of solution should work (*) : First, you would create a temporary directory in lit: RUN: rm -rf %t.dir RUN: mkdir %t.dir RUN: ... populate the temporary directory ... Then, you would generate the input file (i.e. replace INPUT_DIR in the original test with the temporary directory): RUN: rm -rf %t.test RUN: sed -e "s:INPUT_DIR:%t.dir:g" %s > %t.test And then you can invoke the test: RUN: clang -lit-test < %t.test | FileCheck -strict-whitespace %s * The only problem might be JSON string encoding of the INPUT_DIR (i.e. you'll generate a test file that contains "C:\\temp\foo" on Windows, which would be invalid JSON string). You should be able to use 'sed' here as well to fix this up. Thanks, Alex > > Thanks, > > Simon >
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits