Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
351b1eb
Add a python test driver for comparing screenshots
publixsubfan Jun 15, 2021
b079230
Ensure that key commands are sent as events, so quit is propagated af…
publixsubfan Jun 15, 2021
51e51c4
Make commands more prominent, silence output from glvis in test script
publixsubfan Jun 15, 2021
38c7013
Add a simple test
publixsubfan Jun 15, 2021
fdf2e91
Try adding testing to github actions
publixsubfan Jun 15, 2021
ecbfdf1
Add cmake flag for gh action testing
publixsubfan Jun 15, 2021
4fc4a4d
Fix add_test() command
publixsubfan Jun 15, 2021
acf1d6a
Get verbose output from ctest
publixsubfan Jun 15, 2021
2c79299
Setup python before running tests
publixsubfan Jun 15, 2021
983da14
Always copy test driver script in build
publixsubfan Jun 22, 2021
3927d95
Replace quad mesh/gf testing with saved stream testing
publixsubfan Jun 22, 2021
52a5c45
Store .saved test files in git lfs
publixsubfan Jun 22, 2021
f900320
Add test save files
publixsubfan Jun 22, 2021
e60b9ba
Upload artifacts after running gh actions tests
publixsubfan Jun 22, 2021
3480689
Remove .gitattributes from build directory
publixsubfan Jun 22, 2021
439ab09
Try to enable LFS for github actions
publixsubfan Jun 22, 2021
444cab5
Generate separate names for each tarball
publixsubfan Jun 22, 2021
a97280a
Enable some more output, add more cmake test cases
publixsubfan Jun 22, 2021
8bd509b
Install glxinfo
publixsubfan Jun 22, 2021
44ecc15
Use ubuntu 20.04 - newer mesa package should support msaa
publixsubfan Jun 22, 2021
31e785e
Use original stream files from glvis-web, add screenshot/quit command…
publixsubfan Jun 22, 2021
5cb1cdf
Disable LFS support, because gh actions burns through the quota
publixsubfan Jun 23, 2021
53bd182
Try to read from the back buffer for screenshots when possible
publixsubfan Jun 23, 2021
abd1ed7
Use ssim for baseline comparisons, add baselines
publixsubfan Jun 23, 2021
38b9937
Try to eliminate rendering differences between mac and linux for testing
publixsubfan Jun 23, 2021
8fafdc1
Temporarily disable baseline testing
publixsubfan Jun 23, 2021
2b2354f
Use PSNR as the test metric instead
publixsubfan Jun 23, 2021
4948a41
Use glvis-data repo for testing
publixsubfan Jun 30, 2021
ca40f34
Update to new data location
publixsubfan Jun 30, 2021
86e2277
Move test/ to tests/
publixsubfan Jul 1, 2021
5abdcf9
Add README to tests directory
publixsubfan Jul 1, 2021
239388e
Update CHANGELOG
publixsubfan Jul 1, 2021
2e20e23
Another update for CHANGELOG
publixsubfan Jul 1, 2021
cf8eefc
Update CMakeLists.txt
publixsubfan Jul 1, 2021
f9553da
Update gh-actions paths
publixsubfan Jul 1, 2021
c7bdec8
Small edits
tzanio Jul 4, 2021
328d3d0
make style
tzanio Jul 6, 2021
3115324
Updated tests README
tzanio Jul 6, 2021
62ba8b6
minor
tzanio Jul 6, 2021
8a8333c
Add option to disable HiDPI scaling for running tests
publixsubfan Jul 6, 2021
179f00e
Add documentation
publixsubfan Jul 6, 2021
17f0712
minor
tzanio Jul 6, 2021
5878540
Merge branch 'master' into regression-testing-dev
publixsubfan Jul 22, 2021
18c399f
Post-merge fixups
publixsubfan Jul 22, 2021
e1dd5f4
Temporarily disable cutoff to grab baselines
publixsubfan Jul 22, 2021
0547ab8
Fixing Mac screenshots
publixsubfan Jul 23, 2021
f3f1a11
Fixes for stream handling
publixsubfan Jul 23, 2021
94a7dab
Actually exit the program when SDL/window init fails
publixsubfan Jul 23, 2021
838db5d
Output x server logs to stdout
publixsubfan Jul 23, 2021
fa6b9c1
Cleanup SDL after main thread exits
publixsubfan Jul 23, 2021
8d9cec7
Temporarily disable linux testing
publixsubfan Jul 23, 2021
f1f8b40
Print psnr on success
publixsubfan Jul 23, 2021
81e0eff
Merge branch 'master' into regression-testing-dev
publixsubfan Aug 2, 2021
5a6cbf2
Fixes for glvis running on wayland
publixsubfan Aug 2, 2021
9986f4a
Push key events in signalKeyDown() directly into window event queue
publixsubfan Aug 2, 2021
15f88ee
Use sway instead of xvfb for running headless tests
publixsubfan Aug 2, 2021
e8110bc
Fix build
publixsubfan Aug 2, 2021
18d1342
Pause to allow sway to start up before running glvis
publixsubfan Aug 2, 2021
c799614
Don't run glxinfo on wayland
publixsubfan Aug 2, 2021
c384753
Enable more console output
publixsubfan Aug 2, 2021
c03589d
Try setting XDG_RUNTIME_DIR
publixsubfan Aug 2, 2021
aec0a67
Enable even more debug output
publixsubfan Aug 2, 2021
7cb1d26
Try a different XDG_RUNTIME_DIR
publixsubfan Aug 2, 2021
edbce0f
Set environment variable another way
publixsubfan Aug 2, 2021
ad4d935
Upload screenshots for linux
publixsubfan Aug 2, 2021
7868501
Try exposing before resize cmd to fix wayland issues
publixsubfan Aug 4, 2021
f802396
Use system-specific baselines in automated testing
publixsubfan Aug 9, 2021
945e04e
Update test data submodule
publixsubfan Aug 9, 2021
a5db822
Update baselines again
publixsubfan Aug 9, 2021
98c88e6
Go back to using xvfb, update sdl in gh actions with ppa
publixsubfan Aug 10, 2021
4a5a648
Update tests/README.md
publixsubfan Aug 12, 2021
d4010db
Update tests/README.md
publixsubfan Aug 12, 2021
721a96e
Merge branch 'master' into regression-testing-dev
publixsubfan Aug 13, 2021
bfa98b6
Add 'make rebaseline' target to CMake
publixsubfan Aug 13, 2021
b27748c
Go back to using SSIM with cutoff of 0.99, add expect-fail case
publixsubfan Aug 16, 2021
6fd9233
Update submodule
publixsubfan Aug 16, 2021
f1cdc1f
Update data submodule again
publixsubfan Aug 16, 2021
1d614fc
Update documentation; bump cutoff to 0.999
publixsubfan Aug 16, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 53 additions & 10 deletions .github/workflows/builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,16 @@ jobs:
builds-and-tests:
strategy:
matrix:
os: [ubuntu-20.04, macos-10.15]
target: [debug, optim]
mpi: [sequential]
build-system: [cmake]
include:
- os: ubuntu-18.04
- os: ubuntu-20.04
target: optim
mpi: sequential
build-system: make
- os: ubuntu-18.04
- os: ubuntu-20.04
target: debug
mpi: parallel
build-system: make
Expand All @@ -48,17 +52,13 @@ jobs:
target: debug
mpi: parallel
build-system: make
- os: ubuntu-18.04
target: optim
mpi: sequential
build-system: cmake
name: ${{ matrix.os }}-${{ matrix.target }}-${{ matrix.mpi }}-${{ matrix.build-system }}

runs-on: ${{ matrix.os }}

steps:
- name: get MPI (Linux)
if: matrix.os == 'ubuntu-18.04'
if: matrix.os == 'ubuntu-20.04'
run: |
sudo apt-get update
sudo apt-get install mpich libmpich-dev
Expand Down Expand Up @@ -147,10 +147,13 @@ jobs:
build-system: ${{ matrix.build-system }}
mpi: ${{ matrix.mpi }}

# Install GlVis dependencies with package manager
# Install GLVis dependencies with package manager
- name: get deps (Linux)
if: matrix.os == 'ubuntu-18.04'
if: matrix.os == 'ubuntu-20.04'
run: |
# We need to add a PPA for SDL 2.0.14 - fixes some initialization
# errors for X11
sudo add-apt-repository -y ppa:savoury1/multimedia
sudo apt-get update
sudo apt-get install libfontconfig1-dev libfreetype6-dev libsdl2-dev libglew-dev libglm-dev libpng-dev

Expand All @@ -168,6 +171,7 @@ jobs:
uses: actions/checkout@v2
with:
path: glvis
submodules: recursive

- name: build GLVis (make)
if: matrix.build-system == 'make'
Expand All @@ -179,12 +183,51 @@ jobs:
- name: build GLVis (cmake)
if: matrix.build-system == 'cmake'
run: |
build_type="Release"
build_type="RelWithDebInfo"
[[ ${{ matrix.target }} == "debug" ]] && build_type="Debug";
cd glvis && mkdir build && cd build
cmake \
-D CMAKE_BUILD_TYPE:STRING=${build_type} \
-D ENABLE_TESTS:BOOL=TRUE \
-D mfem_DIR:PATH=${GITHUB_WORKSPACE}/${MFEM_TOP_DIR}/build \
-D GLVIS_BASELINE_SYS=${{ matrix.os }} \
..
make -j3

- name: setup Python
if: matrix.build-system == 'cmake'
uses: actions/setup-python@v2
with:
python-version: 3.9

- name: setup Python packages for testing
if: matrix.build-system == 'cmake'
run: |
python -m pip install --upgrade pip
pip install scikit-image

- name: setup Linux testing dependencies
if: matrix.build-system == 'cmake' && matrix.os == 'ubuntu-20.04'
run: |
sudo apt-get install xvfb

- name: test GLVis (cmake/linux)
if: matrix.build-system == 'cmake' && matrix.os == 'ubuntu-20.04'
run: |
cd glvis && cd build
xvfb-run -a ctest --verbose
tar czvf test_screenshots.tar.gz tests/test.*.png

- name: test GLVis (cmake/mac)
if: matrix.build-system == 'cmake' && matrix.os == 'macos-10.15'
run: |
cd glvis && cd build
ctest --verbose
tar czvf test_screenshots.tar.gz tests/test.*.png

- name: upload test screenshots
if: matrix.build-system == 'cmake'
uses: actions/upload-artifact@v2
with:
name: test-screenshots-${{ matrix.os }}-${{ matrix.target }}-${{ matrix.mpi }}
path: glvis/build/test_screenshots.tar.gz
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "test/data"]
path = tests/data
url = https://github.com/GLVis/data.git
5 changes: 5 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ Version 4.0.1 (development)
- Added build target ("make app") to build a native Mac OS application bundle
that can be double-clicked, added to the Dock, etc.

- Added a new regression test suite based on generated screenshots of stream
files. See the README in the tests directory for more details.

- Fixed an issue with black screenshots on certain OpenGL implementations.


Version 4.0, released on Dec 11, 2020
=====================================
Expand Down
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -328,3 +328,8 @@ add_custom_target(app
GLVis.app/Contents/Resources/GLVis.icns
GLVis.app/Contents/Resources/Credits.rtf
VERBATIM)

if(ENABLE_TESTS)
enable_testing()
add_subdirectory(tests)
endif(ENABLE_TESTS)
5 changes: 5 additions & 0 deletions glvis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1140,6 +1140,7 @@ int main (int argc, char *argv[])
double ms_line_width = gl3::LINE_WIDTH_AA;
int geom_ref_type = Quadrature1D::ClosedUniform;
bool legacy_gl_ctx = false;
bool enable_hidpi = true;

OptionsParser args(argc, argv);

Expand Down Expand Up @@ -1206,6 +1207,9 @@ int main (int argc, char *argv[])
args.AddOption(&legacy_gl_ctx, "-oldgl", "--legacy-gl",
"-anygl", "--any-gl",
"Only try to create a legacy OpenGL (< 2.1) context.");
args.AddOption(&enable_hidpi, "-hidpi", "--high-dpi",
"-nohidpi", "--no-high-dpi",
"Enable/disable support for HiDPI at runtime, if supported.");

cout << endl
<< " _/_/_/ _/ _/ _/ _/" << endl
Expand Down Expand Up @@ -1279,6 +1283,7 @@ int main (int argc, char *argv[])
{
SetLegacyGLOnly(legacy_gl_ctx);
}
SetUseHiDPI(enable_hidpi);

GLVisGeometryRefiner.SetType(geom_ref_type);

Expand Down
12 changes: 10 additions & 2 deletions lib/aux_vis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ float line_w_aa = gl3::LINE_WIDTH_AA;

thread_local SdlWindow * wnd = nullptr;
bool wndLegacyGl = false;
bool wndUseHiDPI = false;
void SDLMainLoop(bool server_mode)
{
SdlWindow::StartSDL(server_mode);
Expand All @@ -68,6 +69,11 @@ void SetLegacyGLOnly(bool status)
wndLegacyGl = true;
}

void SetUseHiDPI(bool status)
{
wndUseHiDPI = status;
}

void MyExpose(GLsizei w, GLsizei h);
void MyExpose();

Expand Down Expand Up @@ -319,8 +325,7 @@ void SetVisualizationScene(VisualizationScene * scene, int view,

if (keys)
{
// SendKeySequence(keys);
CallKeySequence(keys);
SendKeySequence(keys);
}
wnd->getRenderer().setPalette(&locscene->palette);
}
Expand Down Expand Up @@ -933,6 +938,8 @@ int Screenshot(const char *fname, bool convert)
#if GLVIS_DEBUG
cerr << "Screenshot: reading image data from front buffer..." << endl;
#endif
MFEM_WARNING("Screenshot: Reading from the front buffer is unreliable. "
<< " Resulting screenshots may be incorrect." << endl);
glReadBuffer(GL_FRONT);
}
#if defined(GLVIS_USE_LIBTIFF)
Expand Down Expand Up @@ -1113,6 +1120,7 @@ void KeyS()
wnd->screenshot(fname);
cout << "done" << endl;
}
SendExposeEvent();
}

inline GL2PSvertex CreatePrintVtx(gl3::FeedbackVertex v)
Expand Down
2 changes: 2 additions & 0 deletions lib/aux_vis.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,6 @@ GlVisFont * GetFont();
bool SetFont(const vector<std::string>& patterns, int height);
void SetFont(const std::string& fn);

void SetUseHiDPI(bool status);

#endif
34 changes: 27 additions & 7 deletions lib/sdl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,19 @@ bool SdlWindow::createWindow(const char* title, int x, int y, int w, int h,
return false;
}

window_id = SDL_GetWindowID(handle.hwnd);

GLenum err = glewInit();
#ifdef GLEW_ERROR_NO_GLX_DISPLAY
// NOTE: Hacky workaround for Wayland initialization failure
// See https://github.com/nigels-com/glew/issues/172
if (err == GLEW_ERROR_NO_GLX_DISPLAY)
{
cerr << "GLEW: No GLX display found. If you are using Wayland this can "
"be ignored." << endl;
err = GLEW_OK;
}
#endif
if (err != GLEW_OK)
{
cerr << "FATAL: Failed to initialize GLEW: "
Expand Down Expand Up @@ -466,6 +478,11 @@ void SdlWindow::mainLoop()
while (running)
{
mainIter();
if (takeScreenshot)
{
Screenshot(screenshot_file.c_str(), screenshot_convert);
takeScreenshot = false;
}
if (wnd_state == RenderState::SwapPending)
{
#ifdef SDL_VIDEO_DRIVER_COCOA
Expand All @@ -486,11 +503,6 @@ void SdlWindow::mainLoop()
#endif
wnd_state = RenderState::Updated;
}
if (takeScreenshot)
{
Screenshot(screenshot_file.c_str());
takeScreenshot = false;
}
}
#endif
}
Expand Down Expand Up @@ -583,7 +595,6 @@ void SdlWindow::setWindowSize(int w, int h)
{
GetMainThread().SetWindowSize(handle, pixel_scale_x*w, pixel_scale_y*h);
update_before_expose = true;

}

void SdlWindow::setWindowPos(int x, int y)
Expand All @@ -604,15 +615,24 @@ void SdlWindow::signalKeyDown(SDL_Keycode k, SDL_Keymod m)
if (k >= 32 && k < 128)
{
event.type = SDL_TEXTINPUT;
event.text.windowID = window_id;
event.text.text[0] = k;
}
else
{
event.type = SDL_KEYDOWN;
event.key.windowID = window_id;
event.key.keysym.sym = k;
event.key.keysym.mod = m;
}
SDL_PushEvent(&event);
{
lock_guard<mutex> event_lk{event_mutex};
waiting_events.push_back(event);
}
if (is_multithreaded)
{
events_available.notify_all();
}
}

void SdlWindow::swapBuffer()
Expand Down
8 changes: 7 additions & 1 deletion lib/sdl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ class SdlWindow
}
};

int window_id = -1;
Handle handle;
std::unique_ptr<gl3::MeshRenderer> renderer;
static const int high_dpi_threshold = 144;
Expand Down Expand Up @@ -125,6 +126,7 @@ class SdlWindow
//bool requiresExpose;
bool takeScreenshot{false};
std::string screenshot_file;
bool screenshot_convert;

// internal event handlers
void windowEvent(SDL_WindowEvent& ew);
Expand Down Expand Up @@ -234,10 +236,14 @@ class SdlWindow
std::string getSavedKeys() const { return saved_keys; }

/// Queues a screenshot to be taken.
void screenshot(std::string filename)
void screenshot(std::string filename, bool convert = false)
{
takeScreenshot = true;
screenshot_file = filename;
screenshot_convert = convert;
// Queue up an expose, so Screenshot() can pull image from the back
// buffer
signalExpose();
}

void swapBuffer();
Expand Down
Loading