summaryrefslogtreecommitdiff
path: root/src/tools/ci/gcp_ram_disk.sh
blob: 18dbb2037f5dc4c32cc34ef8e32efb3a539e7a99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/sh
# Move working directory into a RAM disk for better performance.

set -e
set -x

mv $CIRRUS_WORKING_DIR $CIRRUS_WORKING_DIR.orig
mkdir $CIRRUS_WORKING_DIR

case "`uname`" in
  FreeBSD|NetBSD)
    mount -t tmpfs tmpfs $CIRRUS_WORKING_DIR
    ;;
  OpenBSD)
    umount /dev/sd0j # unused /usr/obj partition
    printf "m j\n\n\nswap\nw\nq\n" | disklabel -E sd0
    swapon /dev/sd0j
    # Remove the per-process data segment limit so that mount_mfs can allocate
    # large memory filesystems. Without this, mount_mfs mmap() may fail with
    # "Cannot allocate memory" if the requested size exceeds the current
    # datasize limit.
    ulimit -d unlimited
    mount -t mfs -o rw,noatime,nodev,-s=10000000 swap $CIRRUS_WORKING_DIR
    ;;
esac

cp -a $CIRRUS_WORKING_DIR.orig/. $CIRRUS_WORKING_DIR/