0001-ci-Use-a-RAM-disk-on-FreeBSD.patch

text/x-patch

Filename: 0001-ci-Use-a-RAM-disk-on-FreeBSD.patch
Type: text/x-patch
Part: 0
Message: CI speed improvements for FreeBSD

Patch

Format: format-patch
Series: patch 0001
Subject: ci: Use a RAM disk on FreeBSD.
File+
src/tools/ci/gcp_freebsd_repartition.sh 11 13
From d47d01edbbf88d1cfc5fa2c48024e3bc85b52eae Mon Sep 17 00:00:00 2001
From: Thomas Munro <thomas.munro@gmail.com>
Date: Sun, 27 Aug 2023 11:01:24 +1200
Subject: [PATCH 1/2] ci: Use a RAM disk on FreeBSD.

Run the tests in a RAM disk.  It's still a UFS file system and is backed
by 20GB of disk, but it avoids a lot of I/O.  This shaves over a minute
off the test_world time, and scales better.
---
 src/tools/ci/gcp_freebsd_repartition.sh | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/src/tools/ci/gcp_freebsd_repartition.sh b/src/tools/ci/gcp_freebsd_repartition.sh
index 2d5e173899..91c0e7f93c 100755
--- a/src/tools/ci/gcp_freebsd_repartition.sh
+++ b/src/tools/ci/gcp_freebsd_repartition.sh
@@ -3,26 +3,24 @@
 set -e
 set -x
 
-# The default filesystem on freebsd gcp images is very slow to run tests on,
-# due to its 32KB block size
-#
-# XXX: It'd probably better to fix this in the image, using something like
-# https://people.freebsd.org/~lidl/blog/re-root.html
-
 # fix backup partition table after resize
 gpart recover da0
 gpart show da0
-# kill swap, so we can delete a partition
-swapoff -a || true
-# (apparently we can only have 4!?)
+
+# delete and re-add swap partition with expanded size
+swapoff -a
 gpart delete -i 3 da0
-gpart add -t freebsd-ufs -l data8k -a 4096 da0
+gpart add -t freebsd-swap -l swapfs -a 4096 da0
 gpart show da0
-newfs -U -b 8192 /dev/da0p3
+swapon -a
+
+# create a file system on a memory disk backed by swap, to minimize I/O
+mdconfig -a -t swap -s20G -u md1
+newfs -b 8192 -U /dev/md1
 
-# Migrate working directory
+# migrate working directory
 du -hs $CIRRUS_WORKING_DIR
 mv $CIRRUS_WORKING_DIR $CIRRUS_WORKING_DIR.orig
 mkdir $CIRRUS_WORKING_DIR
-mount -o noatime /dev/da0p3 $CIRRUS_WORKING_DIR
+mount -o noatime /dev/md1 $CIRRUS_WORKING_DIR
 cp -r $CIRRUS_WORKING_DIR.orig/* $CIRRUS_WORKING_DIR/
-- 
2.41.0