From a06ad84777b7f964e2dd1ffa77173ce1cfaf1c92 Mon Sep 17 00:00:00 2001 From: James Hilliard Date: Thu, 21 Jul 2022 17:43:35 -0600 Subject: [PATCH] Fix and run tests on ubuntu 22.04 Also run tests on ubuntu 20.04 as well. Signed-off-by: James Hilliard --- .github/workflows/main.yml | 18 +++++++++++++++--- libgstc/c/libgstc_json.c | 4 ++-- libgstd/gstd_msg_type.c | 2 +- .../python/test_libgstc_python_element_get.py | 4 ++-- .../python/test_libgstc_python_element_set.py | 8 ++++---- .../test_libgstc_python_pipeline_pause.py | 6 +++--- .../test_libgstc_python_pipeline_play.py | 2 +- .../test_libgstc_python_pipeline_stop.py | 4 ++-- .../libgstc/python/test_libgstc_python_read.py | 2 +- .../python/test_libgstc_python_update.py | 2 +- 10 files changed, 32 insertions(+), 20 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4639912d..4b0f4dcf 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 diff --git a/libgstc/c/libgstc_json.c b/libgstc/c/libgstc_json.c index dd9caefc..785427fb 100644 --- a/libgstc/c/libgstc_json.c +++ b/libgstc/c/libgstc_json.c @@ -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'; } @@ -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; diff --git a/libgstd/gstd_msg_type.c b/libgstd/gstd_msg_type.c index 59d30ab1..6afcb258 100644 --- a/libgstd/gstd_msg_type.c +++ b/libgstd/gstd_msg_type.c @@ -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"}, diff --git a/tests/libgstc/python/test_libgstc_python_element_get.py b/tests/libgstc/python/test_libgstc_python_element_get.py index 7c0e4643..7457057f 100755 --- a/tests/libgstc/python/test_libgstc_python_element_get.py +++ b/tests/libgstc/python/test_libgstc_python_element_get.py @@ -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') diff --git a/tests/libgstc/python/test_libgstc_python_element_set.py b/tests/libgstc/python/test_libgstc_python_element_set.py index 7ed59816..4fb99ca1 100755 --- a/tests/libgstc/python/test_libgstc_python_element_set.py +++ b/tests/libgstc/python/test_libgstc_python_element_set.py @@ -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') diff --git a/tests/libgstc/python/test_libgstc_python_pipeline_pause.py b/tests/libgstc/python/test_libgstc_python_pipeline_pause.py index 9ab3f6a5..a1cb16e3 100755 --- a/tests/libgstc/python/test_libgstc_python_pipeline_pause.py +++ b/tests/libgstc/python/test_libgstc_python_pipeline_pause.py @@ -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): @@ -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') diff --git a/tests/libgstc/python/test_libgstc_python_pipeline_play.py b/tests/libgstc/python/test_libgstc_python_pipeline_play.py index 78f5cff6..1e245d83 100755 --- a/tests/libgstc/python/test_libgstc_python_pipeline_play.py +++ b/tests/libgstc/python/test_libgstc_python_pipeline_play.py @@ -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') diff --git a/tests/libgstc/python/test_libgstc_python_pipeline_stop.py b/tests/libgstc/python/test_libgstc_python_pipeline_stop.py index 9cb81868..fb6733e5 100755 --- a/tests/libgstc/python/test_libgstc_python_pipeline_stop.py +++ b/tests/libgstc/python/test_libgstc_python_pipeline_stop.py @@ -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') diff --git a/tests/libgstc/python/test_libgstc_python_read.py b/tests/libgstc/python/test_libgstc_python_read.py index 0b8b63f3..5ae22b9a 100755 --- a/tests/libgstc/python/test_libgstc_python_read.py +++ b/tests/libgstc/python/test_libgstc_python_read.py @@ -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') diff --git a/tests/libgstc/python/test_libgstc_python_update.py b/tests/libgstc/python/test_libgstc_python_update.py index c1efd413..7d0821ad 100755 --- a/tests/libgstc/python/test_libgstc_python_update.py +++ b/tests/libgstc/python/test_libgstc_python_update.py @@ -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')