summaryrefslogtreecommitdiff
path: root/runner/meson.build
blob: c3927af568c79ce007d019d822a89a38cc818f7c (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
build_runner = get_option('runner')

runnerlib_sources = [ 'settings.c',
		      'job_list.c',
		      'executor.c',
		      'resultgen.c',
		      lib_version,
		    ]

runner_sources = [ 'runner.c' ]
resume_sources = [ 'resume.c' ]
results_sources = [ 'results.c' ]
runner_test_sources = [ 'runner_tests.c' ]
runner_json_test_sources = [ 'runner_json_tests.c' ]

jsonc = dependency('json-c', required: build_runner)
runner_deps = [jsonc, glib]
runner_c_args = []

liboping = dependency('liboping', required: get_option('oping'))
if liboping.found()
	runner_deps += liboping
	runner_c_args += '-DHAVE_OPING=1'
endif

if not build_tests and jsonc.found()
	error('Building test runner requires building tests')
endif

if jsonc.found()
	subdir('testdata')

	runnerlib = static_library('igt_runner', runnerlib_sources,
				   include_directories : inc,
				   c_args : runner_c_args,
				   dependencies : runner_deps)

	runner = executable('igt_runner', runner_sources,
			    link_with : runnerlib,
			    install : true,
			    install_dir : bindir,
			    install_rpath : bindir_rpathdir,
			    dependencies : igt_deps)

	resume = executable('igt_resume', resume_sources,
			    link_with : runnerlib,
			    install : true,
			    install_dir : bindir,
			    install_rpath : bindir_rpathdir,
			    dependencies : igt_deps)

	results = executable('igt_results', results_sources,
			     link_with : runnerlib,
			     install : true,
			     install_dir : bindir,
			     install_rpath : bindir_rpathdir,
			     dependencies : igt_deps)

	runner_test = executable('runner_test', runner_test_sources,
				 c_args : '-DTESTDATA_DIRECTORY="@0@"'.format(testdata_dir),
				 link_with : runnerlib,
				 install : false,
				 dependencies : [igt_deps, jsonc])
	test('runner', runner_test, timeout : 300)

	runner_json_test = executable('runner_json_test', runner_json_test_sources,
				      c_args : '-DJSON_TESTS_DIRECTORY="@0@"'.format(join_paths(meson.current_source_dir(), 'json_tests_data')),
				      link_with : runnerlib,
				      install : false,
				      dependencies : [igt_deps, jsonc])
	test('runner_json', runner_json_test, timeout : 300)

	build_info += 'Build test runner: true'
	if liboping.found()
		build_info += 'Build test runner with oping: true'
	endif
else
	build_info += 'Build test runner: false'
endif