-
Notifications
You must be signed in to change notification settings - Fork 43
/
.prerelease.run_tests.diff
75 lines (75 loc) · 3.9 KB
/
.prerelease.run_tests.diff
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
diff --git a/scripts/devel/catkin_make_isolated_and_test.py b/scripts/devel/catkin_make_isolated_and_test.py
index 8f3fbba..78e837e 100755
--- a/scripts/devel/catkin_make_isolated_and_test.py
+++ b/scripts/devel/catkin_make_isolated_and_test.py
@@ -96,6 +96,70 @@ def main(argv=sys.argv[1:]):
args.rosdistro_name, args.workspace_root,
['--force-cmake'] + arguments + ['run_tests'],
parent_result_spaces=parent_result_spaces)
+ ### ADDED INSTALL TEST
+ import subprocess
+ with Scope('SUBSECTION', 'build workspace in isolation/install'):
+ test_results_dir = os.path.join(
+ args.workspace_root, 'test_results/install')
+ arguments = [
+ '--install',
+ '--cmake-args', '-DCATKIN_ENABLE_TESTING=1',
+ '-DCATKIN_SKIP_TESTING=0',
+ '-DCATKIN_TEST_RESULTS_DIR=%s' % test_results_dir,
+ '--catkin-make-args', '-j1']
+ rc = call_catkin_make_isolated(
+ args.rosdistro_name, args.workspace_root,
+ arguments,
+ parent_result_spaces=parent_result_spaces)
+ if not rc:
+ with Scope('SUBSECTION', 'build installed tests'):
+ rc = call_catkin_make_isolated(
+ args.rosdistro_name, args.workspace_root,
+ arguments + ['tests'],
+ parent_result_spaces=parent_result_spaces)
+ if not rc:
+ # FIXME :: FORCE REMOVE CACHED ENV VARIABLES
+ # FIXME :: USE source setup.sh
+ # COPIED FROM ros_buildfarm/scripts/doc/build_doc.py
+ source_cmd = [
+ '.', os.path.join(
+ args.workspace_root, 'install_isolated', 'setup.sh'),
+ ]
+ # for workspaces with only plain cmake packages the setup files
+ # generated by cmi won't implicitly source the underlays
+ setup_file = '/opt/ros/%s/setup.sh' % args.rosdistro_name
+ if os.path.exists(setup_file):
+ source_cmd = ['.', setup_file, '&&'] + source_cmd
+ sed_cmd = [
+ 'find', 'build_isolated', '-name', 'setup_cached.sh',
+ '-exec', 'sed', '-i', "'s@^export@#export@'", '{}', '\;']
+ print("Invoking `sed` for package '%s': %s" %
+ (args.workspace_root, ' '.join(sed_cmd)))
+ pkg_rc = subprocess.call(
+ [
+ 'sh', '-c',
+ ' '.join(source_cmd) +
+ ' && ' +
+ ' '.join(sed_cmd)
+ ], stderr=subprocess.STDOUT, cwd=args.workspace_root)
+ if pkg_rc:
+ rc = pkg_rc
+
+ # for workspaces with only plain cmake packages the setup files
+ # generated by cmi won't implicitly source the underlays
+ if parent_result_spaces is None:
+ parent_result_spaces = ['/opt/ros/%s' % args.rosdistro_name]
+ devel_space = os.path.join(
+ args.workspace_root, 'install_isolated')
+ parent_result_spaces.append(devel_space)
+ # since catkin_make_isolated doesn't provide a custom
+ # environment to run tests this needs to source the devel space
+ # and force a CMake run ro use the new environment
+ with Scope('SUBSECTION', 'run tests'):
+ rc = call_catkin_make_isolated(
+ args.rosdistro_name, args.workspace_root,
+ ['--force-cmake'] + arguments + ['run_tests'],
+ parent_result_spaces=parent_result_spaces)
finally:
if args.clean_after:
clean_workspace(args.workspace_root)