|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# SPDX-License-Identifier: BSD-2-Clause |
| 4 | +# SPDX-FileCopyrightText: Copyright (c) 2025 RISC-V International |
| 5 | + |
| 6 | +# Container tests script for riscv-unified-db |
| 7 | + |
| 8 | +set -e |
| 9 | + |
| 10 | +echo "Running container tests..." |
| 11 | + |
| 12 | +# Test 1: Check if we can build the container |
| 13 | +echo "Test 1: Building container..." |
| 14 | +docker build -t riscv-unified-db-test .devcontainer/ |
| 15 | + |
| 16 | +# Test 2: Check if we can run basic commands in the container |
| 17 | +echo "Test 2: Running basic commands in container..." |
| 18 | +docker run --rm riscv-unified-db-test ruby --version |
| 19 | +docker run --rm riscv-unified-db-test python3 --version |
| 20 | +docker run --rm riscv-unified-db-test npm --version |
| 21 | + |
| 22 | +# Test 3: Check if we can install Python packages |
| 23 | +echo "Test 3: Installing Python packages..." |
| 24 | +docker run --rm -v $(pwd):/workspace riscv-unified-db-test pip3 install --break-system-packages -r /workspace/requirements.txt |
| 25 | + |
| 26 | +# Test 4: Check if we can install gems |
| 27 | +echo "Test 4: Installing gems..." |
| 28 | +docker run --rm riscv-unified-db-test gem list bundler |
| 29 | + |
| 30 | +# Test 5: Check if we can run rake tasks |
| 31 | +echo "Test 5: Running rake tasks..." |
| 32 | +docker run --rm -v $(pwd):/workspace riscv-unified-db-test rake --version |
| 33 | + |
| 34 | +# Test 6: Check non-root user exists |
| 35 | +echo "Test 6: Checking non-root user..." |
| 36 | +docker run --rm riscv-unified-db-test id -u vscode |
| 37 | + |
| 38 | +# Test 7: Proxy configuration test |
| 39 | +echo "Test 7: Checking proxy configuration..." |
| 40 | +if [ -n "$http_proxy" ] || [ -n "$https_proxy" ]; then |
| 41 | + echo "Proxy is configured: HTTP_PROXY=$http_proxy, HTTPS_PROXY=$https_proxy" |
| 42 | + # Test proxy connectivity if configured |
| 43 | + docker run --rm -e http_proxy -e https_proxy riscv-unified-db-test env | grep -i proxy |
| 44 | +else |
| 45 | + echo "No proxy configured" |
| 46 | +fi |
| 47 | + |
| 48 | +echo "All container tests passed!" |
0 commit comments