Skip to content

Commit

Permalink
Fix and run tests on ubuntu 22.04
Browse files Browse the repository at this point in the history
Also run tests on ubuntu 20.04 as well.

Signed-off-by: James Hilliard <[email protected]>
  • Loading branch information
jameshilliard authored and michaelgruner committed Aug 8, 2022
1 parent 6e765c6 commit a06ad84
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 20 deletions.
18 changes: 15 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,29 @@ on:
- develop

jobs:
build:
runs-on: ubuntu-18.04
ubuntu:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-18.04
- ubuntu-20.04
include:
- os: ubuntu-22.04
remove-unwind: fix-unwind

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

steps:
- uses: actions/checkout@v2
- if: ${{ matrix.remove-unwind }}
run: sudo apt remove libunwind-14-dev
- name: Dependecies
run: |
sudo apt update
sudo apt install automake libtool pkg-config libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
sudo apt install libglib2.0-dev libjson-glib-dev gtk-doc-tools libedit-dev libncursesw5-dev
sudo apt install libdaemon-dev libjansson-dev python3-pip python3-setuptools libsoup2.4
sudo apt install libdaemon-dev libjansson-dev python3-pip python3-setuptools libsoup2.4-dev
- name: Generate
run: ./autogen.sh
Expand Down
4 changes: 2 additions & 2 deletions libgstc/c/libgstc_json.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ gstc_json_get_child_char_array (const char *json, const char *parent_name,
* memory copies are necessary in order to preserve data
*/
(*out)[i] = malloc (strlen (string) + 1);
strncpy ((*out)[i], string, strlen (string));
memcpy ((*out)[i], string, strlen (string));
/* Ensure traling null byte is copied */
(*out)[i][strlen (string)] = '\0';
}
Expand Down Expand Up @@ -239,7 +239,7 @@ gstc_json_child_string (const char *json, const char *parent_name,
tmp_string = json_string_value (data);
/* Allocate memory for output */
*out = malloc ((strlen (tmp_string) + 1) * sizeof (char));
strncpy (*out, tmp_string, strlen (tmp_string));
memcpy (*out, tmp_string, strlen (tmp_string));
/* Ensure traling null byte is copied */
(*out)[strlen (tmp_string)] = '\0';
ret = GSTC_OK;
Expand Down
2 changes: 1 addition & 1 deletion libgstd/gstd_msg_type.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
GType
gstd_msg_type_get_type (void)
{
static volatile gsize gstd_msg_type_type = 0;
static gsize gstd_msg_type_type = 0;
static const GFlagsValue gstd_msg_type[] = {
{GST_MESSAGE_UNKNOWN, "GST_MESSAGE_UNKNOWN", "unknown"},
{GST_MESSAGE_UNKNOWN, "GST_MESSAGE_UNKNOWN", "none"},
Expand Down
4 changes: 2 additions & 2 deletions tests/libgstc/python/test_libgstc_python_element_get.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ def test_element_get_property_value(self):
self.gstd_logger = CustomLogger('test_libgstc', loglevel='DEBUG')
self.gstd_client = GstdClient(port=self.port, logger=self.gstd_logger)
self.gstd_client.pipeline_create('p0', pipeline)
self.assertEqual(
self.assertIn(
self.gstd_client.element_get(
'p0',
'v0',
'pattern'),
'Moving ball')
['Moving ball', 'ball'])
self.gstd_client.pipeline_delete('p0')


Expand Down
8 changes: 4 additions & 4 deletions tests/libgstc/python/test_libgstc_python_element_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ def test_element_set_property_value(self):
self.gstd_logger = CustomLogger('test_libgstc', loglevel='DEBUG')
self.gstd_client = GstdClient(port=self.port, logger=self.gstd_logger)
self.gstd_client.pipeline_create('p0', pipeline)
self.assertEqual(
self.assertIn(
self.gstd_client.element_get(
'p0',
'v0',
'pattern'),
'Moving ball')
['Moving ball', 'ball'])
self.gstd_client.element_set('p0', 'v0', 'pattern', 'bar')
self.assertEqual(self.gstd_client.element_get('p0', 'v0',
'pattern'), 'Bar')
self.assertIn(self.gstd_client.element_get('p0', 'v0',
'pattern'), ['Bar', 'bar'])
self.gstd_client.pipeline_delete('p0')


Expand Down
6 changes: 3 additions & 3 deletions tests/libgstc/python/test_libgstc_python_pipeline_pause.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

DEFAULT_STATE_READ_RETRIES = 3
DEFAULT_TIME_BETWEEN_RETRIES = 0.1 #seconds
RUN_STATES = ['RUNNING', 'READY']
RUN_STATES = ['RUNNING', 'running,', 'READY', 'ready']

class TestGstcPipelinePauseMethods(GstdTestRunner):

Expand All @@ -55,8 +55,8 @@ def test_libgstc_python_pipeline_pause(self):
time.sleep(DEFAULT_TIME_BETWEEN_RETRIES)
state = self.gstd_client.read('pipelines/p0/state')['value']
retry -= 1
self.assertEqual(self.gstd_client.read(
'pipelines/p0/state')['value'], 'PAUSED')
self.assertIn(self.gstd_client.read(
'pipelines/p0/state')['value'], ['PAUSED', 'paused'])
self.gstd_client.pipeline_delete('p0')


Expand Down
2 changes: 1 addition & 1 deletion tests/libgstc/python/test_libgstc_python_pipeline_play.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def test_libgstc_python_pipeline_play(self):
self.gstd_client.pipeline_play('p0')
time.sleep(0.1)
self.assertIn(self.gstd_client.read('pipelines/p0/state')
['value'], ['PLAYING'])
['value'], ['PLAYING', 'playing'])
self.gstd_client.pipeline_stop('p0')
self.gstd_client.pipeline_delete('p0')

Expand Down
4 changes: 2 additions & 2 deletions tests/libgstc/python/test_libgstc_python_pipeline_stop.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ def test_libgstc_python_pipeline_stop(self):
self.gstd_client.pipeline_create('p0', pipeline)
self.gstd_client.pipeline_play('p0')
self.gstd_client.pipeline_stop('p0')
self.assertEqual(self.gstd_client.read(
'pipelines/p0/state')['value'], 'NULL')
self.assertIn(self.gstd_client.read(
'pipelines/p0/state')['value'], ['NULL', 'null'])
self.gstd_client.pipeline_delete('p0')


Expand Down
2 changes: 1 addition & 1 deletion tests/libgstc/python/test_libgstc_python_read.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def test_libgstc_python_read(self):
self.gstd_client.pipeline_create('p0', pipeline)
ret = self.gstd_client.read(
'pipelines/p0/elements/v0/properties/pattern')
self.assertEqual(ret['value'], 'Moving ball')
self.assertIn(ret['value'], ['Moving ball', 'ball'])
self.gstd_client.pipeline_stop('p0')
self.gstd_client.pipeline_delete('p0')

Expand Down
2 changes: 1 addition & 1 deletion tests/libgstc/python/test_libgstc_python_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def test_libgstc_python_update(self):
'pipelines/p0/elements/v0/properties/pattern', 'ball')
ret = self.gstd_client.read(
'pipelines/p0/elements/v0/properties/pattern')
self.assertEqual(ret['value'], 'Moving ball')
self.assertIn(ret['value'], ['Moving ball', 'ball'])
self.gstd_client.pipeline_stop('p0')
self.gstd_client.pipeline_delete('p0')

Expand Down

0 comments on commit a06ad84

Please sign in to comment.