Skip to content

Commit

Permalink
🧪 TESTS: Enable them and fix (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjsewell authored Dec 7, 2020
1 parent de431b1 commit 4a0e7de
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 56 deletions.
11 changes: 8 additions & 3 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,16 @@ siesta_psml_pps_src_archive: "{{ siesta_psml_pps_src }}.tar.gz"
siesta_psml_pps_code_folder: "/tmp"
siesta_psml_pps_url: "https://gitlab.com/garalb/psml-files/-/archive/{{ siesta_psml_pps_version }}/{{ siesta_psml_pps_src_archive }}"

#
# Tests. Just a few
#
# there is currently a bug that results in tests failing due to insignificant diffs
# https://bugs.launchpad.net/siesta/+bug/1725813
# therefore by default we only test that the runs complete, and do not check them against the expected output
siesta_test_type: completed # check

# Note: running all tests would take of the order of 1h

siesta_tests:
- h2o
- h2o-psml
- mno_ldau

siesta_lua_tests:
Expand Down
10 changes: 0 additions & 10 deletions molecule/default/converge.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
- name: Converge
hosts: all

pre_tasks:
- name: Update apt cache.
apt:
update_cache: yes
cache_valid_time: 600
when: ansible_os_family == 'Debian'

vars:
run_tests: false

roles:
- role: marvel-nccr.siesta
2 changes: 2 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
- name: Install siesta dependencies
become: true
apt:
update_cache: true
cache_valid_time: 86400
name:
- gfortran
- make
Expand Down
9 changes: 9 additions & 0 deletions tasks/psml-pps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,12 @@
mode: "0755"
recurse: true
when: psml_pps_extract.changed

- name: Add release notes (pmsl)
include_role:
name: release_notes
vars:
section: "siesta"
option: "pps"
value: "PSML pseudopotentials have been downloaded to: {{ siesta_data_folder }}"
when: release_notes is defined and release_notes
49 changes: 49 additions & 0 deletions tasks/siesta-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
- name: Install siesta test dependencies
become: true
apt:
name:
- ssh

- name: Set of tests
set_fact:
siesta_all_tests: "{{ siesta_tests }}"

- name: Include Lua tests
set_fact:
siesta_all_tests: "{{ siesta_tests + siesta_lua_tests }}"
when: siesta_enable_flook | bool

# Writing a file to indicate tests have passed ensures they are still run on re-runs of the role,
# if the tests failed on the previous run (in this case siesta_make may not have changed)

- name: Remove test pass indicator
when: siesta_make.changed
file:
path: "{{ siesta_topdir }}/Obj/Tests/TESTS_PASSED"
state: absent

- name: Read test pass indicator
stat:
path: "{{ siesta_topdir }}/Obj/Tests/TESTS_PASSED"
register: siesta_tests_passed

# Use --oversubscribe in case there is only one core in the virtual machine...
# use --allow-run-as-root for when running in test docker
- name: Run siesta tests (type={{ siesta_test_type }})
when: not siesta_tests_passed.stat.exists
shell: make clean; make MPI='mpirun --allow-run-as-root --oversubscribe -np {{ siesta_build_cpus }}' {{ siesta_test_type }}
args:
chdir: "{{ siesta_topdir }}/Obj/Tests/{{ item }}"
with_items: "{{ siesta_all_tests }}"
tags: tests

- name: Write test pass indicator
file:
path: "{{ siesta_topdir }}/Obj/Tests/TESTS_PASSED"
state: touch
modification_time: preserve
access_time: preserve

# fails (return code != 0), if "Test Failed." is found
# - name: check siesta test results
# command: grep -vFxq "Test Failed." "{{ siesta_topdir }}/build/Testing/Temporary/LastTest.log"
21 changes: 11 additions & 10 deletions tasks/siesta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,6 @@
creates: "{{ siesta_topdir }}/Obj/siesta"
register: siesta_make

- import_tasks: tests.yml

- name: Install siesta executable
become: true
copy:
src: "{{ siesta_topdir }}/Obj/siesta"
dest: "{{ siesta_prefix }}/bin"
remote_src: true
mode: '0755'

# This is needed to find the shared libs (notably libgridxc)

- name: add dynamic library path config
Expand All @@ -57,6 +47,17 @@
command: ldconfig
when: ld_conf.changed

- import_tasks: siesta-tests.yml
when: run_tests is defined and run_tests

- name: Install siesta executable
become: true
copy:
src: "{{ siesta_topdir }}/Obj/siesta"
dest: "{{ siesta_prefix }}/bin"
remote_src: true
mode: '0755'

- name: Add release notes (version)
include_role:
name: release_notes
Expand Down
33 changes: 0 additions & 33 deletions tasks/tests.yml

This file was deleted.

0 comments on commit 4a0e7de

Please sign in to comment.