Debian Codegraph @

src/tools/ci/gcp_ram_disk.sh

raw
1 #!/bin/sh
2 # Move working directory into a RAM disk for better performance.
3
4 set -e
5 set -x
6
7 mv $CIRRUS_WORKING_DIR $CIRRUS_WORKING_DIR.orig
8 mkdir $CIRRUS_WORKING_DIR
9
10 case "`uname`" in
11 FreeBSD|NetBSD)
12 mount -t tmpfs tmpfs $CIRRUS_WORKING_DIR
13 ;;
14 OpenBSD)
15 umount /dev/sd0j # unused /usr/obj partition
16 printf "m j\n\n\nswap\nw\nq\n" | disklabel -E sd0
17 swapon /dev/sd0j
18 # Remove the per-process data segment limit so that mount_mfs can allocate
19 # large memory filesystems. Without this, mount_mfs mmap() may fail with
20 # "Cannot allocate memory" if the requested size exceeds the current
21 # datasize limit.
22 ulimit -d unlimited
23 mount -t mfs -o rw,noatime,nodev,-s=10000000 swap $CIRRUS_WORKING_DIR
24 ;;
25 esac
26
27 cp -a $CIRRUS_WORKING_DIR.orig/. $CIRRUS_WORKING_DIR/