зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1799338 - Fix build with --disable-backgroundtasks. r=glandium
MOZ_BACKGROUNDTASKS should be undefined when the feature is disabled. Add some more tests for `when` parameter of set_config() and set_define(). Differential Revision: https://phabricator.services.mozilla.com/D161400
This commit is contained in:
Родитель
53d2f5c45d
Коммит
567b4f4679
|
@ -4,30 +4,22 @@
|
|||
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
|
||||
from six import StringIO
|
||||
import os
|
||||
import six
|
||||
import sys
|
||||
import textwrap
|
||||
import unittest
|
||||
|
||||
from mozunit import (
|
||||
main,
|
||||
MockedOpen,
|
||||
)
|
||||
|
||||
import mozpack.path as mozpath
|
||||
import six
|
||||
from mozbuild.configure import ConfigureError, ConfigureSandbox
|
||||
from mozbuild.configure.options import (
|
||||
InvalidOptionError,
|
||||
NegativeOptionValue,
|
||||
PositiveOptionValue,
|
||||
)
|
||||
from mozbuild.configure import (
|
||||
ConfigureError,
|
||||
ConfigureSandbox,
|
||||
)
|
||||
from mozbuild.util import exec_, memoized_property, ReadOnlyNamespace
|
||||
|
||||
import mozpack.path as mozpath
|
||||
from mozbuild.util import ReadOnlyNamespace, exec_, memoized_property
|
||||
from mozunit import MockedOpen, main
|
||||
from six import StringIO
|
||||
|
||||
test_data_path = mozpath.abspath(mozpath.dirname(__file__))
|
||||
test_data_path = mozpath.join(test_data_path, "data")
|
||||
|
@ -571,6 +563,20 @@ class TestConfigure(unittest.TestCase):
|
|||
},
|
||||
)
|
||||
|
||||
def test_set_config_when_disable(self):
|
||||
with self.moz_configure(
|
||||
"""
|
||||
option('--disable-baz', help='Disable baz')
|
||||
set_config('BAZ', True, when='--enable-baz')
|
||||
"""
|
||||
):
|
||||
config = self.get_config()
|
||||
self.assertEqual(config["BAZ"], True)
|
||||
config = self.get_config(["--enable-baz"])
|
||||
self.assertEqual(config["BAZ"], True)
|
||||
config = self.get_config(["--disable-baz"])
|
||||
self.assertEqual(config, {})
|
||||
|
||||
def test_set_define(self):
|
||||
def get_config(*args):
|
||||
return self.get_config(*args, configure="set_define.configure")
|
||||
|
@ -628,6 +634,20 @@ class TestConfigure(unittest.TestCase):
|
|||
},
|
||||
)
|
||||
|
||||
def test_set_define_when_disable(self):
|
||||
with self.moz_configure(
|
||||
"""
|
||||
option('--disable-baz', help='Disable baz')
|
||||
set_define('BAZ', True, when='--enable-baz')
|
||||
"""
|
||||
):
|
||||
config = self.get_config()
|
||||
self.assertEqual(config["DEFINES"]["BAZ"], True)
|
||||
config = self.get_config(["--enable-baz"])
|
||||
self.assertEqual(config["DEFINES"]["BAZ"], True)
|
||||
config = self.get_config(["--disable-baz"])
|
||||
self.assertEqual(config["DEFINES"], {})
|
||||
|
||||
def test_imply_option_simple(self):
|
||||
def get_config(*args):
|
||||
return self.get_config(*args, configure="imply_option/simple.configure")
|
||||
|
|
|
@ -2657,21 +2657,12 @@ include("../build/moz.configure/nss.configure")
|
|||
# Enable or disable running in background task mode: headless for
|
||||
# periodic, short-lived, maintenance tasks.
|
||||
# ==============================================================================
|
||||
|
||||
|
||||
option(
|
||||
"--disable-backgroundtasks",
|
||||
help="Disable running in background task mode",
|
||||
)
|
||||
|
||||
|
||||
@depends("--enable-backgroundtasks")
|
||||
def background_tasks(value):
|
||||
return bool(value)
|
||||
|
||||
|
||||
set_config("MOZ_BACKGROUNDTASKS", background_tasks)
|
||||
set_define("MOZ_BACKGROUNDTASKS", background_tasks)
|
||||
set_config("MOZ_BACKGROUNDTASKS", True, when="--enable-backgroundtasks")
|
||||
set_define("MOZ_BACKGROUNDTASKS", True, when="--enable-backgroundtasks")
|
||||
|
||||
|
||||
# Update-related programs: updater, maintenance service, update agent,
|
||||
|
|
Загрузка…
Ссылка в новой задаче