File: run-example

package info (click to toggle)
libopenshot 0.5.0%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 31,228 kB
  • sloc: cpp: 32,692; python: 92; sh: 77; makefile: 21; ruby: 5
file content (85 lines) | stat: -rwxr-xr-x 2,217 bytes parent folder | download | duplicates (2)
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/bin/bash
set -e

echo "=== Running example executables ==="

# Apply quilt patches if they exist
if [ -d "debian/patches" ]; then
    echo "Applying quilt patches..."
    export QUILT_PATCHES=debian/patches
    quilt push -a || true
fi

# Copy examples to test temp directory
cp -r examples "$AUTOPKGTEST_TMP/"

# Copy test data file to temp directory
cp debian/tests/a.osp "$AUTOPKGTEST_TMP/"

# Create temporary build directory
BUILD_DIR=$(mktemp -d)
cd "$BUILD_DIR"

echo "Build directory: $BUILD_DIR"

# Copy examples source from AUTOPKGTEST_TMP
cp -r "$AUTOPKGTEST_TMP/examples"/* .

# Copy test data file
cp "$AUTOPKGTEST_TMP/a.osp" .

# Configure and build
echo "Running cmake..."
cmake .

echo "Building examples..."
make -j$(nproc)

# Test openshot-example with offscreen rendering
echo "=== Testing openshot-example ==="
if [ -f "./openshot-example" ]; then
    # Use the a.osp test file
    export QT_QPA_PLATFORM=offscreen
    
    # Run with timeout in case it hangs
    timeout 30s ./openshot-example 2>&1 || {
        EXIT_CODE=$?
        if [ $EXIT_CODE -eq 1 ] || [ $EXIT_CODE -eq 124 ]; then
            echo "openshot-example exited with code $EXIT_CODE (expected for missing project file)"
        else
            echo "ERROR: openshot-example failed unexpectedly"
            exit 1
        fi
    }
    echo "openshot-example test completed"
else
    echo "WARNING: openshot-example not built"
fi

# Test openshot-html-example with offscreen rendering
echo "=== Testing openshot-html-example ==="
if [ -f "./openshot-html-example" ]; then
    export QT_QPA_PLATFORM=offscreen
    
    # Run with timeout - it should exit quickly
    timeout 10s ./openshot-html-example 2>&1 || {
        EXIT_CODE=$?
        if [ $EXIT_CODE -eq 124 ]; then
            echo "WARNING: openshot-html-example timed out"
        else
            echo "openshot-html-example exited with code $EXIT_CODE"
        fi
    }
    echo "openshot-html-example test completed"
else
    echo "WARNING: openshot-html-example not built"
fi

# Note: openshot-player requires GUI, so we skip it in autopkgtest
echo "Skipping openshot-player (requires GUI)"

# Cleanup
cd /
rm -rf "$BUILD_DIR"

echo "=== All tests passed ==="