Skip to content

Commit 60b2d78

Browse files
committed
Add tests for the audio buffer
1 parent 7036ee8 commit 60b2d78

File tree

7 files changed

+48
-18
lines changed

7 files changed

+48
-18
lines changed

scripts/build_and_test.sh

+14-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,20 @@ gcc --version
1515

1616
# Report python version
1717
python3 --version
18-
19-
# Install
20-
python3 -m pip install .[test]
18+
python3 -m pip --version
19+
20+
# Workaround for environment being externally managed in system installed Python 3.11+\
21+
PYTHON_VERSION_MINOR=$(python3 -c "import sys; print(sys.version_info.minor)")
22+
PIP_VERSION_MAJOR=$(python3 -c "import pip; print(pip.__version__.split('.')[0])")
23+
PIP_FLAGS=""
24+
if (( ${PYTHON_VERSION_MINOR} >= 11 && ${PIP_VERSION_MAJOR} >= 23)); then
25+
echo "Adding --break-system-packages flag to pip install"
26+
PIP_FLAGS="--break-system-packages"
27+
fi
28+
29+
# Updgrad pip and install test deps
30+
python3 -m pip install --upgrade pip ${PIP_FLAGS}
31+
python3 -m pip install .[test] ${PIP_FLAGS}
2132

2233
# Test import
2334
python3 -c "import vizdoom"

scripts/install_and_test_wheel.sh

+20-4
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,33 @@ ls -lha .
99

1010
# Report python version
1111
python3 --version
12+
python3 -m pip --version
1213

1314
# Find matching wheel file in wheelhouse
14-
PYTHON_VERSION=$(python3 -c "import sys; print(f'{sys.version_info.major}{sys.version_info.minor}')")
15+
PYTHON_VERSION_MAJOR=$(python3 -c "import sys; print(sys.version_info.major)")
16+
PYTHON_VERSION_MINOR=$(python3 -c "import sys; print(sys.version_info.minor)")
17+
PYTHON_VERSION="${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}"
1518
PYTHON_WHEEL=$(ls wheelhouse/vizdoom-*-cp${PYTHON_VERSION}-cp${PYTHON_VERSION}*.whl)
1619

20+
if [ -z "${PYTHON_WHEEL}" ]; then
21+
echo "No matching wheel file was found"
22+
exit 1
23+
fi
24+
25+
# Workaround for environment being externally managed in system installed Python 3.11+
26+
PIP_VERSION_MAJOR=$(python3 -c "import pip; print(pip.__version__.split('.')[0])")
27+
PIP_FLAGS=""
28+
if (( ${PYTHON_VERSION_MINOR} >= 11 && ${PIP_VERSION_MAJOR} >= 23)); then
29+
echo "Adding --break-system-packages flag to pip install"
30+
PIP_FLAGS="--break-system-packages"
31+
fi
32+
1733
# Updgrad pip and install test deps
18-
python3 -m pip install --upgrade pip
19-
python3 -m pip install pytest psutil
34+
python3 -m pip install --upgrade pip ${PIP_FLAGS}
35+
python3 -m pip install pytest psutil ${PIP_FLAGS}
2036

2137
# Install wheel
22-
python3 -m pip install ${PYTHON_WHEEL}
38+
python3 -m pip install ${PYTHON_WHEEL} ${PIP_FLAGS}
2339

2440
# Test import
2541
python3 -c "import vizdoom"

tests/build_test_cibuildwheel_linux.sh

+6-6
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ IMAGE_PREFIX="vizdoom_wheels"
1313

1414
# Array in format "<base docker image> <base dockerfile to use> <additional commands to add to the dockerfile after FROM statement>"
1515
DOCKERFILES_TO_BUILD_AND_RUN=(
16-
"almalinux:9 dnf-based.Dockerfile RUN dnf install -y 'dnf-command(config-manager)' && dnf config-manager --set-enabled crb" # Python 3.9
17-
"fedora:36 dnf-based.Dockerfile" # Python 3.10
18-
"fedora:37 dnf-based.Dockerfile" # Python 3.11
19-
"rockylinux:9 dnf-based.Dockerfile RUN dnf install -y 'dnf-command(config-manager)' && dnf config-manager --set-enabled crb" # Python 3.9
20-
"debian:11 apt-based.Dockerfile ENV LANG C.UTF-8" # Python 3.9
16+
#"almalinux:9 dnf-based.Dockerfile RUN dnf install -y 'dnf-command(config-manager)' && dnf config-manager --set-enabled crb" # Python 3.9
17+
#"fedora:36 dnf-based.Dockerfile" # Python 3.10
18+
#"fedora:37 dnf-based.Dockerfile" # Python 3.11
19+
#"rockylinux:9 dnf-based.Dockerfile RUN dnf install -y 'dnf-command(config-manager)' && dnf config-manager --set-enabled crb" # Python 3.9
20+
#"debian:11 apt-based.Dockerfile ENV LANG C.UTF-8" # Python 3.9
2121
"debian:latest apt-based.Dockerfile ENV LANG C.UTF-8" # Python 3.11
2222
"ubuntu:20.04 apt-based.Dockerfile" # Python 3.8
2323
"ubuntu:22.04 apt-based.Dockerfile" # Python 3.10
@@ -28,7 +28,7 @@ DOCKERFILES_TO_BUILD_AND_RUN=(
2828
# Build wheels using cibuildwheel
2929
cd $REPO_ROOT
3030
#export CIBW_BUILD_VERBOSITY=3 # Uncomment to see full build logs
31-
cibuildwheel --platform linux --arch $(uname -m)
31+
#cibuildwheel --platform linux --arch $(uname -m)
3232

3333
function create_dockerfile ( ) {
3434
local all_args=("$@")

tests/build_test_local_linux_builds.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ IMAGE_PREFIX="vizdoom_local"
1212
# Generate and run dockerfiles
1313
# Array in format "<base docker image> <base dockerfile to use> <additional commands to add to the dockerfile after FROM statement>"
1414
DOCKERFILES_TO_BUILD_AND_RUN=(
15-
"almalinux:9 dnf-based.Dockerfile RUN dnf install -y 'dnf-command(config-manager)' && dnf config-manager --set-enabled crb"
16-
"tgagor/centos:stream9 dnf-based.Dockerfile RUN dnf install -y 'dnf-command(config-manager)' && dnf config-manager --set-enabled crb"
17-
"fedora:36 dnf-based.Dockerfile"
15+
#"almalinux:9 dnf-based.Dockerfile RUN dnf install -y 'dnf-command(config-manager)' && dnf config-manager --set-enabled crb"
16+
#"tgagor/centos:stream9 dnf-based.Dockerfile RUN dnf install -y 'dnf-command(config-manager)' && dnf config-manager --set-enabled crb"
17+
#"fedora:36 dnf-based.Dockerfile"
1818
"fedora:37 dnf-based.Dockerfile"
1919
"rockylinux:9 dnf-based.Dockerfile RUN dnf install -y 'dnf-command(config-manager)' && dnf config-manager --set-enabled crb"
2020
"debian:11 apt-based.Dockerfile ENV LANG C.UTF-8"

tests/local_builds_dockerfiles/apt-based.Dockerfile

+3
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,8 @@ WORKDIR v/izdoom
99
RUN apt update && apt install -y build-essential cmake git libboost-all-dev libsdl2-dev libopenal-dev python3-dev python3-pip
1010
#RUN apt update && apt install -y build-essential cmake libboost-all-dev libsdl2-dev libfreetype-dev libopenal-dev python3-dev python3-pip
1111

12+
# Install all possible dependencies
13+
#RUN apt update && apt install -y build-essential cmake git libsdl2-dev libboost-all-dev libopenal-dev zlib1g-dev libjpeg-dev tar libbz2-dev libgtk2.0-dev libfluidsynth-dev libgme-dev timidity libwildmidi-dev unzip
14+
1215
COPY . ./
1316
CMD ["bash", "./scripts/build_and_test.sh"]

tests/test_get_state.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def test_get_state(num_iterations=10, num_states=20):
147147
automapBuffer=True,
148148
objectsInfo=True,
149149
sectorsInfo=True,
150-
audioBuffer=True, # Turned off by default, because it fails on some systems without audio backend and OpenAL installed
150+
audioBuffer=False, # Turned off by default, because it fails on some systems without audio backend and OpenAL installed
151151
)
152152

153153

tests/wheels_test_dockerfiles/conda-based.Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ FROM continuumio/miniconda3:latest
22

33
WORKDIR /vizdoom
44

5-
RUN conda install -y -c openal-soft
5+
RUN apt update && apt install -y libopenal1
66

77
COPY . ./
88
CMD ["bash", "./scripts/install_and_test_wheel.sh"]

0 commit comments

Comments
 (0)