Skip to content

Commit 55e3d7e

Browse files
committed
Pas headless mode to tests
1 parent 6489d9c commit 55e3d7e

File tree

4 files changed

+22
-3
lines changed

4 files changed

+22
-3
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
build:
1111
timeout-minutes: 30
1212
runs-on: ubuntu-latest
13-
name: build (${{matrix.env.URSIM_VERSION}}-${{matrix.env.ROBOT_MODEL}}-${{matrix.HEADLESS}})
13+
name: build (${{matrix.env.URSIM_VERSION}}-${{matrix.env.ROBOT_MODEL}}-${{matrix.HEADLESS && 'headless' || 'urcap'}})
1414
strategy:
1515
fail-fast: false
1616
matrix:
@@ -79,15 +79,15 @@ jobs:
7979
uses: actions/upload-artifact@v4
8080
if: always()
8181
with:
82-
name: ${{matrix.env.ROBOT_MODEL}}_${{matrix.env.URSIM_VERSION}}_URSim_Logs
82+
name: ${{matrix.env.ROBOT_MODEL}}_${{matrix.env.URSIM_VERSION}}-${{matrix.HEADLESS && 'headless' || 'urcap'}}_URSim_Logs
8383
path: ursim_logs
8484
if-no-files-found: error
8585
retention-days: 10
8686
- name: Upload test artifacts
8787
uses: actions/upload-artifact@v4
8888
if: always()
8989
with:
90-
name: ${{matrix.env.ROBOT_MODEL}}_${{matrix.env.URSIM_VERSION}}_test_artifacts
90+
name: ${{matrix.env.ROBOT_MODEL}}_${{matrix.env.URSIM_VERSION}}-${{matrix.HEADLESS && 'headless' || 'urcap'}}_test_artifacts
9191
path: test_artifacts
9292
if-no-files-found: error
9393
retention-days: 10

tests/test_instruction_executor.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
// -- END LICENSE BLOCK ------------------------------------------------
3030

3131
#include <gtest/gtest.h>
32+
#include <iostream>
3233
#include <thread>
3334
#include "ur_client_library/ur/instruction_executor.h"
3435
#include "ur_client_library/control/motion_primitives.h"
@@ -55,6 +56,12 @@ class InstructionExecutorTest : public ::testing::Test
5556
{
5657
// Setup driver
5758
bool headless_mode = false;
59+
auto headless_env = std::getenv("HEADLESS_MODE");
60+
if (headless_env != nullptr)
61+
{
62+
headless_mode = std::string(headless_env) == "true" || std::string(headless_env) == "1" ||
63+
std::string(headless_env) == "True" || std::string(headless_env) == "TRUE";
64+
}
5865
g_my_robot = std::make_unique<ExampleRobotWrapper>(ROBOT_IP, OUTPUT_RECIPE, INPUT_RECIPE, headless_mode,
5966
"external_control.urp", SCRIPT_FILE);
6067
}

tests/test_spline_interpolation.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,12 @@ class SplineInterpolationTest : public ::testing::Test
9797

9898
// Setup driver
9999
bool headless_mode = false;
100+
auto headless_env = std::getenv("HEADLESS_MODE");
101+
if (headless_env != nullptr)
102+
{
103+
headless_mode = std::string(headless_env) == "true" || std::string(headless_env) == "1" ||
104+
std::string(headless_env) == "True" || std::string(headless_env) == "TRUE";
105+
}
100106
g_my_robot = std::make_unique<ExampleRobotWrapper>(g_ROBOT_IP, OUTPUT_RECIPE, INPUT_RECIPE, headless_mode,
101107
"external_control.urp", SPLINE_SCRIPT_FILE);
102108

tests/test_ur_driver.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ class UrDriverTest : public ::testing::Test
5252
{
5353
// Setup driver
5454
bool headless_mode = false;
55+
auto headless_env = std::getenv("HEADLESS_MODE");
56+
if (headless_env != nullptr)
57+
{
58+
headless_mode = std::string(headless_env) == "true" || std::string(headless_env) == "1" ||
59+
std::string(headless_env) == "True" || std::string(headless_env) == "TRUE";
60+
}
5561
g_my_robot = std::make_unique<ExampleRobotWrapper>(g_ROBOT_IP, OUTPUT_RECIPE, INPUT_RECIPE, headless_mode,
5662
"external_control.urp", SCRIPT_FILE);
5763

0 commit comments

Comments
 (0)