From 39a4eaf5ffeffc5ff6b751657952fb4bfd504b9a Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Fri, 17 May 2019 11:42:07 +0800 Subject: [PATCH] import tests --- .../fonts-testing-role/defaults/main.yml | 2 + tests/roles/fonts-testing-role/meta/main.yml | 4 ++ tests/roles/fonts-testing-role/tasks/main.yml | 44 +++++++++++++++++++ tests/tests.yml | 11 +++++ 4 files changed, 61 insertions(+) create mode 100644 tests/roles/fonts-testing-role/defaults/main.yml create mode 100644 tests/roles/fonts-testing-role/meta/main.yml create mode 100644 tests/roles/fonts-testing-role/tasks/main.yml create mode 100644 tests/tests.yml diff --git a/tests/roles/fonts-testing-role/defaults/main.yml b/tests/roles/fonts-testing-role/defaults/main.yml new file mode 100644 index 0000000..af4befe --- /dev/null +++ b/tests/roles/fonts-testing-role/defaults/main.yml @@ -0,0 +1,2 @@ +role_pkgs_req: + - rsync diff --git a/tests/roles/fonts-testing-role/meta/main.yml b/tests/roles/fonts-testing-role/meta/main.yml new file mode 100644 index 0000000..6626402 --- /dev/null +++ b/tests/roles/fonts-testing-role/meta/main.yml @@ -0,0 +1,4 @@ +--- + +dependencies: + - role: str-common-init diff --git a/tests/roles/fonts-testing-role/tasks/main.yml b/tests/roles/fonts-testing-role/tasks/main.yml new file mode 100644 index 0000000..52c00b8 --- /dev/null +++ b/tests/roles/fonts-testing-role/tasks/main.yml @@ -0,0 +1,44 @@ +--- +- name: Check if fontconfig is installed + register: fontconfig_testing_runner + find: + paths: "{{ ansible_env.PATH.split(':') }}" + pattern: fc-validate + +- name: Install fontconfig + when: fontconfig_testing_runner.matched == 0 + block: + - name: Installing fontconfig + package: + name: + - fontconfig + +- name: Start fontconfig tests + block: + - name: Execute tests + shell: | + set -e + log_file="{{ remote_artifacts }}/{{ installed_test_name }}.log" + exec 2>>$log_file 1>>$log_file + echo "Starting fontconfig tests" + TEST=fontconfig + status="FAIL" + fc-validate -l ii /usr/share/fonts/sil-nuosu/NuosuSIL.ttf + if [ $? -eq 0 ]; then + status="PASS" + fi + echo "${status} $TEST" >> {{ remote_artifacts }}/test.log + + - name: Check the results + shell: grep "^FAIL" {{ remote_artifacts }}/test.log + register: test_fails + failed_when: False + + - name: Set role result + set_fact: + role_result_failed: "{{ (test_fails.stdout|d|length > 0) or (test_fails.stderr|d|length > 0) }}" + role_result_msg: "{{ test_fails.stdout|d('tests failed.') }}" + + - include_role: + name: str-common-final + diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..ee68325 --- /dev/null +++ b/tests/tests.yml @@ -0,0 +1,11 @@ +- hosts: localhost + roles: + - role: fonts-testing-role + installed_test_name: sil-nuosu-fonts + tags: + - classic + - gating + required_packages: + - fontconfig + - sil-nuosu-fonts +