<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On 1 August 2018 at 11:21, Simon Marchi <span dir="ltr"><<a href="mailto:simon.marchi@ericsson.com" target="_blank">simon.marchi@ericsson.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><span class="gmail-">On 2018-08-01 01:30 PM, Alex L wrote:<br>
> Is there a particular reason why this commit didn't have a corresponding test included?<br>
> Cheers,<br>
> Alex<br>
<br>
</span>Back when we made the corresponding change in "onChangeConfiguration", there was no<br>
straightforward way to make a lit test for it:<br>
<br>
<a href="https://reviews.llvm.org/D39571?id=124024#inline-359345" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D39571?id=124024#inline-359345</a><br>
<br>
I am not sure, but I think the issue was that we had to hard-code the length of the<br>
messages we sent.  Since we had to use temp directory names, the length was not<br>
known in advance.  I don't think we have that limitation anymore.<br></blockquote><div><br></div><div>Yes, I believe this limitation doesn't exist anymore.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
<br>
We would need to create a temporary directory hierarchy, and then refer to it in<br>
the messages we send to switch between build configurations.  Is it something that<br>
sounds possible with lit?  Do you know about other tests doing something similar?<br></blockquote><div><br></div><div>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.</div><div><br></div><div>I think this kind of solution should work (*) :</div><div><br></div><div>First, you would create a temporary directory in lit:</div><div><br></div><div>RUN: rm -rf %t.dir</div><div>RUN: mkdir %t.dir</div><div>RUN: ... populate the temporary directory ...</div><div><br></div><div>Then, you would generate the input file (i.e. replace INPUT_DIR in the original test with the temporary directory):</div><div><br></div><div>RUN: rm -rf %t.test</div><div>RUN: sed -e "s:INPUT_DIR:%t.dir:g" %s > %t.test</div><div><br></div><div>And then you can invoke the test:</div><div><br></div><div>RUN: clang -lit-test < %t.test | FileCheck -strict-whitespace %s</div><div><br></div><div>* 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.</div><div><br></div><div>Thanks,</div><div>Alex</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
<br>
Thanks,<br>
<br>
Simon<br>
</blockquote></div><br></div></div>