mozbuild.test.frontend package¶
Submodules¶
mozbuild.test.frontend.test_context module¶
- class mozbuild.test.frontend.test_context.TestContext(methodName='runTest')¶
Bases:
unittest.case.TestCase
- test_context_dirs()¶
- test_context_paths()¶
- test_defaults()¶
- test_type_check()¶
- test_update()¶
- class mozbuild.test.frontend.test_context.TestFiles(methodName='runTest')¶
Bases:
unittest.case.TestCase
- test_aggregate_empty()¶
- test_multiple_bug_components()¶
- test_multiple_patterns()¶
- test_no_recommended_bug_component()¶
If there is no clear count winner, we don’t recommend a bug component.
- test_single_bug_component()¶
- class mozbuild.test.frontend.test_context.TestPaths(methodName='runTest')¶
Bases:
unittest.case.TestCase
- classmethod setUpClass()¶
Hook method for setting up class fixture before running tests in the class.
- test_absolute_path()¶
- test_objdir_path()¶
- test_path()¶
- test_path_typed_hierarchy_list()¶
- test_path_typed_list()¶
- test_path_with_mixed_contexts()¶
- test_source_path()¶
mozbuild.test.frontend.test_emitter module¶
- class mozbuild.test.frontend.test_emitter.TestEmitterBasic(methodName='runTest')¶
Bases:
unittest.case.TestCase
- read_topsrcdir(reader, filter_common=True)¶
- reader(name, enable_tests=False, extra_substs=None)¶
- setUp()¶
Hook method for setting up the test fixture before exercising it.
- tearDown()¶
Hook method for deconstructing the test fixture after testing it.
- test_allow_compiler_warnings()¶
- test_asflags()¶
- test_compile_flags()¶
- test_compile_flags_templates()¶
- test_compile_flags_validation()¶
- test_config_file_substitution()¶
- test_crate_dependency_path_resolution()¶
Test recursive dependencies resolve with the correct paths.
- test_cross_optimize_flags()¶
- test_debug_flags()¶
- test_debug_ldflags()¶
- test_defines()¶
- test_defines_in_flags()¶
- test_dirs_traversal_simple()¶
- test_disable_compiler_warnings()¶
- test_disable_debug_flags()¶
- test_disable_stl_wrapping()¶
- test_empty_test_manifest_rejected()¶
A test manifest without any entries is rejected.
- test_exports()¶
- test_exports_generated()¶
- test_exports_missing()¶
Missing files in EXPORTS is an error.
- test_exports_missing_generated()¶
An objdir file in EXPORTS that is not in GENERATED_FILES is an error.
- test_final_target_pp_files()¶
Test that FINAL_TARGET_PP_FILES works properly.
- test_final_target_pp_files_non_srcdir()¶
Test that non-srcdir paths in FINAL_TARGET_PP_FILES throws errors.
- test_generated_files()¶
- test_generated_files_absolute_script()¶
- test_generated_files_force()¶
- test_generated_files_method_names()¶
- test_generated_files_no_inputs()¶
- test_generated_files_no_python_script()¶
- test_generated_files_no_script()¶
- test_generated_includes()¶
Test that GENERATED_INCLUDES is emitted correctly.
- test_generated_sources()¶
Test that GENERATED_SOURCES works properly.
- test_host_compile_flags()¶
- test_host_no_optimize_flags()¶
- test_host_optimize_flags()¶
- test_host_program_paths()¶
The destination of a HOST_PROGRAM (almost always dist/host/bin) should be accurately reflected in Program.output_path.
- test_host_rtl_flag()¶
- test_host_rust_libraries()¶
Test HOST_RUST_LIBRARIES emission.
- test_host_rust_program_no_cargo_toml()¶
Test that specifying HOST_RUST_PROGRAMS without a Cargo.toml fails.
- test_host_rust_program_nonexistent_name()¶
Test that specifying HOST_RUST_PROGRAMS that don’t exist in Cargo.toml correctly throws an error.
- test_host_rust_programs()¶
Test HOST_RUST_PROGRAMS emission.
- test_host_sources()¶
Test that HOST_SOURCES works properly.
- test_includes_in_flags()¶
Test that we can install a shared library with TEST_HARNESS_FILES
- test_ipdl_sources()¶
- test_jar_manifests()¶
- test_jar_manifests_multiple_files()¶
- test_library_defines()¶
Test that LIBRARY_DEFINES is propagated properly.
- test_link_flags()¶
- test_linkables_cxx_link()¶
Test that linkables transitively set cxx_link properly.
- test_local_includes()¶
Test that LOCAL_INCLUDES is emitted correctly.
- test_local_includes_file()¶
Test that a filename can’t be used in LOCAL_INCLUDES.
- test_local_includes_invalid()¶
Test that invalid LOCAL_INCLUDES are properly detected.
- test_localized_files()¶
Test that LOCALIZED_FILES works properly.
- test_localized_files_from_generated()¶
Test that using LOCALIZED_GENERATED_FILES and then putting the output in LOCALIZED_FILES as an objdir path works.
- test_localized_files_no_en_us()¶
Test that LOCALIZED_FILES errors if a path does not start with en-US/ or contain locales/en-US/.
- test_localized_files_not_localized_generated()¶
Test that using GENERATED_FILES and then putting the output in LOCALIZED_FILES as an objdir path produces an error.
- test_localized_generated_files()¶
- test_localized_generated_files_final_target_files()¶
Test that using LOCALIZED_GENERATED_FILES and then putting the output in FINAL_TARGET_FILES as an objdir path produces an error.
- test_localized_generated_files_force()¶
- test_localized_pp_files()¶
Test that LOCALIZED_PP_FILES works properly.
- test_missing_final_target_pp_files()¶
Test that FINAL_TARGET_PP_FILES with missing files throws errors.
- test_missing_local_includes()¶
LOCAL_INCLUDES containing non-existent directories should be rejected.
- test_multiple_rust_libraries()¶
Test that linking multiple Rust libraries throws an error
- test_object_conflicts()¶
Test that object name conflicts are detected.
- test_program()¶
- test_program_paths()¶
Various moz.build settings that change the destination of PROGRAM should be accurately reflected in Program.output_path.
- test_resolved_flags_error()¶
- test_rust_library_dash_folding()¶
Test that on-disk names of RustLibrary objects convert dashes to underscores.
- test_rust_library_duplicate_features()¶
Test that duplicate RustLibrary features are rejected.
- test_rust_library_features()¶
Test that RustLibrary features are correctly emitted.
- test_rust_library_invalid_crate_type()¶
Test that a RustLibrary Cargo.toml has a permitted crate-type.
- test_rust_library_name_mismatch()¶
Test that defining a RustLibrary that doesn’t match Cargo.toml fails.
- test_rust_library_no_cargo_toml()¶
Test that defining a RustLibrary without a Cargo.toml fails.
- test_rust_library_no_lib_section()¶
Test that a RustLibrary Cargo.toml with no [lib] section fails.
- test_rust_program_no_cargo_toml()¶
Test that specifying RUST_PROGRAMS without a Cargo.toml fails.
- test_rust_program_nonexistent_name()¶
Test that specifying RUST_PROGRAMS that don’t exist in Cargo.toml correctly throws an error.
- test_rust_programs()¶
Test RUST_PROGRAMS emission.
- test_sources()¶
Test that SOURCES works properly.
- test_sources_just_c()¶
Test that a linkable with no C++ sources doesn’t have cxx_link set.
- test_symbols_file()¶
Test that SYMBOLS_FILE works
- test_symbols_file_objdir()¶
Test that a SYMBOLS_FILE in the objdir works
- test_symbols_file_objdir_missing_generated()¶
Test that a SYMBOLS_FILE in the objdir that’s missing from GENERATED_FILES is an error.
- test_test_harness_files()¶
- test_test_harness_files_root()¶
- test_test_manifest_absolute_support_files()¶
Support files starting with ‘/’ are placed relative to the install root
- test_test_manifest_deffered_install_missing()¶
A non-existent shared support file reference produces an error.
- test_test_manifest_dupe_support_files()¶
A test manifest with dupe support-files in a single test is not supported.
- test_test_manifest_includes()¶
Ensure that manifest objects from the emitter list a correct manifest.
- test_test_manifest_install_includes()¶
Ensure that any [include:foo.ini] are copied to the objdir.
- test_test_manifest_just_support_files()¶
A test manifest with no tests but support-files is not supported.
- test_test_manifest_keys_extracted()¶
Ensure all metadata from test manifests is extracted.
- test_test_manifest_missing_manifest()¶
A missing manifest file should result in an error.
- test_test_manifest_missing_test_error()¶
Missing test files should result in error.
- test_test_manifest_missing_test_error_unfiltered()¶
Missing test files should result in error, even when the test list is not filtered.
- test_test_manifest_parent_support_files_dir()¶
support-files referencing a file in a parent directory works.
Support files starting with ‘!’ are given separate treatment, so their installation can be resolved when running tests.
- test_test_manifest_unmatched_generated()¶
- test_traversal_all_vars()¶
- test_traversal_all_vars_enable_tests()¶
- test_unified_sources()¶
Test that UNIFIED_SOURCES works properly.
- test_unified_sources_non_unified()¶
Test that UNIFIED_SOURCES with FILES_PER_UNIFIED_FILE=1 works properly.
- test_use_nasm()¶
- test_variable_passthru()¶
- test_visibility_flags()¶
- test_wasm_compile_flags()¶
- test_wasm_sources()¶
Test that WASM_SOURCES works properly.
- test_windows_dmd_link_flags()¶
- test_windows_opt_link_flags()¶
- test_xpidl_module_missing_sources()¶
Missing XPIDL_SOURCES should be rejected.
- test_xpidl_module_no_sources()¶
XPIDL_MODULE without XPIDL_SOURCES should be rejected.
mozbuild.test.frontend.test_namespaces module¶
- class mozbuild.test.frontend.test_namespaces.Fuga(value)¶
Bases:
object
- class mozbuild.test.frontend.test_namespaces.Piyo(context, value)¶
Bases:
mozbuild.frontend.context.ContextDerivedValue
- lower()¶
- class mozbuild.test.frontend.test_namespaces.TestContext(methodName='runTest')¶
Bases:
unittest.case.TestCase
- test_allowed_set()¶
- test_coercion()¶
- test_context_derived_coercion()¶
- test_context_derived_typed_list()¶
- test_context_derived_typed_list_with_items()¶
- test_key_checking()¶
- test_key_rejection()¶
- test_value_checking()¶
mozbuild.test.frontend.test_reader module¶
- class mozbuild.test.frontend.test_reader.TestBuildReader(methodName='runTest')¶
Bases:
unittest.case.TestCase
- config(name, **kwargs)¶
- file_path(name, *args)¶
- reader(name, enable_tests=False, error_is_fatal=True, **kwargs)¶
- setUp()¶
Hook method for setting up the test fixture before exercising it.
- tearDown()¶
Hook method for deconstructing the test fixture after testing it.
- test_all_mozbuild_paths()¶
- test_dirs_traversal_all_variables()¶
- test_dirs_traversal_no_descend()¶
- test_dirs_traversal_simple()¶
- test_error_bad_dir()¶
- test_error_basic()¶
- test_error_empty_list()¶
- test_error_error_func()¶
- test_error_error_func_ok()¶
- test_error_illegal_path()¶
- test_error_included_from()¶
- test_error_missing_include_path()¶
- test_error_read_unknown_global()¶
- test_error_repeated_dir()¶
- test_error_script_error()¶
- test_error_syntax_error()¶
- test_error_write_bad_value()¶
- test_error_write_unknown_global()¶
- test_files_bad_bug_component()¶
- test_files_bug_component_different_matchers()¶
- test_files_bug_component_final()¶
- test_files_bug_component_simple()¶
- test_files_bug_component_static()¶
- test_find_relevant_mozbuilds()¶
- test_inheriting_variables()¶
- test_invalid_flavor()¶
- test_outside_topsrcdir()¶
- test_read_relevant_mozbuilds()¶
- test_relative_dirs()¶
- test_repeated_dirs_ignored()¶
- test_schedules()¶
mozbuild.test.frontend.test_sandbox module¶
- class mozbuild.test.frontend.test_sandbox.TestMozbuildSandbox(methodName='runTest')¶
Bases:
unittest.case.TestCase
- sandbox(data_path=None, metadata={})¶
- test_config_access()¶
- test_default_state()¶
- test_error()¶
- test_exec_source_reassign_exported()¶
- test_function_args()¶
- test_include_basic()¶
- test_include_error_stack()¶
- test_include_missing()¶
- test_include_outside_topsrcdir()¶
- test_include_relative_from_child_dir()¶
- test_include_topsrcdir_relative()¶
- test_invalid_exports_set_base()¶
- test_path_calculation()¶
- test_special_variables()¶
- test_substitute_config_files()¶
- test_symbol_presence()¶
- test_templates()¶
- class mozbuild.test.frontend.test_sandbox.TestSandbox(methodName='runTest')¶
Bases:
unittest.case.TestCase
- sandbox()¶
- test_exec_compile_error()¶
- test_exec_import_denied()¶
- test_exec_source_illegal_key_set()¶
- test_exec_source_multiple()¶
- test_exec_source_reassign()¶
- test_exec_source_reassign_builtin()¶
- test_exec_source_success()¶
- class mozbuild.test.frontend.test_sandbox.TestedSandbox(context, metadata={}, finder=<mozpack.files.FileFinder object>)¶
Bases:
mozbuild.frontend.reader.MozbuildSandbox
Version of MozbuildSandbox with a little more convenience for testing.
It automatically normalizes paths given to exec_file and exec_source. This helps simplify the test code.
- exec_file(path)¶
Override exec_file to normalize paths and restrict file loading.
Paths will be rejected if they do not fall under topsrcdir or one of the external roots.
- exec_source(source, path='')¶
Execute Python code within a string.
The passed string should contain Python code to be executed. The string will be compiled and executed.
You should almost always go through exec_file() because exec_source() does not perform extra path normalization. This can cause relative paths to behave weirdly.
- normalize_path(path)¶
- source_path(path)¶