#!/bin/sh -e
# This is the expected entry point for Cockpit CI; will be called without
# arguments but with an appropriate $TEST_OS, and optionally $TEST_SCENARIO

if [ -n "${TEST_SCENARIO}" ]; then
    export TEST_BROWSER="$TEST_SCENARIO"
fi

# overlays are too big for bot's 10GB /tmp tmpfs
TEST_OVERLAY_DIR="$(pwd)/tmp/run"
mkdir -p $TEST_OVERLAY_DIR

make check

# If successful, report code coverage result to codecov.io
if [ -f ~/.config/codecov-token ]; then
  token=$(cat ~/.config/codecov-token | sed 's/\n//g')
  curl --silent localhost:8080/foo.sh | CODECOV_TOKEN=$token bash
fi
