Debian Codegraph @

llvm/test/tools/llvm-objcopy/ELF/strip-preserve-atime.test

raw
1 # Note: ls -lu prints the accessed timestamp
2 # NetBSD: noatime mounts currently inhibit 'touch -a' updates
3 # Windows: the last access time is disabled by default in the OS
4 # This test is also known to fail on Mac (and possibly elsewhere) when Crowdstrike is installed;
5 # please make use of the LIT_XFAIL environment variable on such machines.
6 # UNSUPPORTED: system-netbsd, system-windows
7
8 # Preserve dates when stripping to an output file.
9 # RUN: yaml2obj %s -o %t.1.o
10 # RUN: touch -a -t 199505050555.55 %t.1.o
11 # RUN: llvm-strip -p %t.1.o -o %t-preserved.1.o
12 # RUN: ls -lu %t-preserved.1.o | FileCheck %s --check-prefix=CHECK-PRESERVE-ATIME
13 # Check that the stripped output is in fact a valid object file.
14 # RUN: llvm-readobj %t-preserved.1.o
15
16 # Preserve dates available via objcopy interface as well.
17 # RUN: yaml2obj %s -o %t.2.o
18 # RUN: touch -a -t 199505050555.55 %t.2.o
19 # RUN: llvm-objcopy -p %t.2.o %t-preserved.2.o
20 # RUN: ls -lu %t-preserved.2.o | FileCheck %s --check-prefix=CHECK-PRESERVE-ATIME
21 # RUN: llvm-readobj %t-preserved.2.o
22
23 # Preserve dates when stripping in place.
24 # RUN: yaml2obj %s -o %t.3.o
25 # RUN: touch -a -t 199505050555.55 %t.3.o
26 # RUN: llvm-strip -p %t.3.o
27 # RUN: ls -lu %t.3.o | FileCheck %s --check-prefix=CHECK-PRESERVE-ATIME
28 # RUN: llvm-readobj %t.3.o
29
30 # Without -p set, don't preserve dates.
31 # RUN: yaml2obj %s -o %t.4.o
32 # RUN: touch -a -t 199505050555.55 %t.4.o
33 # RUN: llvm-strip %t.4.o
34 # RUN: ls -lu %t.4.o | FileCheck %s --check-prefix=CHECK-NO-PRESERVE-ATIME
35 # RUN: llvm-readobj %t.4.o
36
37 # Preserve dates in archives.
38 # RUN: yaml2obj %s -o %t.5.o
39 # RUN: rm -f %t.a
40 # RUN: llvm-ar cr %t.a %t.5.o
41 # RUN: touch -a -t 199505050555.55 %t.a
42 # RUN: llvm-strip -p %t.a
43 # RUN: ls -lu %t.a | FileCheck %s --check-prefix=CHECK-PRESERVE-ATIME
44 # RUN: llvm-readobj %t.a
45
46 # Preserve dates in split DWO files.
47 # RUN: cp %p/Inputs/dwarf.dwo %t-input.dwo
48 # RUN: touch -a -t 199505050555.55 %t-input.dwo
49 # RUN: llvm-objcopy -p --split-dwo=%t-dwo %t-input.dwo %t-nondwo
50 # RUN: ls -lu %t-dwo | FileCheck %s --check-prefix=CHECK-PRESERVE-ATIME
51 # RUN: llvm-readobj %t-dwo
52 # RUN: ls -lu %t-nondwo | FileCheck %s --check-prefix=CHECK-PRESERVE-ATIME
53 # RUN: llvm-readobj %t-nondwo
54
55 # CHECK-PRESERVE-ATIME: {{[[:space:]]1995}}
56 # CHECK-NO-PRESERVE-ATIME-NOT: {{[[:space:]]1995}}
57
58 !ELF
59 FileHeader:
60 Class: ELFCLASS64
61 Data: ELFDATA2LSB
62 Type: ET_REL
63 Machine: EM_X86_64
64 Sections:
65 - Name: .text
66 Type: SHT_PROGBITS
67 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]