[tests] Add basic test infrastructure
This adds build infrastructure for unit testing the API library using the serial test harness. TODO: this should be replaced with the parallel test harness, as the automake documentation says the serial harness is deprecated. The first and last tests to be run are scripts to initialize the test environment (an X session with a special -modulepath argument and xorg.conf file to pick up x11glvnd) and tear it down after all unit tests are run. This also adds a placeholder directory for a fake vendor library called "GLX_dummy", to be implemented later.
This commit is contained in:
parent
58193778b0
commit
42589ec4c5
|
@ -1 +1 @@
|
|||
SUBDIRS = src
|
||||
SUBDIRS = src tests
|
||||
|
|
|
@ -172,5 +172,6 @@ AC_CONFIG_FILES([Makefile
|
|||
src/GLdispatch/mapi/glapi/gen/Makefile
|
||||
src/GLdispatch/mapi/vnd-glapi/Makefile
|
||||
src/util/glvnd_pthread/Makefile
|
||||
src/util/trace/Makefile])
|
||||
src/util/trace/Makefile
|
||||
tests/Makefile])
|
||||
AC_OUTPUT
|
||||
|
|
3
tests/GLX_dummy/TODO
Normal file
3
tests/GLX_dummy/TODO
Normal file
|
@ -0,0 +1,3 @@
|
|||
This vendor library contains the bare minimum needed to create a GLX drawable
|
||||
and make current to it. It does *not* implement any rendering. This is used by
|
||||
various subtests in the suite.
|
50
tests/Makefile.am
Normal file
50
tests/Makefile.am
Normal file
|
@ -0,0 +1,50 @@
|
|||
# Copyright (c) 2013, NVIDIA CORPORATION.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||
# copy of this software and/or associated documentation files (the
|
||||
# "Materials"), to deal in the Materials without restriction, including
|
||||
# without limitation the rights to use, copy, modify, merge, publish,
|
||||
# distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
# permit persons to whom the Materials are furnished to do so, subject to
|
||||
# the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included
|
||||
# unaltered in all copies or substantial portions of the Materials.
|
||||
# Any additions, deletions, or changes to the original source files
|
||||
# must be clearly indicated in accompanying documentation.
|
||||
#
|
||||
# If only executable code is distributed, then the accompanying
|
||||
# documentation must state that "this software is based in part on the
|
||||
# work of the Khronos Group."
|
||||
#
|
||||
# THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
# MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
|
||||
SUBDIRS = \
|
||||
GLX_dummy
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
TOP_BUILDDIR=$(top_builddir) \
|
||||
ABS_TOP_BUILDDIR=$(abs_top_builddir) \
|
||||
DISPLAY=:0
|
||||
|
||||
TESTS = \
|
||||
init_test_env.sh \
|
||||
fini_test_env.sh
|
||||
|
||||
X11GLVND_DIR = $(top_builddir)/src/x11glvnd
|
||||
|
||||
# Disable annoying "unused" errors
|
||||
AM_CFLAGS = \
|
||||
-Wno-error=unused-variable \
|
||||
-Wno-error=unused-label \
|
||||
-I$(top_builddir)/include \
|
||||
-I$(top_builddir)/src/util \
|
||||
-I$(top_builddir)/src/util/trace \
|
||||
-I$(top_builddir)/src/util/glvnd_pthread
|
||||
|
16
tests/fini_test_env.sh
Executable file
16
tests/fini_test_env.sh
Executable file
|
@ -0,0 +1,16 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ -n "$SKIP_ENV_INIT" ]; then
|
||||
echo "Test environment cleanup skipped"
|
||||
exit 77
|
||||
fi
|
||||
|
||||
echo "Cleaning up test environment"
|
||||
|
||||
XORG_PID=$(cat xorg.pid)
|
||||
|
||||
kill $XORG_PID
|
||||
|
||||
rm xorg.pid
|
||||
|
||||
exit 0
|
20
tests/init_test_env.sh
Executable file
20
tests/init_test_env.sh
Executable file
|
@ -0,0 +1,20 @@
|
|||
#!/bin/bash
|
||||
|
||||
echo -n "Initializing test environment... "
|
||||
|
||||
if [ -n "$SKIP_ENV_INIT" ]; then
|
||||
echo "skipped"
|
||||
exit 77
|
||||
fi
|
||||
echo "(set SKIP_ENV_INIT to disable this step)"
|
||||
|
||||
X -config "$ABS_TOP_BUILDDIR/tests/xorg.2screens.conf" \
|
||||
-modulepath "/usr/lib/xorg/modules/,$ABS_TOP_BUILDDIR/src/x11glvnd/.libs" \
|
||||
-retro -keeptty -noreset \
|
||||
$DISPLAY &> /dev/null &
|
||||
|
||||
echo $! > xorg.pid
|
||||
|
||||
sleep 5
|
||||
|
||||
exit 0
|
115
tests/xorg.2screens.conf
Normal file
115
tests/xorg.2screens.conf
Normal file
|
@ -0,0 +1,115 @@
|
|||
# nvidia-settings: X configuration file generated by nvidia-settings
|
||||
# nvidia-settings: version 322.00 (brnguyen@bbn-weierstrass) Thu Jul 25 14:07:21 PDT 2013
|
||||
|
||||
# nvidia-xconfig: X configuration file generated by nvidia-xconfig
|
||||
# nvidia-xconfig: version 322.00 (brnguyen@bbn-weierstrass) Thu Jul 25 14:07:06 PDT 2013
|
||||
|
||||
Section "Module"
|
||||
Load "x11glvnd"
|
||||
EndSection
|
||||
|
||||
Section "ServerLayout"
|
||||
Identifier "Layout0"
|
||||
Screen 0 "Screen0" 0 0
|
||||
Screen 1 "Screen1" RightOf "Screen0"
|
||||
InputDevice "Keyboard0" "CoreKeyboard"
|
||||
InputDevice "Mouse0" "CorePointer"
|
||||
EndSection
|
||||
|
||||
Section "Files"
|
||||
EndSection
|
||||
|
||||
Section "Module"
|
||||
Load "x11glvnd"
|
||||
Load "glx"
|
||||
EndSection
|
||||
|
||||
Section "InputDevice"
|
||||
|
||||
# generated from default
|
||||
Identifier "Mouse0"
|
||||
Driver "mouse"
|
||||
Option "Protocol" "auto"
|
||||
Option "Device" "/dev/psaux"
|
||||
Option "Emulate3Buttons" "no"
|
||||
Option "ZAxisMapping" "4 5"
|
||||
EndSection
|
||||
|
||||
Section "InputDevice"
|
||||
|
||||
# generated from default
|
||||
Identifier "Keyboard0"
|
||||
Driver "kbd"
|
||||
EndSection
|
||||
|
||||
Section "Monitor"
|
||||
Identifier "Monitor0"
|
||||
VendorName "Unknown"
|
||||
ModelName "NEC LCD1980SXi"
|
||||
HorizSync 31.0 - 82.0
|
||||
VertRefresh 48.0 - 85.0
|
||||
Option "DPMS"
|
||||
EndSection
|
||||
|
||||
Section "Monitor"
|
||||
Identifier "Monitor1"
|
||||
VendorName "Unknown"
|
||||
ModelName "NEC LCD1970NX"
|
||||
HorizSync 31.0 - 81.0
|
||||
VertRefresh 56.0 - 75.0
|
||||
EndSection
|
||||
|
||||
Section "Device"
|
||||
Identifier "Device0"
|
||||
Driver "nvidia"
|
||||
VendorName "NVIDIA Corporation"
|
||||
BoardName "Q12U-1"
|
||||
BusID "PCI:3:0:0"
|
||||
Screen 0
|
||||
EndSection
|
||||
|
||||
Section "Device"
|
||||
Identifier "Device1"
|
||||
Driver "nvidia"
|
||||
VendorName "NVIDIA Corporation"
|
||||
BoardName "Q12U-1"
|
||||
BusID "PCI:3:0:0"
|
||||
Screen 1
|
||||
EndSection
|
||||
|
||||
Section "Screen"
|
||||
Identifier "Screen0"
|
||||
Device "Device0"
|
||||
Monitor "Monitor0"
|
||||
DefaultDepth 24
|
||||
Option "Stereo" "0"
|
||||
Option "metamodes" "DVI-D-0: nvidia-auto-select +0+0"
|
||||
Option "SLI" "Off"
|
||||
Option "MultiGPU" "Off"
|
||||
Option "BaseMosaic" "off"
|
||||
Option "GLVendor" "dummy_0"
|
||||
SubSection "Display"
|
||||
Depth 24
|
||||
EndSubSection
|
||||
EndSection
|
||||
|
||||
Section "Screen"
|
||||
Identifier "Screen1"
|
||||
Device "Device1"
|
||||
Monitor "Monitor1"
|
||||
DefaultDepth 24
|
||||
Option "Stereo" "0"
|
||||
Option "metamodes" "DVI-I-1: nvidia-auto-select +0+0"
|
||||
Option "SLI" "Off"
|
||||
Option "MultiGPU" "Off"
|
||||
Option "BaseMosaic" "off"
|
||||
Option "GLVendor" "dummy_1"
|
||||
SubSection "Display"
|
||||
Depth 24
|
||||
EndSubSection
|
||||
EndSection
|
||||
|
||||
Section "Extensions"
|
||||
Option "Composite" "Disable"
|
||||
EndSection
|
||||
|
60
tests/xorg.conf
Normal file
60
tests/xorg.conf
Normal file
|
@ -0,0 +1,60 @@
|
|||
# nvidia-xconfig: X configuration file generated by nvidia-xconfig
|
||||
# nvidia-xconfig: version 328.00 (brnguyen@bbn-weierstrass) Wed Jul 17 14:21:39 PDT 2013
|
||||
|
||||
Section "Module"
|
||||
Load "x11glvnd"
|
||||
EndSection
|
||||
|
||||
Section "ServerLayout"
|
||||
Identifier "Layout0"
|
||||
Screen 0 "Screen0"
|
||||
InputDevice "Keyboard0" "CoreKeyboard"
|
||||
InputDevice "Mouse0" "CorePointer"
|
||||
EndSection
|
||||
|
||||
Section "Files"
|
||||
EndSection
|
||||
|
||||
Section "InputDevice"
|
||||
|
||||
# generated from default
|
||||
Identifier "Mouse0"
|
||||
Driver "mouse"
|
||||
Option "Protocol" "auto"
|
||||
Option "Device" "/dev/psaux"
|
||||
Option "Emulate3Buttons" "no"
|
||||
Option "ZAxisMapping" "4 5"
|
||||
EndSection
|
||||
|
||||
Section "InputDevice"
|
||||
|
||||
# generated from default
|
||||
Identifier "Keyboard0"
|
||||
Driver "kbd"
|
||||
EndSection
|
||||
|
||||
Section "Monitor"
|
||||
Identifier "Monitor0"
|
||||
VendorName "Unknown"
|
||||
ModelName "Unknown"
|
||||
HorizSync 28.0 - 33.0
|
||||
VertRefresh 43.0 - 72.0
|
||||
Option "DPMS"
|
||||
EndSection
|
||||
|
||||
Section "Device"
|
||||
Identifier "Device0"
|
||||
Driver "nvidia"
|
||||
VendorName "NVIDIA Corporation"
|
||||
EndSection
|
||||
|
||||
Section "Screen"
|
||||
Identifier "Screen0"
|
||||
Device "Device0"
|
||||
Monitor "Monitor0"
|
||||
DefaultDepth 24
|
||||
SubSectionSub "Display"
|
||||
Depth 24
|
||||
EndSubSection
|
||||
EndSection
|
||||
|
Loading…
Reference in a new issue