diff --git a/tests/test_build_option.py b/tests/test_build_option.py new file mode 100644 index 0000000000000000000000000000000000000000..2de8132fdb8ab883dc56a805541b78ea6ac8c012 --- /dev/null +++ b/tests/test_build_option.py @@ -0,0 +1,116 @@ +import subprocess +import os +import pytest + + +@pytest.fixture() +def init_build_env(): + def find_top_dir(): + cur_dir = os.getcwd() + while cur_dir != "/": + build_scripts = os.path.join( + cur_dir, 'build/scripts/build_package_list.json') + if os.path.exists(build_scripts): + return cur_dir + cur_dir = os.path.dirname(cur_dir) + os.chdir(find_top_dir()) + subprocess.run(['repo', 'forall', '-c', 'git reset --hard'], + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + subprocess.run(['repo', 'forall', '-c', 'git clean -dfx'], + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + + +class TestBuildOption(): + + # def test_build_only_gn(self): + # proc = subprocess.Popen(['../build_scripts/build.sh', '--product-name', 'wifiiot_hispark_pegasus', + # '--build-only-gn', '--no-prebuilt-sdk'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + # stdout, stderr = proc.communicate() + # assert proc.returncode == 0, "build only gn failed" + + # def test_ccache(self): + # proc = subprocess.Popen(['../build_scripts/build.sh', '--product-name', 'wifiiot_hispark_pegasus', + # '--ccache', '--no-prebuilt-sdk'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + # stdout, stderr = proc.communicate() + # assert proc.returncode == 0, "ccache failed" + + def test_log_level(self): + pass + + def test_rename_last_log(self): + pass + + def test_build_target(self): + pass + + def test_strict_mode(self): + pass + + def test_scalable_mode(self): + pass + + def test_example(self): + pass + + def test_build_platform_name(self): + pass + + def test_build_xts(self): + pass + + def test_ignore_api_check(self): + pass + + def test_load_test_config(self): + pass + + def test_skip_partlist_check(self): + pass + + def test_build_type(self): + pass + + def test_export_param(self): + pass + + def test_gn_args(self): + pass + + def test_fast_rebuild(self): + pass + + def test_root_perf_main(self): + pass + + def test_keep_ninja_going(self): + pass + + def test_build_variant(self): + pass + + def test_device_type(self): + pass + + def test_archive_image(self): + pass + + def test_rom_size_statistics(self): + pass + + def test_stat_ccache(self): + pass + + def test_get_warning_list(self): + pass + + def test_generate_ninja_trace(self): + pass + + def test_compute_overlap_rate(self): + pass + + def test_clean_args(self): + pass + + def test_deps_guard(self): + pass diff --git a/tests/test_gn_template.py b/tests/test_gn_template.py new file mode 100644 index 0000000000000000000000000000000000000000..cae84ede3743d8bcb0ea3d6a904b4e4611a186e4 --- /dev/null +++ b/tests/test_gn_template.py @@ -0,0 +1,52 @@ +import subprocess +import os +import pytest + + +@pytest.fixture() +def init_build_env(): + def find_top_dir(): + cur_dir = os.getcwd() + while cur_dir != "/": + build_scripts = os.path.join( + cur_dir, 'build/scripts/build_package_list.json') + if os.path.exists(build_scripts): + return cur_dir + cur_dir = os.path.dirname(cur_dir) + os.chdir(find_top_dir()) + subprocess.run(['repo', 'forall', '-c', 'git reset --hard'], + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + subprocess.run(['repo', 'forall', '-c', 'git clean -dfx'], + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + + +class TestModuleBuild(): + def test_ohos_shared_library(self): + pass + + def test_ohos_static_library(self): + pass + + def test_ohos_executable(self): + pass + +class TestHapBuild(): + def test_ohos_hap(self): + pass + + def test_ohos_app(self): + pass + +class TestRustBuild(): + def test_ohos_rust_library(self): + pass + + def test_ohos_rust_executable(self): + pass + + def test_ohos_rust_static_library(self): + pass + + def test_ohos_cargo_crate(self): + pass +