aboutsummaryrefslogtreecommitdiff
path: root/tests/default-options/testscript
blob: c0c3816cc110a7af090d746f7761fa68221ee794 (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
# file      : tests/default-options/testscript
# copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
# license   : MIT; see accompanying LICENSE file

# Note that when cross-testing the driver may not be able to run the command
# due to the meaningless program path.
#
+if ($test.target != $build.host)
  exit
end

sys_dir = $canonicalize([dir_path] $~/build2)
+mkdir -p $sys_dir/local

+echo 'sys-foo' >=$sys_dir/foo
+echo 'sys-bar' >=$sys_dir/bar
+echo 'sys-local-foo' >=$sys_dir/local/foo
+echo 'sys-local-bar' >=$sys_dir/local/bar

home_dir = $canonicalize([dir_path] $~/home)
+mkdir -p $home_dir/.build2/local/

+echo 'home-foo'       >=$home_dir/.build2/foo
+echo 'home-bar'       >=$home_dir/.build2/bar
+echo 'home-local-foo' >=$home_dir/.build2/local/foo
+echo 'home-local-bar' >=$home_dir/.build2/local/bar

: in-home
:
{
  d = $home_dir/work/.build2
  +mkdir -p $d/local/

  +echo 'work-foo'       >=$d/foo
  +echo 'work-bar'       >=$d/bar
  +echo 'work-local-foo' >=$d/local/foo
  +echo 'work-local-bar' >=$d/local/bar

  d = $home_dir/work/project/.build2
  +mkdir -p $d/local/
  +touch $home_dir/work/project/.git

  +echo 'project-foo'       >=$d/foo
  +echo 'project-bar'       >=$d/bar
  +echo 'project-local-foo' >=$d/local/foo
  +echo 'project-local-bar' >=$d/local/bar

  d = $home_dir/work/project/package/.build2
  +mkdir -p $d/local/

  +echo 'package-foo'       >=$d/foo
  +echo 'package-bar'       >=$d/bar
  +echo 'package-local-foo' >=$d/local/foo
  +echo 'package-local-bar' >=$d/local/bar

  start_dir = $canonicalize([dir_path] $home_dir/work/project/package)

  : entries
  :
  $* -e -f foo -f bar -d $start_dir -s $sys_dir -h $home_dir cmd-foo cmd-bar >>/~%EOO%d
    %\.+/build2/foo,sys-foo,false%
    %\.+/build2/bar,sys-bar,false%
    %\.+/build2/local/foo,sys-local-foo,false%
    %\.+/build2/local/bar,sys-local-bar,false%
    %\.+/home/.build2/foo,home-foo,false%
    %\.+/home/.build2/bar,home-bar,false%
    %\.+/home/.build2/local/foo,home-local-foo,false%
    %\.+/home/.build2/local/bar,home-local-bar,false%
    %\.+/home/work/.build2/foo,work-foo,false%
    %\.+/home/work/.build2/bar,work-bar,false%
    %\.+/home/work/.build2/local/foo,work-local-foo,false%
    %\.+/home/work/.build2/local/bar,work-local-bar,false%
    %\.+/home/work/project/.build2/foo,project-foo,true%
    %\.+/home/work/project/.build2/bar,project-bar,true%
    %\.+/home/work/project/.build2/local/foo,project-local-foo,true%
    %\.+/home/work/project/.build2/local/bar,project-local-bar,true%
    %\.+/home/work/project/package/.build2/foo,package-foo,true%
    %\.+/home/work/project/package/.build2/bar,package-bar,true%
    %\.+/home/work/project/package/.build2/local/foo,package-local-foo,true%
    %\.+/home/work/project/package/.build2/local/bar,package-local-bar,true%
    EOO

  : merged
  :
  $* -f foo -f bar -d $start_dir -s $sys_dir -h $home_dir cmd-foo cmd-bar >>EOO
    sys-foo
    sys-bar
    sys-local-foo
    sys-local-bar
    home-foo
    home-bar
    home-local-foo
    home-local-bar
    work-foo
    work-bar
    work-local-foo
    work-local-bar
    project-foo
    project-bar
    project-local-foo
    project-local-bar
    package-foo
    package-bar
    package-local-foo
    package-local-bar
    cmd-foo
    cmd-bar
    EOO
}