[lld] r193982 - [PECOFF] Add a test for the resource file.

Rui Ueyama ruiu at google.com
Mon Nov 4 10:55:21 PST 2013


On Mon, Nov 4, 2013 at 9:20 AM, Sean Silva <silvas at purdue.edu> wrote:

> +# Check if the binary contains UTF-16 string "Hello" copied from
> resource.res.
> +# cat %t.exe | grep 'H.e.l.l.o'
>
> I would specifically say UTF-16LE, since this code assumes that.
>
> Also, we're trying to get away from using grep in the test suite (yes,
> there are still a lot of uses). That will, among other things, make it
> easier to extend this test later (or is this all the resource file
> functionality we intend to implement?).
>

No, the implementation of the resource file functionality is still
incomplete -- actually it's wrong. The resource data should have been
emitted to .rsrc section, however it's currently emitted to .rdata. Once
the issue is fixed, I'll rewrite this test with llvm-objdump -s and
FileCheck utility, removing the dependency to grep.

-- Sean Silva
>
>
> On Mon, Nov 4, 2013 at 12:17 AM, Rui Ueyama <ruiu at google.com> wrote:
>
>> Author: ruiu
>> Date: Sun Nov  3 23:17:54 2013
>> New Revision: 193982
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=193982&view=rev
>> Log:
>> [PECOFF] Add a test for the resource file.
>>
>> Added:
>>     lld/trunk/test/pecoff/Inputs/resource.rc
>>     lld/trunk/test/pecoff/Inputs/resource.res   (with props)
>>     lld/trunk/test/pecoff/resource.test
>> Modified:
>>     lld/trunk/test/lit.cfg
>>
>> Modified: lld/trunk/test/lit.cfg
>> URL:
>> http://llvm.org/viewvc/llvm-project/lld/trunk/test/lit.cfg?rev=193982&r1=193981&r2=193982&view=diff
>>
>> ==============================================================================
>> --- lld/trunk/test/lit.cfg (original)
>> +++ lld/trunk/test/lit.cfg Sun Nov  3 23:17:54 2013
>> @@ -134,3 +134,9 @@ if re.search(r'DEBUG', llc_cmd.stdout.re
>>  if re.search(r'with assertions', llc_cmd.stdout.read()):
>>      config.available_features.add('asserts')
>>  llc_cmd.wait()
>> +
>> +# Check if Windows resource file compiler exists.
>> +cvtres = lit.util.which('cvtres', config.environment['PATH'])
>> +rc = lit.util.which('rc', config.environment['PATH'])
>> +if cvtres and rc:
>> +    config.available_features.add('winres')
>>
>> Added: lld/trunk/test/pecoff/Inputs/resource.rc
>> URL:
>> http://llvm.org/viewvc/llvm-project/lld/trunk/test/pecoff/Inputs/resource.rc?rev=193982&view=auto
>>
>> ==============================================================================
>> --- lld/trunk/test/pecoff/Inputs/resource.rc (added)
>> +++ lld/trunk/test/pecoff/Inputs/resource.rc Sun Nov  3 23:17:54 2013
>> @@ -0,0 +1,4 @@
>> +STRINGTABLE
>> +{
>> +    1, "Hello"
>> +}
>>
>> Added: lld/trunk/test/pecoff/Inputs/resource.res
>> URL:
>> http://llvm.org/viewvc/llvm-project/lld/trunk/test/pecoff/Inputs/resource.res?rev=193982&view=auto
>>
>> ==============================================================================
>> Binary files lld/trunk/test/pecoff/Inputs/resource.res (added) and
>> lld/trunk/test/pecoff/Inputs/resource.res Sun Nov  3 23:17:54 2013 differ
>>
>> Propchange: lld/trunk/test/pecoff/Inputs/resource.res
>>
>> ------------------------------------------------------------------------------
>>     svn:executable = *
>>
>> Added: lld/trunk/test/pecoff/resource.test
>> URL:
>> http://llvm.org/viewvc/llvm-project/lld/trunk/test/pecoff/resource.test?rev=193982&view=auto
>>
>> ==============================================================================
>> --- lld/trunk/test/pecoff/resource.test (added)
>> +++ lld/trunk/test/pecoff/resource.test Sun Nov  3 23:17:54 2013
>> @@ -0,0 +1,9 @@
>> +# REQUIRES: winres
>> +
>> +# RUN: yaml2obj %p/Inputs/nop.obj.yaml > %t.obj
>> +#
>> +# RUN: lld -flavor link /out:%t.exe /subsystem:console /entry:start
>> /opt:noref \
>> +# RUN:   -- %t.obj %p/Inputs/resource.res
>> +
>> +# Check if the binary contains UTF-16 string "Hello" copied from
>> resource.res.
>> +# cat %t.exe | grep 'H.e.l.l.o'
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131104/e8f3a4a7/attachment.html>


More information about the llvm-commits mailing list