Esempio n. 1
0
    # Remove the /tmp entry, because it's mounted as tmpfs -s=ram%25 by default, which isn't enough disk space.
    """ed /etc/fstab << EOF
H
/\\/tmp/d
wq
EOF""",
    "echo sshd=yes >> /etc/rc.conf",
    "echo PermitRootLogin without-password >> /etc/ssh/sshd_config",
    "/etc/rc.d/sshd restart",
    "sync; shutdown -hp now",
]

a = anita.Anita(anita.URL('https://cdn.netbsd.org/pub/NetBSD/NetBSD-9.0/%s/' %
                          arch),
                workdir="work-NetBSD-%s" % arch,
                disk_size="16G",
                memory_size="2G",
                persist=True)
child = a.boot()
anita.login(child)

for cmd in commands:
    anita.shell_cmd(child, cmd, 3600)

# Sometimes, the halt command times out, even though it has completed
# successfully.
try:
    a.halt()
except:
    pass
Esempio n. 2
0
disk_size = '24G'
version = '8.1'
pkg_path = f"http://cdn.NetBSD.org/pub/pkgsrc/packages/NetBSD/{arch}/{version}/All/"
pkgs = "cmake swig3 curl python37 python27 vim ccache ninja-build mozilla-rootcerts git py37-pip py27-pip"
workdir = f"work-{branch}-{arch}"

if args.google_compute_engine:
    out = subprocess.run(['tar', '--version'], stdout=subprocess.PIPE).stdout
    if b'GNU tar' in out:
        tar = 'tar'
    else:
        tar = 'gtar'

a = anita.Anita(anita.URL(find_latest_release(branch, arch)),
                workdir=workdir,
                disk_size=disk_size,
                memory_size="16G",
                persist=True)


def boot_and_run(commands, timeout=1200):
    child = a.boot()
    anita.login(child)
    for cmd in commands:
        rc = anita.shell_cmd(child, cmd, timeout)
        if rc != 0:
            raise Exception("command failed")
    anita.shell_cmd(child, "sync; shutdown -hp now", 1200)
    try:
        a.halt()
    except pexpect.exceptions.EOF:
Esempio n. 3
0
    """cat > /etc/ifconfig.vioif0 << EOF
!dhcpcd vioif0
mtu 1460
EOF""",
    "dhcpcd",
    """ed /etc/fstab << EOF
H
%s/wd0/sd0/
wq
EOF""",
    "sync; shutdown -hp now",
]

a = anita.Anita(anita.URL(find_latest_release(branch, arch)),
                workdir="work-%s-%s" % (branch, arch),
                disk_size="4G",
                memory_size="1G",
                persist=True)
child = a.boot()
anita.login(child)

for cmd in commands:
    anita.shell_cmd(child, cmd, 1200)

# Sometimes, the halt command times out, even though it has completed
# successfully.
try:
    a.halt()
except:
    pass
Esempio n. 4
0
import sys
import anita

arch = sys.argv[1]
release = sys.argv[2]
workdir = sys.argv[3]
disk_size = sys.argv[4]

commands = [
    # See https://code.google.com/p/google-compute-engine/issues/detail?id=77
    "echo 'ignore classless-static-routes;' >> /etc/dhclient.conf",
    "echo 'dhclient=YES' >> /etc/rc.conf",
    "sh /etc/rc.d/dhclient start",
    "env PKG_PATH=http://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/%s/%s/All/ pkg_add curl git zsh sudo tmux" % (arch, release)
]


a = anita.Anita(
    anita.URL("http://ftp.netbsd.org/pub/NetBSD/NetBSD-%s/%s/" % (release, arch)),
    workdir = workdir,
    disk_size = disk_size,
    memory_size = "512M",
    persist = True)
child = a.boot()
anita.login(child)

for cmd in commands:
  anita.shell_cmd(child, cmd, 3600)

Esempio n. 5
0
    "env PKG_PATH=http://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/%s/%s/All/ pkg_add mozilla-rootcerts go14"
    % (arch, release),
    """ed /etc/fstab << EOF
H
%s/wd0/sd0/
wq
EOF""",
    "touch /etc/openssl/openssl.cnf",
    "/usr/pkg/sbin/mozilla-rootcerts install",
    "sync; shutdown -hp now",
]

a = anita.Anita(
    # TODO(bsiegert) use latest
    anita.URL(find_latest_release("netbsd-8", arch)),
    workdir="work-NetBSD-%s" % arch,
    disk_size="4G",
    memory_size="1G",
    persist=True)
child = a.boot()
anita.login(child)

for cmd in commands:
    anita.shell_cmd(child, cmd, 3600)

# Sometimes, the halt command times out, even though it has completed
# successfully.
try:
    a.halt()
except:
    pass
Esempio n. 6
0
    "env PKG_PATH=https://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/%s/%s/All/ pkg_add mozilla-rootcerts go14"
    % (arch, release),
    """ed /etc/fstab << EOF
H
%s/wd0/sd0/
wq
EOF""",
    "touch /etc/openssl/openssl.cnf",
    "/usr/pkg/sbin/mozilla-rootcerts install",
    "sync; shutdown -hp now",
]

a = anita.Anita(
    # TODO(bsiegert) use latest
    anita.URL("https://cdn.NetBSD.org/pub/NetBSD/NetBSD-7.1_RC1/%s/" % arch),
    workdir="work-NetBSD-%s" % arch,
    disk_size="4G",
    memory_size="1G",
    persist=True)
child = a.boot()
anita.login(child)

for cmd in commands:
    anita.shell_cmd(child, cmd, 1200)

# Sometimes, the halt command times out, even though it has completed
# successfully.
try:
    a.halt()
except:
    pass