import tests

This commit is contained in:
Peng Wu 2019-04-29 15:28:06 +08:00
parent 341c424f4b
commit 77e7dc2c43
4 changed files with 69 additions and 0 deletions

View File

@ -0,0 +1,2 @@
role_pkgs_req:
- rsync

View File

@ -0,0 +1,4 @@
---
dependencies:
- role: str-common-init

View File

@ -0,0 +1,51 @@
---
- 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=google-noto-emoji-fonts
status="FAIL"
fc-validate -l und_zsye /usr/share/fonts/google-noto-emoji/NotoEmoji-Regular.ttf
if [ $? -eq 0 ]; then
status="PASS"
fi
echo "${status} $TEST" >> {{ remote_artifacts }}/test.log
TEST=google-noto-emoji-color-fonts
status="FAIL"
fc-validate -l und_zsye /usr/share/fonts/google-noto-emoji/NotoColorEmoji.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

12
tests/tests.yml Normal file
View File

@ -0,0 +1,12 @@
- hosts: localhost
roles:
- role: fonts-testing-role
installed_test_name: google-noto-emoji-fonts
tags:
- classic
- gating
required_packages:
- fontconfig
- google-noto-emoji-fonts
- google-noto-emoji-color-fonts