aboutsummaryrefslogtreecommitdiff
path: root/External/SPEC/CINT2000/253.perlbmk/CMakeLists.txt
blob: 9fa8b71d64f14c66db236935a45df953688fc5ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
set(SourceNames
  av.c
  byterun.c
  deb.c
  doio.c
  doop.c
  dump.c
  ebcdic.c
  fake_dyna.c
  globals.c
  gv.c
  hv.c
  mg.c
  op.c
  perl.c
  perlio.c
  perly.c
  pp.c
  pp_ctl.c
  pp_hot.c
  pp_sys.c
  regcomp.c
  regexec.c
  run.c
  scope.c
  sv.c
  taint.c
  toke.c
  universal.c
  util.c
  MD5.c
  md5c.c
)

list(APPEND CPPFLAGS -DSPEC_CPU2000_NEED_BOOL)
list(APPEND LDFLAGS -lm)

if(TARGET_OS STREQUAL "Win32")
  list(APPEND SourceNames nt_perlmain.c win32.c win32sck.c perllib.c)
  list(APPEND CPPFLAGS -DSPEC_CPU2000_NTOS -DWIN32 -D_CONSOLE)
  include_directories(${BENCHMARK_DIR}/src)
  include_directories(${BENCHMARK_DIR}/src/win32)
else()
  list(APPEND SourceNames unix_perlmain.c)
  list(APPEND CPPFLAGS -DSPEC_CPU2000_LINUX)
endif()
list(APPEND CFLAGS -std=gnu89)

include(TestBigEndian)
test_big_endian(IS_BIGENDIAN)
if(IS_BIGENDIAN)
  if(CMAKE_SIZEOF_VOID_P EQUAL 8)
    list(APPEND CPPFLAGS -DBYTEORDER=0x87654321)
  else()
    list(APPEND CPPFLAGS -DBYTEORDER=0x4321)
  endif()
else()
  if(CMAKE_SIZEOF_VOID_P EQUAL 8)
    list(APPEND CPPFLAGS -DBYTEORDER=0x12345678)
  else()
    list(APPEND CPPFLAGS -DBYTEORDER=0x1234)
  endif()
endif()

# We want reproducible builds
list(APPEND CPPFLAGS -D__DATE__="XXX" -D__TIME__="XXX")

set(Source "")
foreach(FILENAME ${SourceNames})
  list(APPEND Source ${BENCHMARK_DIR}/src/${FILENAME})
endforeach()

macro(test_input run_type perlscript output)
  llvm_test_run(RUN_TYPE ${run_type}
    -I${CMAKE_CURRENT_BINARY_DIR}/data/all/input/lib ${perlscript}
    > ${CMAKE_CURRENT_BINARY_DIR}/${output}
    ${ARGN}
  )
  llvm_test_verify(RUN_TYPE ${run_type} WORKDIR ${CMAKE_CURRENT_BINARY_DIR}
    ${FPCMP} data/${run_type}/output/${output} ${output}
  )
endmacro()

# (Parameters come from the respective XXX.in files)
test_input(train
  diffmail.pl 2.350.15.24.23.150.out 2 350 15 24 23 150
  WORKDIR ${CMAKE_CURRENT_BINARY_DIR}/data/all/input
)
test_input(train
  perfect.pl b.3.out b 3
  WORKDIR ${CMAKE_CURRENT_BINARY_DIR}/data/all/input
)
test_input(train
  scrabbl.pl scrabbl.out < scrabbl.in
  WORKDIR ${CMAKE_CURRENT_BINARY_DIR}/data/train/input
)

test_input(ref
  splitmail.pl 850.5.19.18.1500.out 850 5 19 18 1500
  WORKDIR ${CMAKE_CURRENT_BINARY_DIR}/data/ref/input
)
test_input(ref
  splitmail.pl 704.12.26.16.836.out 704 12 26 16 836
  WORKDIR ${CMAKE_CURRENT_BINARY_DIR}/data/ref/input
)
test_input(ref
  splitmail.pl 535.13.25.24.1091.out 535 13 25 24 1091
  WORKDIR ${CMAKE_CURRENT_BINARY_DIR}/data/ref/input
)
test_input(ref
  splitmail.pl 957.12.23.26.1014.out 957 12 23 26 1014
  WORKDIR ${CMAKE_CURRENT_BINARY_DIR}/data/ref/input
)
test_input(ref
  diffmail.pl 2.550.15.24.23.100.out 2 550 15 24 23 100
  WORKDIR ${CMAKE_CURRENT_BINARY_DIR}/data/ref/input
)
test_input(ref
  perfect.pl b.3.m.4.out b 3 m 4
  WORKDIR ${CMAKE_CURRENT_BINARY_DIR}/data/ref/input
)
test_input(ref
  makerand.pl makerand.out
  WORKDIR ${CMAKE_CURRENT_BINARY_DIR}/data/ref/input
)

file(GLOB inputs ${BENCHMARK_DIR}/data/test/input/*.t)
foreach(input ${inputs})
  get_filename_component(basename ${input} NAME_WE)
  test_input(test
    ${basename}.t ${basename}.out
    WORKDIR ${CMAKE_CURRENT_BINARY_DIR}/data/test/input
  )
endforeach()

llvm_test_executable(253.perlbmk ${Source})
llvm_test_data_spec(253.perlbmk MUST_COPY
  data/test/output
  data/train/input
  data/train/output
  data/ref/output
  data/all/input
)

llvm_copy_dir(253.perlbmk ${CMAKE_CURRENT_BINARY_DIR}/data/test/input
  ${BENCHMARK_DIR}/data/all/input
  ${BENCHMARK_DIR}/data/test/input
)
llvm_copy_dir(253.perlbmk ${CMAKE_CURRENT_BINARY_DIR}/data/ref/input
  ${BENCHMARK_DIR}/data/all/input
  ${BENCHMARK_DIR}/data/ref/input
)