diff options
| author | Zachary Turner <zturner@google.com> | 2017-10-11 20:12:09 +0000 |
|---|---|---|
| committer | Zachary Turner <zturner@google.com> | 2017-10-11 20:12:09 +0000 |
| commit | fa0ca6cbd01c6289ef4073073a84200a883eb3c5 (patch) | |
| tree | 2abc3114b64d579879e5787ea6a3e9cb9adbce79 /llvm/test/tools/llvm-rc | |
| parent | 210d9f43a33e98bb60231972c618482de1fdc0d6 (diff) | |
| download | bcm5719-llvm-fa0ca6cbd01c6289ef4073073a84200a883eb3c5.tar.gz bcm5719-llvm-fa0ca6cbd01c6289ef4073073a84200a883eb3c5.zip | |
[llvm-rc] Use proper search algorithm for finding resources.
Previously we would only look in the current directory for a
resource, which might not be the same as the directory of the
rc file. Furthermore, MSVC rc supports a /I option, and can
also look in the system environment. This patch adds support
for this search algorithm.
Differential Revision: https://reviews.llvm.org/D38740
llvm-svn: 315499
Diffstat (limited to 'llvm/test/tools/llvm-rc')
| -rw-r--r-- | llvm/test/tools/llvm-rc/Inputs/deep-include.rc | 3 | ||||
| -rw-r--r-- | llvm/test/tools/llvm-rc/Inputs/include.rc | 2 | ||||
| -rw-r--r-- | llvm/test/tools/llvm-rc/Inputs/nested/nested-bitmap.bmp | bin | 0 -> 110 bytes | |||
| -rw-r--r-- | llvm/test/tools/llvm-rc/include-paths.test | 45 | ||||
| -rw-r--r-- | llvm/test/tools/llvm-rc/tag-html.test | 6 |
5 files changed, 50 insertions, 6 deletions
diff --git a/llvm/test/tools/llvm-rc/Inputs/deep-include.rc b/llvm/test/tools/llvm-rc/Inputs/deep-include.rc new file mode 100644 index 00000000000..b28fa8f243a --- /dev/null +++ b/llvm/test/tools/llvm-rc/Inputs/deep-include.rc @@ -0,0 +1,3 @@ +// Whether this is found depends on whether the /I flag searches within the +// "nested" subdirectory +foo BITMAP "nested-bitmap.bmp"
\ No newline at end of file diff --git a/llvm/test/tools/llvm-rc/Inputs/include.rc b/llvm/test/tools/llvm-rc/Inputs/include.rc new file mode 100644 index 00000000000..1cd4c28fa29 --- /dev/null +++ b/llvm/test/tools/llvm-rc/Inputs/include.rc @@ -0,0 +1,2 @@ +// Found because bitmap.bmp is in same directory +foo BITMAP "bitmap.bmp"
\ No newline at end of file diff --git a/llvm/test/tools/llvm-rc/Inputs/nested/nested-bitmap.bmp b/llvm/test/tools/llvm-rc/Inputs/nested/nested-bitmap.bmp Binary files differnew file mode 100644 index 00000000000..5d5a00d8745 --- /dev/null +++ b/llvm/test/tools/llvm-rc/Inputs/nested/nested-bitmap.bmp diff --git a/llvm/test/tools/llvm-rc/include-paths.test b/llvm/test/tools/llvm-rc/include-paths.test new file mode 100644 index 00000000000..ee7e75feb44 --- /dev/null +++ b/llvm/test/tools/llvm-rc/include-paths.test @@ -0,0 +1,45 @@ +; Should find the bitmap if it is in the same folder as the rc file. +; RUN: rm %t.include.res +; RUN: llvm-rc /FO %t.include.res %p/Inputs/include.rc +; RUN: llvm-readobj %t.include.res | FileCheck --check-prefix=FOUND %s + +; Should find the bitmap if the folder is explicitly specified. +; RUN: rm %t.nested-include.res +; RUN: llvm-rc /FO %t.nested-include.res /I %p/Inputs/nested %p/Inputs/deep-include.rc +; RUN: llvm-readobj %t.nested-include.res | FileCheck --check-prefix=FOUND %s + +; Otherwise, it should not find the bitmap. +; RUN: rm %t.nested-include.res +; RUN: not llvm-rc /FO %t.nested-include.res %p/Inputs/deep-include.rc 2>&1 \ +; RUN: | FileCheck --check-prefix=MISSING %s + +; Should find the bitmap if the process's current working directory +; contains the resource being searched for. Do this test last since it +; changes the current working directory and could affect the success or +; failure of other tests if run first. +; RUN: rm %t.nested-include.res +; RUN: cd %p/Inputs/nested +; RUN: llvm-rc /FO %t.nested-include.res %p/Inputs/include.rc +; RUN: llvm-readobj %t.nested-include.res | FileCheck --check-prefix=FOUND %s + +FOUND: Resource type (string): BITMAP +FOUND-NEXT: Resource name (string): FOO +FOUND-NEXT: Data version: 0 +FOUND-NEXT: Memory flags: 0x30 +FOUND-NEXT: Language ID: 1033 +FOUND-NEXT: Version (major): 0 +FOUND-NEXT: Version (minor): 0 +FOUND-NEXT: Characteristics: 0 +FOUND-NEXT: Data size: 110 +FOUND-NEXT: Data: ( +FOUND-NEXT: 0000: 424D6E00 00000000 00003600 00002800 |BMn.......6...(.| +FOUND-NEXT: 0010: 00000200 00000700 00000100 18000000 |................| +FOUND-NEXT: 0020: 00003800 00000000 00000000 00000000 |..8.............| +FOUND-NEXT: 0030: 00000000 00005BB3 855BB385 0000FFFF |......[..[......| +FOUND-NEXT: 0040: FFFFFFFF 0000FFFF FFFFFFFF 0000FFFF |................| +FOUND-NEXT: 0050: FFFFFFFF 00005BB3 85FFFFFF 0000FFFF |......[.........| +FOUND-NEXT: 0060: FF0EC9FF 0000241C EDFFFFFF 0000 |......$.......| +FOUND-NEXT: ) + +MISSING: llvm-rc: Error in BITMAP statement (ID foo): +MISSING-NEXT: error : file not found : nested-bitmap.bmp diff --git a/llvm/test/tools/llvm-rc/tag-html.test b/llvm/test/tools/llvm-rc/tag-html.test index 4a5c8e66ebd..571e1bcb46c 100644 --- a/llvm/test/tools/llvm-rc/tag-html.test +++ b/llvm/test/tools/llvm-rc/tag-html.test @@ -33,9 +33,3 @@ ; HTML-NEXT: 0020: 202D2D3E 0A3C696D 67207372 633D226B | -->.<img src="k| ; HTML-NEXT: 0030: 69747465 6E732E62 6D70223E 0A |ittens.bmp">.| ; HTML-NEXT: ) - - -; RUN: not llvm-rc /FO %t/tag-html-wrong.res %p/Inputs/tag-html-wrong.rc 2>&1 | FileCheck %s --check-prefix NOFILE - -; NOFILE: llvm-rc: Error in HTML statement (ID 1): -; NOFILE-NEXT: Error opening file 'some-really-nonexistent-file.html': |

