From 40cd01369905435b2bd7e96d132ef10090f04948 Mon Sep 17 00:00:00 2001 From: Johnny Bieren Date: Sep 20 2018 19:42:24 +0000 Subject: Add swap if none exists Signed-off-by: Johnny Bieren --- diff --git a/misc/ltp/test_local.yml b/misc/ltp/test_local.yml index c06c9a5..c7e1e25 100644 --- a/misc/ltp/test_local.yml +++ b/misc/ltp/test_local.yml @@ -37,6 +37,24 @@ dest: "{{builddir}}" version: "{{ltpgitver}}" + - name: Add swap if there isn't over 7.2G + block: + - name: Create swapfile + command: dd if=/dev/zero of=/swapfile bs=1024 count=8388608 + + - name: Format swap + command: mkswap /swapfile + + - name: Turn swap on + command: swapon /swapfile + + - name: Enable swap for reboots + lineinfile: + dest: /etc/fstab + line: "/swapfile swap swap defaults 0 0" + state: present + when: ansible_swaptotal_mb < 7200 + - name: Patch ltp patch: src: ltp-pan-ltp-testname-stamps-in-dmesg-and-console.patch