<commit_before>#!/bin/bash
set -eux
IMAGE=$1
SCRIPT=$2

lxd init --auto

lxc launch $IMAGE tester
lxc config device add tester code disk source=`pwd` path=/subiquity
# copy is allowed to fail, in case the subiquity directory being tested
# includes some uncopyable stuff
lxc exec tester -- sh -ec "
    cd ~
    sudo cp -a /subiquity . || true
    [ -d ~/subiquity ]
    "

attempts=0
while ! lxc file pull tester/etc/resolv.conf - 2> /dev/null | grep -q ^nameserver; do
    sleep 1
    attempts=$((attempts+1))
    if [ $attempts -gt 30 ]; then
        lxc file pull tester/etc/resolv.conf
        lxc exec tester -- ps aux
        echo "Network failed to come up after 30 seconds"
        exit 1
    fi
done
if ! lxc file pull tester/etc/resolv.conf - 2> /dev/null | grep ^nameserver | grep -qv 127.0.0.53
then
    echo "systemd-resolved"
    while ! lxc file pull tester/run/systemd/resolve/resolv.conf - 2> /dev/null | grep -v fe80 | grep -q ^nameserver; do
        sleep 1
        attempts=$((attempts+1))
        if [ $attempts -gt 30 ]; then
            echo "Network failed to come up after 30 seconds"
            exit 1
        fi
    done
fi

lxc exec tester -- sh -ec "
    cd ~/subiquity
    ./scripts/installdeps.sh
    $SCRIPT"<commit_msg>wait for cloud-init in test-in-lxd.sh<commit_after>#!/bin/bash
set -eux
IMAGE=$1
SCRIPT=$2

lxd init --auto

lxc launch $IMAGE tester
lxc config device add tester code disk source=`pwd` path=/subiquity
# copy is allowed to fail, in case the subiquity directory being tested
# includes some uncopyable stuff
lxc exec tester -- sh -ec "
    cd ~
    sudo cp -a /subiquity . || true
    [ -d ~/subiquity ]
    "

attempts=0
while ! lxc file pull tester/etc/resolv.conf - 2> /dev/null | grep -q ^nameserver; do
    sleep 1
    attempts=$((attempts+1))
    if [ $attempts -gt 30 ]; then
        lxc file pull tester/etc/resolv.conf
        lxc exec tester -- ps aux
        echo "Network failed to come up after 30 seconds"
        exit 1
    fi
done
if ! lxc file pull tester/etc/resolv.conf - 2> /dev/null | grep ^nameserver | grep -qv 127.0.0.53
then
    echo "systemd-resolved"
    while ! lxc file pull tester/run/systemd/resolve/resolv.conf - 2> /dev/null | grep -v fe80 | grep -q ^nameserver; do
        sleep 1
        attempts=$((attempts+1))
        if [ $attempts -gt 30 ]; then
            echo "Network failed to come up after 30 seconds"
            exit 1
        fi
    done
fi

lxc exec tester -- cloud-init status --wait

lxc exec tester -- sh -ec "
    cd ~/subiquity
    ./scripts/installdeps.sh
    $SCRIPT"
{'fraction_non_alphanumeric': 0.10516103996895615, 'fraction_numerical': 0.022506790842064417, 'mean_word_length': 2.2632911392405064, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4702182', 'n_tokens_mistral': 956, 'n_tokens_neox': 858, 'n_words': 313}