|
| 1 | +#!/usr/bin/env python |
| 2 | +# -*- coding: utf-8 -*- |
| 3 | +# Android binary analysis script |
| 4 | +# SPDX-FileCopyrightText: Copyright 2023 LG Electronics Inc. |
| 5 | +# SPDX-License-Identifier: Apache-2.0 |
| 6 | + |
| 7 | + |
| 8 | +import os |
| 9 | +import pytest |
| 10 | + |
| 11 | + |
| 12 | +@pytest.mark.run |
| 13 | +def test_fosslight_android(run_command, android_src_path, android_build_log): |
| 14 | + |
| 15 | + # given |
| 16 | + assert android_src_path, "android_src_path is not set." |
| 17 | + assert android_build_log, "android_build_log is not set." |
| 18 | + |
| 19 | + # when |
| 20 | + command = f"fosslight_android -s {android_src_path} -a {android_build_log} -m" |
| 21 | + success, stdout, stderr = run_command(command) |
| 22 | + |
| 23 | + # then |
| 24 | + assert success is True, f"fosslight_android test_run failed. stderr: {stderr}" |
| 25 | + |
| 26 | + |
| 27 | +@pytest.mark.release |
| 28 | +def test_release_environment(run_command): |
| 29 | + |
| 30 | + # given |
| 31 | + test_result, _, _ = run_command("rm -rf test_result") |
| 32 | + os.makedirs("test_result", exist_ok=True) |
| 33 | + |
| 34 | + # when |
| 35 | + help_result, _, _ = run_command("fosslight_android -h") |
| 36 | + ok_result, _, _ = run_command("fosslight_android -b test/binary.txt -n test/NOTICE.html -c ok") |
| 37 | + nok_result, _, _ = run_command("fosslight_android -b test/binary.txt -n test/NOTICE.html -c nok") |
| 38 | + divide_result, _, _ = run_command("fosslight_android -d test/needtoadd-notice.html") |
| 39 | + |
| 40 | + # then |
| 41 | + assert help_result is True, "Help command failed" |
| 42 | + assert ok_result is True, "OK command failed" |
| 43 | + assert nok_result is True, "NOK command failed" |
| 44 | + assert divide_result is True, "Divide command failed" |
0 commit comments