llvm-project
45 строк · 2.8 Кб
1rm %t.*.exe
2RUN: yaml2obj %p/Inputs/generic.yaml -o %t.obj
3RUN: lld-link %t.obj /debug /Brepro /entry:main /nodefaultlib /out:%t.1.exe
4RUN: lld-link %t.obj /debug /Brepro /entry:main /nodefaultlib /out:%t.2.exe
5RUN: lld-link %t.obj /debug /timestamp:0 /entry:main /nodefaultlib /out:%t.3.exe
6RUN: env SOURCE_DATE_EPOCH=0 lld-link %t.obj /debug /entry:main /nodefaultlib /out:%t.4.exe
7# Test timestamps corresponding to INT32_TMAX
8RUN: lld-link %t.obj /debug /timestamp:2147483647 /entry:main /nodefaultlib /out:%t.5.exe
9RUN: env SOURCE_DATE_EPOCH=2147483647 lld-link %t.obj /debug /entry:main /nodefaultlib /out:%t.6.exe
10# Test that the command line option /timestamp has precedence over SOURCE_DATE_EPOCH
11RUN: env SOURCE_DATE_EPOCH=12345 lld-link %t.obj /debug /timestamp:0 /entry:main /nodefaultlib /out:%t.7.exe
12# Test timestamps corresponding to UINT32_TMAX
13RUN: lld-link %t.obj /debug /timestamp:4294967295 /entry:main /nodefaultlib /out:%t.8.exe
14RUN: env SOURCE_DATE_EPOCH=4294967295 lld-link %t.obj /debug /entry:main /nodefaultlib /out:%t.9.exe
15# Test that setting UINT32_MAX+1 as timestamp fails.
16RUN: env LLD_IN_TEST=1 not lld-link %t.obj /debug /timestamp:4294967296 /entry:main /nodefaultlib /out:%t.10.exe 2>&1 | FileCheck %s --check-prefix=ERROR
17RUN: env SOURCE_DATE_EPOCH=4294967296 env LLD_IN_TEST=1 not lld-link %t.obj /debug /entry:main /nodefaultlib /out:%t.11.exe 2>&1 | FileCheck %s --check-prefix=ERROR2
18RUN: llvm-readobj --file-headers --coff-debug-directory %t.1.exe | FileCheck %s --check-prefix=HASH
19RUN: llvm-readobj --file-headers --coff-debug-directory %t.2.exe | FileCheck %s --check-prefix=HASH
20RUN: llvm-readobj --file-headers --coff-debug-directory %t.3.exe | FileCheck %s --check-prefix=ZERO
21RUN: llvm-readobj --file-headers --coff-debug-directory %t.4.exe | FileCheck %s --check-prefix=ZERO
22RUN: llvm-readobj --file-headers --coff-debug-directory %t.5.exe | FileCheck %s --check-prefix=LARGE
23RUN: llvm-readobj --file-headers --coff-debug-directory %t.6.exe | FileCheck %s --check-prefix=LARGE
24RUN: llvm-readobj --file-headers --coff-debug-directory %t.7.exe | FileCheck %s --check-prefix=ZERO
25
26# Not inspecting %t.8.exe and %t.9.exe; llvm-readobj with a 32 bit time_t fails to print dates
27# past INT32_MAX correctly.
28
29HASH: ImageFileHeader {
30HASH: TimeDateStamp: [[STAMP:.*]]
31HASH: DebugDirectory [
32HASH: TimeDateStamp: [[STAMP]]
33
34ZERO: ImageFileHeader {
35ZERO: TimeDateStamp: 1970-01-01 00:00:00 (0x0)
36ZERO: DebugDirectory [
37ZERO: TimeDateStamp: 1970-01-01 00:00:00 (0x0)
38
39LARGE: ImageFileHeader {
40LARGE: TimeDateStamp: 2038-01-19 03:14:07 (0x7FFFFFFF)
41LARGE: DebugDirectory [
42LARGE: TimeDateStamp: 2038-01-19 03:14:07 (0x7FFFFFFF)
43
44ERROR: error: invalid timestamp: 4294967296. Expected 32-bit integer
45ERROR2: error: invalid SOURCE_DATE_EPOCH timestamp: 4294967296. Expected 32-bit integer
46