1 # Any copyright is dedicated to the Public Domain.
2 # http://creativecommons.org/publicdomain/zero/1.0/
9 from mozbuild
.telemetry
import filter_args
11 TELEMETRY_LOAD_ERROR
= """
12 Error loading telemetry. mach output:
13 =========================================================
15 =========================================================
19 def test_path_filtering():
20 srcdir_path
= os
.path
.join(buildconfig
.topsrcdir
, "a")
21 srcdir_path_2
= os
.path
.join(buildconfig
.topsrcdir
, "a/b/c")
22 objdir_path
= os
.path
.join(buildconfig
.topobjdir
, "x")
23 objdir_path_2
= os
.path
.join(buildconfig
.topobjdir
, "x/y/z")
24 home_path
= os
.path
.join(os
.path
.expanduser("~"), "something_in_home")
25 other_path
= "/other/path"
39 buildconfig
.topsrcdir
,
40 buildconfig
.topobjdir
,
41 cwd
=buildconfig
.topsrcdir
,
49 "$HOME/something_in_home",
52 assert args
== expected
55 def test_path_filtering_in_objdir():
56 srcdir_path
= os
.path
.join(buildconfig
.topsrcdir
, "a")
57 srcdir_path_2
= os
.path
.join(buildconfig
.topsrcdir
, "a/b/c")
58 objdir_path
= os
.path
.join(buildconfig
.topobjdir
, "x")
59 objdir_path_2
= os
.path
.join(buildconfig
.topobjdir
, "x/y/z")
60 other_path
= "/other/path"
73 buildconfig
.topsrcdir
,
74 buildconfig
.topobjdir
,
75 cwd
=buildconfig
.topobjdir
,
77 expected
= ["$topsrcdir/a", "$topsrcdir/a/b/c", "x", "x/y/z", "<path omitted>"]
78 assert args
== expected
81 def test_path_filtering_other_cwd(tmpdir
):
82 srcdir_path
= os
.path
.join(buildconfig
.topsrcdir
, "a")
83 srcdir_path_2
= os
.path
.join(buildconfig
.topsrcdir
, "a/b/c")
84 other_path
= str(tmpdir
.join("other"))
87 ["python", "-c", "pass", srcdir_path
, srcdir_path_2
, other_path
],
88 buildconfig
.topsrcdir
,
89 buildconfig
.topobjdir
,
95 # cwd-relative paths should be relativized
98 assert args
== expected
101 if __name__
== "__main__":