From 352eb49a345e3811927b4452e049d0eb81dc6811 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Sun, 6 Jan 2019 18:17:37 +0100 Subject: [PATCH 01/88] add yaml config --- azure-pipelines.yml | 76 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 azure-pipelines.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 0000000000..bc5db9c2f1 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,76 @@ +# Python package +# Create and test a Python package on multiple Python versions. +# Add steps that analyze code, save the dist with the build record, publish to a PyPI-compatible index, and more: +# https://docs.microsoft.com/azure/devops/pipelines/languages/python + +trigger: +- master + +jobs: + +- job: 'Linux' + pool: + vmImage: 'Ubuntu-16.04' + strategy: + matrix: + Python35: + python.version: '3.5' + Python36: + python.version: '3.6' + Python37: + python.version: '3.7' + + steps: + - task: UsePythonVersion@0 + inputs: + versionSpec: '$(python.version)' + architecture: 'x64' + + - script: python -m pip install --upgrade pip && pip install -r data/requirements.txt + displayName: 'Install dependencies' + + - script: | + pip install pytest + touch tests/show_gui + python src/urh/cythonext/build.py &> /tmp/build_log.txt + pytest tests + displayName: 'pytest' + +- job: 'Windows' + pool: + vmImage: 'vs2017-win2016' + strategy: + matrix: + Python35-64: + python.version: '3.5' + python.arch: 'x64' + Python35-32: + python.version: '3.5' + python.arch: 'x86' + Python36-64: + python.version: '3.6' + python.arch: 'x64' + Python36-32: + python.version: '3.6' + python.arch: 'x86' + Python37-64: + python.version: '3.7' + python.arch: 'x64' + Python37-32: + python.version: '3.7' + python.arch: 'x86' + + steps: + - task: UsePythonVersion@0 + inputs: + versionSpec: '$(python.version)' + architecture: '$(python.arch)' + + - script: python -m pip install --upgrade pip && pip install -r data/requirements.txt + displayName: 'Install dependencies' + + - script: | + pip install pytest + python src/urh/cythonext/build.py &> /tmp/build_log.txt + pytest tests + displayName: 'pytest' \ No newline at end of file From 4b0317ccf947ef281ce0122af955656cc86563b9 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Sun, 6 Jan 2019 18:22:10 +0100 Subject: [PATCH 02/88] update build trigger --- azure-pipelines.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index bc5db9c2f1..4c9bcc59f5 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -32,7 +32,7 @@ jobs: - script: | pip install pytest touch tests/show_gui - python src/urh/cythonext/build.py &> /tmp/build_log.txt + python setup.py build_ext --inplace pytest tests displayName: 'pytest' @@ -71,6 +71,6 @@ jobs: - script: | pip install pytest - python src/urh/cythonext/build.py &> /tmp/build_log.txt + python setup.py build_ext --inplace pytest tests displayName: 'pytest' \ No newline at end of file From 8905d574ac8f430b4f5ff09a681f56371359a781 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Sun, 6 Jan 2019 18:25:34 +0100 Subject: [PATCH 03/88] add flag --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 4c9bcc59f5..b5a8126bca 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -33,7 +33,7 @@ jobs: pip install pytest touch tests/show_gui python setup.py build_ext --inplace - pytest tests + pytest -s tests displayName: 'pytest' - job: 'Windows' From 7720b3b406e690335a900a76623ba3eb869bec4c Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Sun, 6 Jan 2019 18:32:11 +0100 Subject: [PATCH 04/88] update file --- azure-pipelines.yml | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index b5a8126bca..5b8a57e212 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -26,14 +26,18 @@ jobs: versionSpec: '$(python.version)' architecture: 'x64' - - script: python -m pip install --upgrade pip && pip install -r data/requirements.txt + - script: | + python -m pip install --upgrade pip + pip install -r data/requirements.txt + pip install pytest pytest-xdist displayName: 'Install dependencies' + - script: python setup.py build_ext --inplace + displayName: "Build extensions" + - script: | - pip install pytest touch tests/show_gui - python setup.py build_ext --inplace - pytest -s tests + xvfb-run pytest -s --boxed tests displayName: 'pytest' - job: 'Windows' @@ -66,11 +70,14 @@ jobs: versionSpec: '$(python.version)' architecture: '$(python.arch)' - - script: python -m pip install --upgrade pip && pip install -r data/requirements.txt - displayName: 'Install dependencies' - - script: | + python -m pip install --upgrade pip + pip install -r data/requirements.txt pip install pytest - python setup.py build_ext --inplace - pytest tests - displayName: 'pytest' \ No newline at end of file + displayName: 'Install dependencies' + + - script: python setup.py build_ext --inplace + displayName: "Build extensions" + + - script: pytest tests + displayName: 'pytest' From a097974e52666f51a3f54e415b0c61e9986c53de Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Sun, 6 Jan 2019 18:38:34 +0100 Subject: [PATCH 05/88] skip broken pytest --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 5b8a57e212..9dc453acdc 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -29,7 +29,7 @@ jobs: - script: | python -m pip install --upgrade pip pip install -r data/requirements.txt - pip install pytest pytest-xdist + pip install pytest!=4.1 pytest-xdist displayName: 'Install dependencies' - script: python setup.py build_ext --inplace From 46e946e1e9515f7fa2511b00a9f869b04f0d9475 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Sun, 6 Jan 2019 18:46:33 +0100 Subject: [PATCH 06/88] install deps --- azure-pipelines.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 9dc453acdc..91343a5810 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -30,9 +30,10 @@ jobs: python -m pip install --upgrade pip pip install -r data/requirements.txt pip install pytest!=4.1 pytest-xdist + sudo apt-get install libhackrf-dev librtlsdr-dev displayName: 'Install dependencies' - - script: python setup.py build_ext --inplace + - script: python cython/build.py displayName: "Build extensions" - script: | From 66013e05a192f9f43c726d7e28dfef7030b167d3 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Sun, 6 Jan 2019 18:57:25 +0100 Subject: [PATCH 07/88] add osx --- azure-pipelines.yml | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 91343a5810..67b08af908 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -33,7 +33,7 @@ jobs: sudo apt-get install libhackrf-dev librtlsdr-dev displayName: 'Install dependencies' - - script: python cython/build.py + - script: python src/urh/cythonext/build.py displayName: "Build extensions" - script: | @@ -74,7 +74,7 @@ jobs: - script: | python -m pip install --upgrade pip pip install -r data/requirements.txt - pip install pytest + pip install pytest pytest-faulthandler displayName: 'Install dependencies' - script: python setup.py build_ext --inplace @@ -82,3 +82,24 @@ jobs: - script: pytest tests displayName: 'pytest' + +- job: 'OSX' + pool: + vmImage: 'macOS-10.13' + + steps: + - task: UsePythonVersion@0 + inputs: + versionSpec: 3.7 + + - script: | + python -m pip install --upgrade pip + pip install -r data/requirements.txt + pip install pytest pytest-faulthandler + displayName: 'Install dependencies' + + - script: python setup.py build_ext --inplace + displayName: "Build extensions" + + - script: pytest tests + displayName: 'pytest' \ No newline at end of file From a3b714d6df8ce8fb174eda6e20e657269852e454 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Sun, 6 Jan 2019 19:08:24 +0100 Subject: [PATCH 08/88] adaptions --- azure-pipelines.yml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 67b08af908..57d1dd4a65 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -31,6 +31,8 @@ jobs: pip install -r data/requirements.txt pip install pytest!=4.1 pytest-xdist sudo apt-get install libhackrf-dev librtlsdr-dev + sh -e /etc/init.d/xvfb start + sleep 5 displayName: 'Install dependencies' - script: python src/urh/cythonext/build.py @@ -38,7 +40,7 @@ jobs: - script: | touch tests/show_gui - xvfb-run pytest -s --boxed tests + pytest -s --boxed tests displayName: 'pytest' - job: 'Windows' @@ -80,26 +82,32 @@ jobs: - script: python setup.py build_ext --inplace displayName: "Build extensions" - - script: pytest tests + - script: pytest -s tests displayName: 'pytest' - job: 'OSX' pool: vmImage: 'macOS-10.13' + strategy: + matrix: + Python37: + python.version: '3.7' + steps: - task: UsePythonVersion@0 inputs: - versionSpec: 3.7 + versionSpec: '$(python.arch)' - script: | python -m pip install --upgrade pip pip install -r data/requirements.txt pip install pytest pytest-faulthandler + brew install hackrf librtlsdr displayName: 'Install dependencies' - script: python setup.py build_ext --inplace displayName: "Build extensions" - - script: pytest tests - displayName: 'pytest' \ No newline at end of file + - script: pytest -s tests + displayName: 'pytest' From 99ecd474345ea19df1679100b66e6f554f299893 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Sun, 6 Jan 2019 19:10:14 +0100 Subject: [PATCH 09/88] fix osx --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 57d1dd4a65..b1d88deb2a 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -97,7 +97,7 @@ jobs: steps: - task: UsePythonVersion@0 inputs: - versionSpec: '$(python.arch)' + versionSpec: '$(python.version)' - script: | python -m pip install --upgrade pip From 82c21c37d14bc76f814f99e3241744541b3540e8 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Sun, 6 Jan 2019 19:16:20 +0100 Subject: [PATCH 10/88] start xvfb --- azure-pipelines.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index b1d88deb2a..29e8772ee1 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -30,8 +30,8 @@ jobs: python -m pip install --upgrade pip pip install -r data/requirements.txt pip install pytest!=4.1 pytest-xdist - sudo apt-get install libhackrf-dev librtlsdr-dev - sh -e /etc/init.d/xvfb start + sudo apt-get install libhackrf-dev librtlsdr-dev xvfb + service xvfb start sleep 5 displayName: 'Install dependencies' From 69576aa44c73371ec3c4834b28a995a44e222505 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Sun, 6 Jan 2019 19:23:08 +0100 Subject: [PATCH 11/88] add env var --- azure-pipelines.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 29e8772ee1..2055294ec3 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -9,6 +9,9 @@ trigger: jobs: - job: 'Linux' + env: + DISPLAY=:99.0 + LIBOVERLAY_SCROLLBAR=0 pool: vmImage: 'Ubuntu-16.04' strategy: @@ -31,7 +34,7 @@ jobs: pip install -r data/requirements.txt pip install pytest!=4.1 pytest-xdist sudo apt-get install libhackrf-dev librtlsdr-dev xvfb - service xvfb start + sudo service xvfb start sleep 5 displayName: 'Install dependencies' From 1d162c90ff193c64b032b1c2eb6b3ad223437917 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Sun, 6 Jan 2019 19:24:09 +0100 Subject: [PATCH 12/88] use xfvb run --- azure-pipelines.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 2055294ec3..0c02f17ee4 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -9,9 +9,6 @@ trigger: jobs: - job: 'Linux' - env: - DISPLAY=:99.0 - LIBOVERLAY_SCROLLBAR=0 pool: vmImage: 'Ubuntu-16.04' strategy: @@ -34,8 +31,6 @@ jobs: pip install -r data/requirements.txt pip install pytest!=4.1 pytest-xdist sudo apt-get install libhackrf-dev librtlsdr-dev xvfb - sudo service xvfb start - sleep 5 displayName: 'Install dependencies' - script: python src/urh/cythonext/build.py @@ -43,7 +38,7 @@ jobs: - script: | touch tests/show_gui - pytest -s --boxed tests + DISPLAY=:99.0 LIBOVERLAY_SCROLLBAR=0 xvfb-run pytest -s --boxed tests displayName: 'pytest' - job: 'Windows' From 3e92c08d2a720749554893e646c4908aa3001ee7 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Sun, 6 Jan 2019 19:35:08 +0100 Subject: [PATCH 13/88] start xvfb --- azure-pipelines.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 0c02f17ee4..9c1b14178e 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -33,12 +33,19 @@ jobs: sudo apt-get install libhackrf-dev librtlsdr-dev xvfb displayName: 'Install dependencies' + - script: | + export DISPLAY=:99.0 + export LIBOVERLAY_SCROLLBAR=0 + sh -e xvfb start + sleep 5 + displayName: "Start xvfb" + - script: python src/urh/cythonext/build.py displayName: "Build extensions" - script: | touch tests/show_gui - DISPLAY=:99.0 LIBOVERLAY_SCROLLBAR=0 xvfb-run pytest -s --boxed tests + pytest -s --boxed tests displayName: 'pytest' - job: 'Windows' From 2cf63c64a9f3288a8f988eceef5ba10d99aeda6a Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Sun, 6 Jan 2019 19:36:59 +0100 Subject: [PATCH 14/88] add flag --- azure-pipelines.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 9c1b14178e..2901b558b4 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,8 +1,3 @@ -# Python package -# Create and test a Python package on multiple Python versions. -# Add steps that analyze code, save the dist with the build record, publish to a PyPI-compatible index, and more: -# https://docs.microsoft.com/azure/devops/pipelines/languages/python - trigger: - master @@ -87,7 +82,7 @@ jobs: - script: python setup.py build_ext --inplace displayName: "Build extensions" - - script: pytest -s tests + - script: pytest -s -v tests displayName: 'pytest' - job: 'OSX' @@ -114,5 +109,5 @@ jobs: - script: python setup.py build_ext --inplace displayName: "Build extensions" - - script: pytest -s tests + - script: pytest -s -v tests displayName: 'pytest' From d7f637875124ca3f57c884eae17806de72588b68 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Sun, 6 Jan 2019 19:39:55 +0100 Subject: [PATCH 15/88] adapt path --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 2901b558b4..fe6d1b681c 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -31,7 +31,7 @@ jobs: - script: | export DISPLAY=:99.0 export LIBOVERLAY_SCROLLBAR=0 - sh -e xvfb start + sh -e /usr/bin/Xvfb start sleep 5 displayName: "Start xvfb" From b285e5aeb5b37af5966df8af24994af649d09d9a Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Sun, 6 Jan 2019 19:43:50 +0100 Subject: [PATCH 16/88] use pytest xfvb --- azure-pipelines.yml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index fe6d1b681c..dd2798b99b 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -24,17 +24,10 @@ jobs: - script: | python -m pip install --upgrade pip pip install -r data/requirements.txt - pip install pytest!=4.1 pytest-xdist sudo apt-get install libhackrf-dev librtlsdr-dev xvfb + pip install pytest!=4.1 pytest-xdist pytest-xvfb displayName: 'Install dependencies' - - script: | - export DISPLAY=:99.0 - export LIBOVERLAY_SCROLLBAR=0 - sh -e /usr/bin/Xvfb start - sleep 5 - displayName: "Start xvfb" - - script: python src/urh/cythonext/build.py displayName: "Build extensions" From f779a7c57d8309cd2469ea29f962469971946534 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Sun, 6 Jan 2019 19:58:01 +0100 Subject: [PATCH 17/88] debug windows error --- src/urh/util/Errors.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/urh/util/Errors.py b/src/urh/util/Errors.py index ed953e41c0..86b4c23bd1 100644 --- a/src/urh/util/Errors.py +++ b/src/urh/util/Errors.py @@ -8,6 +8,7 @@ class Errors: @staticmethod def generic_error(title: str, msg: str, detailed_msg: str = None): w = QWidget() + print(title, msg, detailed_msg) if detailed_msg: msg = "Error: " + msg.replace("\n", "
") + "
" + "

----------

" + detailed_msg.replace( From e6599cb3e0a5bcf013b0cd0f4863db4b6682dd41 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Sun, 6 Jan 2019 20:10:32 +0100 Subject: [PATCH 18/88] debug windows error --- src/urh/controller/MainController.py | 38 +++++++++++++--------------- src/urh/util/Errors.py | 1 - 2 files changed, 17 insertions(+), 22 deletions(-) diff --git a/src/urh/controller/MainController.py b/src/urh/controller/MainController.py index ead9d3d946..c4e5e86b0e 100644 --- a/src/urh/controller/MainController.py +++ b/src/urh/controller/MainController.py @@ -325,33 +325,29 @@ def close_protocol(self, protocol): protocol.eliminate() def close_signal_frame(self, signal_frame: SignalFrame): + self.project_manager.write_signal_information_to_project_file(signal_frame.signal) try: - self.project_manager.write_signal_information_to_project_file(signal_frame.signal) - try: - proto = self.signal_protocol_dict[signal_frame] - except KeyError: - proto = None + proto = self.signal_protocol_dict[signal_frame] + except KeyError: + proto = None - if proto is not None: - self.close_protocol(proto) - del self.signal_protocol_dict[signal_frame] + if proto is not None: + self.close_protocol(proto) + del self.signal_protocol_dict[signal_frame] - if self.signal_tab_controller.ui.scrlAreaSignals.minimumHeight() > signal_frame.height(): - self.signal_tab_controller.ui.scrlAreaSignals.setMinimumHeight( - self.signal_tab_controller.ui.scrlAreaSignals.minimumHeight() - signal_frame.height()) + if self.signal_tab_controller.ui.scrlAreaSignals.minimumHeight() > signal_frame.height(): + self.signal_tab_controller.ui.scrlAreaSignals.setMinimumHeight( + self.signal_tab_controller.ui.scrlAreaSignals.minimumHeight() - signal_frame.height()) - if signal_frame.signal is not None: - # Non-Empty Frame (when a signal and not a protocol is opened) - self.file_proxy_model.open_files.discard(signal_frame.signal.filename) + if signal_frame.signal is not None: + # Non-Empty Frame (when a signal and not a protocol is opened) + self.file_proxy_model.open_files.discard(signal_frame.signal.filename) - signal_frame.eliminate() + signal_frame.eliminate() - self.compare_frame_controller.ui.treeViewProtocols.expandAll() - self.set_frame_numbers() - self.refresh_main_menu() - except Exception as e: - Errors.generic_error(self.tr("Failed to close"), str(e), traceback.format_exc()) - self.unsetCursor() + self.compare_frame_controller.ui.treeViewProtocols.expandAll() + self.set_frame_numbers() + self.refresh_main_menu() def add_files(self, filepaths, group_id=0, enforce_sample_rate=None): num_files = len(filepaths) diff --git a/src/urh/util/Errors.py b/src/urh/util/Errors.py index 86b4c23bd1..ed953e41c0 100644 --- a/src/urh/util/Errors.py +++ b/src/urh/util/Errors.py @@ -8,7 +8,6 @@ class Errors: @staticmethod def generic_error(title: str, msg: str, detailed_msg: str = None): w = QWidget() - print(title, msg, detailed_msg) if detailed_msg: msg = "Error: " + msg.replace("\n", "
") + "
" + "

----------

" + detailed_msg.replace( From 3cb5bf1c6d111d5b2dbc5f52f4f353cffccfd594 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Sun, 6 Jan 2019 20:25:11 +0100 Subject: [PATCH 19/88] disable teardown for test --- src/urh/controller/MainController.py | 38 +++++++++++++++------------- tests/QtTestCase.py | 2 ++ 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/src/urh/controller/MainController.py b/src/urh/controller/MainController.py index c4e5e86b0e..ead9d3d946 100644 --- a/src/urh/controller/MainController.py +++ b/src/urh/controller/MainController.py @@ -325,29 +325,33 @@ def close_protocol(self, protocol): protocol.eliminate() def close_signal_frame(self, signal_frame: SignalFrame): - self.project_manager.write_signal_information_to_project_file(signal_frame.signal) try: - proto = self.signal_protocol_dict[signal_frame] - except KeyError: - proto = None + self.project_manager.write_signal_information_to_project_file(signal_frame.signal) + try: + proto = self.signal_protocol_dict[signal_frame] + except KeyError: + proto = None - if proto is not None: - self.close_protocol(proto) - del self.signal_protocol_dict[signal_frame] + if proto is not None: + self.close_protocol(proto) + del self.signal_protocol_dict[signal_frame] - if self.signal_tab_controller.ui.scrlAreaSignals.minimumHeight() > signal_frame.height(): - self.signal_tab_controller.ui.scrlAreaSignals.setMinimumHeight( - self.signal_tab_controller.ui.scrlAreaSignals.minimumHeight() - signal_frame.height()) + if self.signal_tab_controller.ui.scrlAreaSignals.minimumHeight() > signal_frame.height(): + self.signal_tab_controller.ui.scrlAreaSignals.setMinimumHeight( + self.signal_tab_controller.ui.scrlAreaSignals.minimumHeight() - signal_frame.height()) - if signal_frame.signal is not None: - # Non-Empty Frame (when a signal and not a protocol is opened) - self.file_proxy_model.open_files.discard(signal_frame.signal.filename) + if signal_frame.signal is not None: + # Non-Empty Frame (when a signal and not a protocol is opened) + self.file_proxy_model.open_files.discard(signal_frame.signal.filename) - signal_frame.eliminate() + signal_frame.eliminate() - self.compare_frame_controller.ui.treeViewProtocols.expandAll() - self.set_frame_numbers() - self.refresh_main_menu() + self.compare_frame_controller.ui.treeViewProtocols.expandAll() + self.set_frame_numbers() + self.refresh_main_menu() + except Exception as e: + Errors.generic_error(self.tr("Failed to close"), str(e), traceback.format_exc()) + self.unsetCursor() def add_files(self, filepaths, group_id=0, enforce_sample_rate=None): num_files = len(filepaths) diff --git a/tests/QtTestCase.py b/tests/QtTestCase.py index 6c8ca8f76c..762c435115 100644 --- a/tests/QtTestCase.py +++ b/tests/QtTestCase.py @@ -49,6 +49,8 @@ def setUp(self): self.form.show() def tearDown(self): + return + if hasattr(self, "dialog"): self.dialog.close() From e70c771cf73bd3454530bb7e22e3c3498c5d94ca Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Sun, 6 Jan 2019 20:32:30 +0100 Subject: [PATCH 20/88] try different setup --- tests/QtTestCase.py | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/tests/QtTestCase.py b/tests/QtTestCase.py index 762c435115..9767f4bb52 100644 --- a/tests/QtTestCase.py +++ b/tests/QtTestCase.py @@ -22,8 +22,7 @@ class QtTestCase(unittest.TestCase): WAIT_TIMEOUT_BEFORE_NEW = 10 SHOW = os.path.exists(os.path.join(os.path.dirname(os.path.realpath(__file__)), "show_gui")) - @classmethod - def setUpClass(cls): + def setUp(self): import multiprocessing as mp try: mp.set_start_method("spawn") @@ -32,25 +31,13 @@ def setUpClass(cls): assert mp.get_start_method() == "spawn" write_settings() - cls.app = QApplication([cls.__name__]) - - @classmethod - def tearDownClass(cls): - cls.app.quit() - - sip.delete(cls.app) - cls.app = None - QTest.qWait(10) - time.sleep(0.1) + self.app = QApplication([self.__name__]) - def setUp(self): self.form = MainController() if self.SHOW: self.form.show() def tearDown(self): - return - if hasattr(self, "dialog"): self.dialog.close() @@ -65,6 +52,14 @@ def tearDown(self): if sys.platform == "win32" or sys.platform == "darwin": sip.delete(self.form) self.form = None + + self.app.quit() + + sip.delete(self.app) + self.app = None + QTest.qWait(10) + time.sleep(0.1) + if sys.platform == "darwin": gc.collect() From 7e030a5ef7d38c586ebeb6c76feddd7d3d117240 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Sun, 6 Jan 2019 20:38:20 +0100 Subject: [PATCH 21/88] fix constructor --- tests/QtTestCase.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/QtTestCase.py b/tests/QtTestCase.py index 9767f4bb52..88a19f7c4a 100644 --- a/tests/QtTestCase.py +++ b/tests/QtTestCase.py @@ -31,7 +31,7 @@ def setUp(self): assert mp.get_start_method() == "spawn" write_settings() - self.app = QApplication([self.__name__]) + self.app = QApplication(["urh test"]) self.form = MainController() if self.SHOW: From aad1e9014a69ffc1ab474a4d3003a2f9b8f43078 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Sun, 6 Jan 2019 20:43:39 +0100 Subject: [PATCH 22/88] add gc collect --- tests/QtTestCase.py | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/tests/QtTestCase.py b/tests/QtTestCase.py index 88a19f7c4a..ebcb7fc37b 100644 --- a/tests/QtTestCase.py +++ b/tests/QtTestCase.py @@ -22,7 +22,8 @@ class QtTestCase(unittest.TestCase): WAIT_TIMEOUT_BEFORE_NEW = 10 SHOW = os.path.exists(os.path.join(os.path.dirname(os.path.realpath(__file__)), "show_gui")) - def setUp(self): + @classmethod + def setUpClass(cls): import multiprocessing as mp try: mp.set_start_method("spawn") @@ -31,8 +32,18 @@ def setUp(self): assert mp.get_start_method() == "spawn" write_settings() - self.app = QApplication(["urh test"]) + cls.app = QApplication([cls.__name__]) + + @classmethod + def tearDownClass(cls): + cls.app.quit() + + sip.delete(cls.app) + cls.app = None + QTest.qWait(10) + time.sleep(0.1) + def setUp(self): self.form = MainController() if self.SHOW: self.form.show() @@ -52,15 +63,7 @@ def tearDown(self): if sys.platform == "win32" or sys.platform == "darwin": sip.delete(self.form) self.form = None - - self.app.quit() - - sip.delete(self.app) - self.app = None - QTest.qWait(10) - time.sleep(0.1) - - if sys.platform == "darwin": + if sys.platform == "darwin" or sys.platform == "win32": gc.collect() def wait_before_new_file(self): From 67a0932242b6adb465906638a0aea6d0f7231214 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Sun, 6 Jan 2019 20:52:54 +0100 Subject: [PATCH 23/88] increase timeout for ci --- tests/test_simulator.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_simulator.py b/tests/test_simulator.py index e4d447c56f..5313ef5be1 100644 --- a/tests/test_simulator.py +++ b/tests/test_simulator.py @@ -140,11 +140,11 @@ def test_performance(self): # yappi.start() self.network_sdr_plugin_sender.send_raw_data(modulator.modulate(msg_a.encoded_bits), 1) - time.sleep(0.1) + time.sleep(0.5) # send some zeros to simulate the end of a message self.network_sdr_plugin_sender.send_raw_data(np.zeros(self.num_zeros_for_pause, dtype=np.complex64), 1) - time.sleep(0.5) - receive_process.join(20) + time.sleep(1) + receive_process.join(25) logger.info("PROCESS TIME: {0:.2f}ms".format(elapsed.value)) From dcee074535a301cd0a077efac4cc4b1c827f54ff Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Sun, 6 Jan 2019 21:46:17 +0100 Subject: [PATCH 24/88] debug win --- src/urh/controller/MainController.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/urh/controller/MainController.py b/src/urh/controller/MainController.py index ead9d3d946..e4cb251f99 100644 --- a/src/urh/controller/MainController.py +++ b/src/urh/controller/MainController.py @@ -350,6 +350,7 @@ def close_signal_frame(self, signal_frame: SignalFrame): self.set_frame_numbers() self.refresh_main_menu() except Exception as e: + logger.debug(traceback.format_exc()) Errors.generic_error(self.tr("Failed to close"), str(e), traceback.format_exc()) self.unsetCursor() From 81df2b958efd199ec3c0518c0d07a8a39ff51110 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Sun, 6 Jan 2019 22:23:35 +0100 Subject: [PATCH 25/88] catch relpath error --- src/urh/util/ProjectManager.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/urh/util/ProjectManager.py b/src/urh/util/ProjectManager.py index 1092c54e55..74e14b1f6b 100644 --- a/src/urh/util/ProjectManager.py +++ b/src/urh/util/ProjectManager.py @@ -297,14 +297,20 @@ def write_signal_information_to_project_file(self, signal: Signal, tree=None): for signal_tag in root.iter("signal"): existing_filenames[signal_tag.attrib["filename"]] = signal_tag - if os.path.relpath(signal.filename, self.project_path) in existing_filenames.keys(): - signal_tag = existing_filenames[os.path.relpath(signal.filename, self.project_path)] + try: + relative_path = os.path.relpath(signal.filename, self.project_path) + except ValueError: + # Can happen e.g. on Windows when Project is in C:\ and signal on D:\ + relative_path = None + + if relative_path is not None and relative_path in existing_filenames.keys(): + signal_tag = existing_filenames[relative_path] else: # Create new tag signal_tag = ET.SubElement(root, "signal") signal_tag.set("name", signal.name) - signal_tag.set("filename", os.path.relpath(signal.filename, self.project_path)) + signal_tag.set("filename", relative_path if relative_path is not None else signal.filename) signal_tag.set("bit_length", str(signal.bit_len)) signal_tag.set("qad_center", str(signal.qad_center)) signal_tag.set("tolerance", str(signal.tolerance)) From 602471f652be93dc372e92618332cbc70c96ce5f Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Sun, 6 Jan 2019 22:30:23 +0100 Subject: [PATCH 26/88] remove debug line --- src/urh/controller/MainController.py | 1 - src/urh/util/ProjectManager.py | 10 +++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/urh/controller/MainController.py b/src/urh/controller/MainController.py index e4cb251f99..ead9d3d946 100644 --- a/src/urh/controller/MainController.py +++ b/src/urh/controller/MainController.py @@ -350,7 +350,6 @@ def close_signal_frame(self, signal_frame: SignalFrame): self.set_frame_numbers() self.refresh_main_menu() except Exception as e: - logger.debug(traceback.format_exc()) Errors.generic_error(self.tr("Failed to close"), str(e), traceback.format_exc()) self.unsetCursor() diff --git a/src/urh/util/ProjectManager.py b/src/urh/util/ProjectManager.py index 74e14b1f6b..eef4a7c933 100644 --- a/src/urh/util/ProjectManager.py +++ b/src/urh/util/ProjectManager.py @@ -298,19 +298,19 @@ def write_signal_information_to_project_file(self, signal: Signal, tree=None): existing_filenames[signal_tag.attrib["filename"]] = signal_tag try: - relative_path = os.path.relpath(signal.filename, self.project_path) + file_path = os.path.relpath(signal.filename, self.project_path) except ValueError: # Can happen e.g. on Windows when Project is in C:\ and signal on D:\ - relative_path = None + file_path = signal.filename - if relative_path is not None and relative_path in existing_filenames.keys(): - signal_tag = existing_filenames[relative_path] + if file_path in existing_filenames.keys(): + signal_tag = existing_filenames[file_path] else: # Create new tag signal_tag = ET.SubElement(root, "signal") signal_tag.set("name", signal.name) - signal_tag.set("filename", relative_path if relative_path is not None else signal.filename) + signal_tag.set("filename", file_path) signal_tag.set("bit_length", str(signal.bit_len)) signal_tag.set("qad_center", str(signal.qad_center)) signal_tag.set("tolerance", str(signal.tolerance)) From f871adba06d9a4c0e185d262a79f89ec85453bb6 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Sun, 6 Jan 2019 22:46:25 +0100 Subject: [PATCH 27/88] improve log --- azure-pipelines.yml | 16 ++++++++++++++-- src/urh/simulator/Simulator.py | 4 ++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index dd2798b99b..1acf2c8a12 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -25,7 +25,7 @@ jobs: python -m pip install --upgrade pip pip install -r data/requirements.txt sudo apt-get install libhackrf-dev librtlsdr-dev xvfb - pip install pytest!=4.1 pytest-xdist pytest-xvfb + pip install pytest!=4.1 pytest-xdist pytest-xvfb pytest-cov displayName: 'Install dependencies' - script: python src/urh/cythonext/build.py @@ -33,9 +33,21 @@ jobs: - script: | touch tests/show_gui - pytest -s --boxed tests + pytest -s --boxed --junitxml=junit/test-results.xml --cov=src/urh --cov-report=xml --cov-report=html tests displayName: 'pytest' + - task: PublishTestResults@2 + condition: succeededOrFailed() + inputs: + testResultsFiles: '**/test-*.xml' + testRunTitle: 'Publish test results for Python $(python.version)' + + - task: PublishCodeCoverageResults@1 + inputs: + codeCoverageTool: Cobertura + summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/coverage.xml' + reportDirectory: '$(System.DefaultWorkingDirectory)/**/htmlcov' + - job: 'Windows' pool: vmImage: 'vs2017-win2016' diff --git a/src/urh/simulator/Simulator.py b/src/urh/simulator/Simulator.py index a69fe22ab5..fd3e148d63 100644 --- a/src/urh/simulator/Simulator.py +++ b/src/urh/simulator/Simulator.py @@ -502,8 +502,8 @@ def generate_message_from_template(self, template_msg: SimulatorMessage): cmd = self.__fill_counter_values(lbl.external_program) result = util.run_command(cmd, transcript, use_stdin=True) if len(result) != lbl.end - lbl.start: - log_msg = "Result value of external program {} ({}) does not match label length {}" - logger.error(log_msg.format(result, len(result), lbl.end - lbl.start)) + log_msg = "Result value of external program {}: {} ({}) does not match label length {}" + logger.error(log_msg.format(cmd, result, len(result), lbl.end - lbl.start)) continue try: From 5bff4822c2695e27ee96f795b5514a444ade5fa8 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Sun, 6 Jan 2019 23:04:08 +0100 Subject: [PATCH 28/88] winfix --- tests/data/external_program_simulator.py | 6 ++---- tests/test_simulator.py | 9 +++++++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/tests/data/external_program_simulator.py b/tests/data/external_program_simulator.py index d579b984b1..7496d6ff33 100755 --- a/tests/data/external_program_simulator.py +++ b/tests/data/external_program_simulator.py @@ -8,14 +8,12 @@ # ->1010100000111111 # <-1000001111000000 -# return a string that consists of the first bit of every message -result = [] message = messages[0] direction = message[0:2] -message.replace(direction, "") + if direction == "->": result = "10" * int(sys.argv[1]) else: result = "01" * int(sys.argv[1]) -print("".join(result), end="") +print(result, end="") diff --git a/tests/test_simulator.py b/tests/test_simulator.py index 5313ef5be1..87955e5c8d 100644 --- a/tests/test_simulator.py +++ b/tests/test_simulator.py @@ -1,5 +1,6 @@ import os import socket +import sys import tempfile import time from multiprocessing import Process, Value @@ -290,10 +291,14 @@ def test_external_program_simulator(self): lbl1 = messages[0].message_type[0] # type: SimulatorProtocolLabel lbl2 = messages[1].message_type[0] # type: SimulatorProtocolLabel + ext_program = get_path_for_data_file("external_program_simulator.py") + " " + counter_item_str + if sys.platform == "nt": + ext_program = "python " + ext_program + lbl1.value_type_index = 3 - lbl1.external_program = get_path_for_data_file("external_program_simulator.py") + " " + counter_item_str + lbl1.external_program = ext_program lbl2.value_type_index = 3 - lbl2.external_program = get_path_for_data_file("external_program_simulator.py") + " " + counter_item_str + lbl2.external_program = ext_program action = next(item for item in stc.simulator_scene.items() if isinstance(item, SleepActionItem)) action.model_item.sleep_time = 0.001 From 6e104505598397060f4ebc1be3c7029a1d8d2e61 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Sun, 6 Jan 2019 23:13:36 +0100 Subject: [PATCH 29/88] winfix --- tests/test_simulator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_simulator.py b/tests/test_simulator.py index 87955e5c8d..3699e7dd6e 100644 --- a/tests/test_simulator.py +++ b/tests/test_simulator.py @@ -292,7 +292,7 @@ def test_external_program_simulator(self): lbl2 = messages[1].message_type[0] # type: SimulatorProtocolLabel ext_program = get_path_for_data_file("external_program_simulator.py") + " " + counter_item_str - if sys.platform == "nt": + if sys.platform == "win32": ext_program = "python " + ext_program lbl1.value_type_index = 3 From c0fd148c3dcab5dcae37d5f096680cf49da8a59f Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Sun, 6 Jan 2019 23:32:04 +0100 Subject: [PATCH 30/88] more fixes --- azure-pipelines.yml | 16 ++++++++++++++-- src/urh/util/ProjectManager.py | 7 ++++++- tests/test_encoding.py | 6 ++++++ 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 1acf2c8a12..847177ade8 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -87,9 +87,15 @@ jobs: - script: python setup.py build_ext --inplace displayName: "Build extensions" - - script: pytest -s -v tests + - script: pytest --junitxml=junit/test-results.xml -s -v tests displayName: 'pytest' + - task: PublishTestResults@2 + condition: succeededOrFailed() + inputs: + testResultsFiles: '**/test-*.xml' + testRunTitle: 'Publish test results for Python $(python.version)' + - job: 'OSX' pool: vmImage: 'macOS-10.13' @@ -114,5 +120,11 @@ jobs: - script: python setup.py build_ext --inplace displayName: "Build extensions" - - script: pytest -s -v tests + - script: pytest --junitxml=junit/test-results.xml -s -v tests displayName: 'pytest' + + - task: PublishTestResults@2 + condition: succeededOrFailed() + inputs: + testResultsFiles: '**/test-*.xml' + testRunTitle: 'Publish test results for Python $(python.version)' diff --git a/src/urh/util/ProjectManager.py b/src/urh/util/ProjectManager.py index eef4a7c933..9a448a68a1 100644 --- a/src/urh/util/ProjectManager.py +++ b/src/urh/util/ProjectManager.py @@ -418,7 +418,12 @@ def save_project(self, simulator_config=None): for proto_frame in cfc.protocols[i]: if proto_frame.filename: proto_tag = ET.SubElement(group_tag, "cf_protocol") - proto_tag.set("filename", os.path.relpath(proto_frame.filename, self.project_path)) + try: + rel_file_name = os.path.relpath(proto_frame.filename, self.project_path) + except ValueError: + rel_file_name = proto_frame.filename + + proto_tag.set("filename", rel_file_name) root.append(cfc.proto_analyzer.to_xml_tag(decodings=cfc.decodings, participants=self.participants, messages=[msg for proto in cfc.full_protocol_list for msg in diff --git a/tests/test_encoding.py b/tests/test_encoding.py index 3e33196e00..6518643c99 100644 --- a/tests/test_encoding.py +++ b/tests/test_encoding.py @@ -220,6 +220,9 @@ def test_external_with_arguments(self): shutil.copy(encoder, encoder_in_dir_with_spaces) shutil.copy(decoder, decoder_in_dir_with_spaces) + if sys.platform == "win32": + coder_in_dir_with_spaces = "python " + coder_in_dir_with_spaces + e = Encoding(["test external with spaces", constants.DECODING_EXTERNAL, coder_in_dir_with_spaces + " d" + ";" + coder_in_dir_with_spaces + " e"]) @@ -248,6 +251,9 @@ def test_external_with_interpreter(self): coder_in_dir_with_spaces = '{} "{}"'.format(sys.executable, coder_in_dir_with_spaces) + if sys.platform == "win32": + coder_in_dir_with_spaces = "python " + coder_in_dir_with_spaces + e = Encoding(["test external with spaces", constants.DECODING_EXTERNAL, coder_in_dir_with_spaces + " d" + ";" + coder_in_dir_with_spaces + " e"]) From d7740f63d7cc78ad97307005f2a04cfc3123c696 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Sun, 6 Jan 2019 23:56:38 +0100 Subject: [PATCH 31/88] make calls win compat --- tests/test_encoding.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/test_encoding.py b/tests/test_encoding.py index 6518643c99..df773fcf15 100644 --- a/tests/test_encoding.py +++ b/tests/test_encoding.py @@ -172,6 +172,10 @@ def test_substitution(self): def test_external(self): encoder = get_path_for_data_file("encode.py") decoder = get_path_for_data_file("decode.py") + + encoder = '{} "{}"'.format(sys.executable, encoder) + decoder = '{} "{}"'.format(sys.executable, decoder) + e = Encoding(["test external", constants.DECODING_EXTERNAL, decoder + ";" + encoder]) data = array.array("B", [1, 0, 1, 0, 0, 1, 1]) @@ -194,6 +198,9 @@ def test_external_in_dir_with_spaces(self): shutil.copy(encoder, encoder_in_dir_with_spaces) shutil.copy(decoder, decoder_in_dir_with_spaces) + encoder_in_dir_with_spaces = '{} "{}"'.format(sys.executable, encoder_in_dir_with_spaces) + decoder_in_dir_with_spaces = '{} "{}"'.format(sys.executable, decoder_in_dir_with_spaces) + e = Encoding(["test external with spaces", constants.DECODING_EXTERNAL, decoder_in_dir_with_spaces + ";" + encoder_in_dir_with_spaces]) @@ -220,8 +227,7 @@ def test_external_with_arguments(self): shutil.copy(encoder, encoder_in_dir_with_spaces) shutil.copy(decoder, decoder_in_dir_with_spaces) - if sys.platform == "win32": - coder_in_dir_with_spaces = "python " + coder_in_dir_with_spaces + coder_in_dir_with_spaces = '{} "{}"'.format(sys.executable, coder_in_dir_with_spaces) e = Encoding(["test external with spaces", constants.DECODING_EXTERNAL, coder_in_dir_with_spaces + " d" + ";" + coder_in_dir_with_spaces + " e"]) @@ -251,9 +257,6 @@ def test_external_with_interpreter(self): coder_in_dir_with_spaces = '{} "{}"'.format(sys.executable, coder_in_dir_with_spaces) - if sys.platform == "win32": - coder_in_dir_with_spaces = "python " + coder_in_dir_with_spaces - e = Encoding(["test external with spaces", constants.DECODING_EXTERNAL, coder_in_dir_with_spaces + " d" + ";" + coder_in_dir_with_spaces + " e"]) From e8418320ec24698a0a8f79d2be4ac2dcacba50a1 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Mon, 7 Jan 2019 00:04:27 +0100 Subject: [PATCH 32/88] catch relpath --- src/urh/util/ProjectManager.py | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/src/urh/util/ProjectManager.py b/src/urh/util/ProjectManager.py index 9a448a68a1..036af8f05f 100644 --- a/src/urh/util/ProjectManager.py +++ b/src/urh/util/ProjectManager.py @@ -400,7 +400,12 @@ def save_project(self, simulator_config=None): open_files.append(open_filename) file_tag = ET.SubElement(root, "open_file") - file_tag.set("name", os.path.relpath(open_filename, self.project_path)) + try: + file_path = os.path.relpath(open_filename, self.project_path) + except ValueError: + file_path = open_filename + + file_tag.set("name", file_path) file_tag.set("position", str(i)) except Exception: pass @@ -441,8 +446,13 @@ def read_participants_for_signal(self, signal: Signal, messages): tree = ET.parse(self.project_file) root = tree.getroot() + try: + signal_filename = os.path.relpath(signal.filename, self.project_path) + except ValueError: + signal_filename = signal.filename + for sig_tag in root.iter("signal"): - if sig_tag.attrib["filename"] == os.path.relpath(signal.filename, self.project_path): + if sig_tag.attrib["filename"] == signal_filename: messages_tag = sig_tag.find("messages") try: @@ -462,9 +472,14 @@ def read_project_file_for_signal(self, signal: Signal): tree = ET.parse(self.project_file) root = tree.getroot() + + try: + signal_filename = os.path.relpath(signal.filename, self.project_path) + except ValueError: + signal_filename = signal.filename + for sig_tag in root.iter("signal"): - if sig_tag.attrib["filename"] == os.path.relpath(signal.filename, - self.project_path): + if sig_tag.attrib["filename"] == signal_filename: signal.name = sig_tag.attrib["name"] signal.qad_center = float(sig_tag.get("qad_center", 0)) signal.tolerance = int(sig_tag.get("tolerance", 5)) @@ -487,7 +502,9 @@ def read_opened_filenames(self): for file_tag in root.findall("open_file"): pos = int(file_tag.attrib["position"]) - filename = os.path.normpath(os.path.join(self.project_path, file_tag.attrib["name"])) + filename = file_tag.attrib["name"] + if not os.path.isfile(filename): + filename = os.path.normpath(os.path.join(self.project_path, filename)) file_names.insert(pos, filename) QApplication.setOverrideCursor(Qt.WaitCursor) @@ -514,7 +531,9 @@ def read_compare_frame_groups(self, root): group = tree_root.child(int(id)) for proto_tag in group_tag.iter("cf_protocol"): - filename = os.path.normpath(os.path.join(self.project_path, proto_tag.attrib["filename"])) + filename = proto_tag.attrib["filename"] + if not os.path.isfile(filename): + filename = os.path.normpath(os.path.join(self.project_path, filename)) try: proto_frame_item = next((p for p in proto_frame_items if p.protocol.filename == filename)) except StopIteration: From a339995943e718ed96308307d32309989b7631d5 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Mon, 7 Jan 2019 00:17:16 +0100 Subject: [PATCH 33/88] update code.py --- tests/data/code.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/data/code.py b/tests/data/code.py index b23a06167a..34a40510a4 100755 --- a/tests/data/code.py +++ b/tests/data/code.py @@ -7,8 +7,8 @@ cur_dir = os.path.dirname(os.path.realpath(__file__)) if sys.argv[1] == "e": - call('"' + os.path.join(cur_dir, "encode.py") + '"' + " " + sys.argv[2], shell=True) + call(sys.executable + ' "' + os.path.join(cur_dir, "encode.py") + '"' + " " + sys.argv[2], shell=True) elif sys.argv[1] == "d": - call('"' + os.path.join(cur_dir, "decode.py") + '"' + " " + sys.argv[2], shell=True) + call(sys.executable + ' "' + os.path.join(cur_dir, "decode.py") + '"' + " " + sys.argv[2], shell=True) else: print("Unknown") From 3f50c79b501961e308d36f78ac7243d499e65428 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Mon, 7 Jan 2019 00:21:09 +0100 Subject: [PATCH 34/88] add cov config --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 847177ade8..08e5798225 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -33,7 +33,7 @@ jobs: - script: | touch tests/show_gui - pytest -s --boxed --junitxml=junit/test-results.xml --cov=src/urh --cov-report=xml --cov-report=html tests + pytest -s --boxed --junitxml=junit/test-results.xml --cov=src/urh --cov-report=xml --cov-report=html --cov-config tests/.coveragerc tests displayName: 'pytest' - task: PublishTestResults@2 From 143db770290894aaeba683ed35e5a2d10bae2a83 Mon Sep 17 00:00:00 2001 From: jopohl Date: Mon, 7 Jan 2019 03:25:27 +0100 Subject: [PATCH 35/88] download drivers --- azure-pipelines.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 08e5798225..b795a16942 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -28,7 +28,7 @@ jobs: pip install pytest!=4.1 pytest-xdist pytest-xvfb pytest-cov displayName: 'Install dependencies' - - script: python src/urh/cythonext/build.py + - script: python setup.py build_ext --inplace displayName: "Build extensions" - script: | @@ -84,6 +84,17 @@ jobs: pip install pytest pytest-faulthandler displayName: 'Install dependencies' + - powershell: | + if($python.arch -eq x86){$url="https://dl.dropboxusercontent.com/s/ky6prqc0zh4wspm/win-32.zip"}else{$url=https://dl.dropboxusercontent.com/s/3pdvo56amjjm7b7/win-64.zip} + Invoke-WebRequest -Uri $url -OutFile C:\windlls.zip + displayName: 'download SDR drivers' + + - task: ExtractFiles@1 + inputs: + archiveFilePatterns: 'C:\windlls.zip' + destinationFolder: src\urh\dev\native\lib\shared + #cleanDestinationFolder: true + - script: python setup.py build_ext --inplace displayName: "Build extensions" From 3c1602e04874e16dd902a9f973aa59f6b19984dd Mon Sep 17 00:00:00 2001 From: jopohl Date: Mon, 7 Jan 2019 03:30:27 +0100 Subject: [PATCH 36/88] fix syntax --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index b795a16942..f0825b13ad 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -85,7 +85,7 @@ jobs: displayName: 'Install dependencies' - powershell: | - if($python.arch -eq x86){$url="https://dl.dropboxusercontent.com/s/ky6prqc0zh4wspm/win-32.zip"}else{$url=https://dl.dropboxusercontent.com/s/3pdvo56amjjm7b7/win-64.zip} + if($(python.arch) -eq x86){$url="https://dl.dropboxusercontent.com/s/ky6prqc0zh4wspm/win-32.zip"}else{$url=https://dl.dropboxusercontent.com/s/3pdvo56amjjm7b7/win-64.zip} Invoke-WebRequest -Uri $url -OutFile C:\windlls.zip displayName: 'download SDR drivers' From d04904668b25653443192129887e0c531c35349e Mon Sep 17 00:00:00 2001 From: jopohl Date: Mon, 7 Jan 2019 03:34:24 +0100 Subject: [PATCH 37/88] fix syntax --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f0825b13ad..58120b50cc 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -85,7 +85,7 @@ jobs: displayName: 'Install dependencies' - powershell: | - if($(python.arch) -eq x86){$url="https://dl.dropboxusercontent.com/s/ky6prqc0zh4wspm/win-32.zip"}else{$url=https://dl.dropboxusercontent.com/s/3pdvo56amjjm7b7/win-64.zip} + if ($python.arch -eq "x86") {$url="https://dl.dropboxusercontent.com/s/ky6prqc0zh4wspm/win-32.zip"} else {$url=https://dl.dropboxusercontent.com/s/3pdvo56amjjm7b7/win-64.zip} Invoke-WebRequest -Uri $url -OutFile C:\windlls.zip displayName: 'download SDR drivers' From 5d4aacd92253f29a1b2d32e8b4eac5a4345a32e9 Mon Sep 17 00:00:00 2001 From: jopohl Date: Mon, 7 Jan 2019 03:37:33 +0100 Subject: [PATCH 38/88] fix syntax --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 58120b50cc..0fc13fb1b4 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -85,7 +85,7 @@ jobs: displayName: 'Install dependencies' - powershell: | - if ($python.arch -eq "x86") {$url="https://dl.dropboxusercontent.com/s/ky6prqc0zh4wspm/win-32.zip"} else {$url=https://dl.dropboxusercontent.com/s/3pdvo56amjjm7b7/win-64.zip} + if ($python.arch -eq "x86") {$url="https://dl.dropboxusercontent.com/s/ky6prqc0zh4wspm/win-32.zip"} else {$url="https://dl.dropboxusercontent.com/s/3pdvo56amjjm7b7/win-64.zip"} Invoke-WebRequest -Uri $url -OutFile C:\windlls.zip displayName: 'download SDR drivers' From 36bc589ffed6cbdc8f73e9cf894a7ae2f8d049b8 Mon Sep 17 00:00:00 2001 From: jopohl Date: Mon, 7 Jan 2019 03:44:55 +0100 Subject: [PATCH 39/88] update var --- azure-pipelines.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 0fc13fb1b4..6073de1e19 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -85,8 +85,8 @@ jobs: displayName: 'Install dependencies' - powershell: | - if ($python.arch -eq "x86") {$url="https://dl.dropboxusercontent.com/s/ky6prqc0zh4wspm/win-32.zip"} else {$url="https://dl.dropboxusercontent.com/s/3pdvo56amjjm7b7/win-64.zip"} - Invoke-WebRequest -Uri $url -OutFile C:\windlls.zip + if ($Agent.OSArchitecture -eq "X86") {$url="https://dl.dropboxusercontent.com/s/ky6prqc0zh4wspm/win-32.zip"} else {$url="https://dl.dropboxusercontent.com/s/3pdvo56amjjm7b7/win-64.zip"} + Invoke-WebRequest -Uri $url -OutFile "C:\windlls.zip" displayName: 'download SDR drivers' - task: ExtractFiles@1 From b28e06c17d888d2b2cc085495f1b95649a4f32df Mon Sep 17 00:00:00 2001 From: jopohl Date: Mon, 7 Jan 2019 03:56:57 +0100 Subject: [PATCH 40/88] add debug --- azure-pipelines.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 6073de1e19..5918ec7698 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -87,6 +87,8 @@ jobs: - powershell: | if ($Agent.OSArchitecture -eq "X86") {$url="https://dl.dropboxusercontent.com/s/ky6prqc0zh4wspm/win-32.zip"} else {$url="https://dl.dropboxusercontent.com/s/3pdvo56amjjm7b7/win-64.zip"} Invoke-WebRequest -Uri $url -OutFile "C:\windlls.zip" + echo "Arch: $Agent.OSArchitecture" + echo "URL: $url" displayName: 'download SDR drivers' - task: ExtractFiles@1 From 414012a69d05ae09f32d7ed08d5dd2cabbd16957 Mon Sep 17 00:00:00 2001 From: jopohl Date: Mon, 7 Jan 2019 04:00:48 +0100 Subject: [PATCH 41/88] add braces --- azure-pipelines.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 5918ec7698..6c3c9342a3 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -85,9 +85,9 @@ jobs: displayName: 'Install dependencies' - powershell: | - if ($Agent.OSArchitecture -eq "X86") {$url="https://dl.dropboxusercontent.com/s/ky6prqc0zh4wspm/win-32.zip"} else {$url="https://dl.dropboxusercontent.com/s/3pdvo56amjjm7b7/win-64.zip"} + if ($(Agent.OSArchitecture) -eq "X86") {$url="https://dl.dropboxusercontent.com/s/ky6prqc0zh4wspm/win-32.zip"} else {$url="https://dl.dropboxusercontent.com/s/3pdvo56amjjm7b7/win-64.zip"} Invoke-WebRequest -Uri $url -OutFile "C:\windlls.zip" - echo "Arch: $Agent.OSArchitecture" + echo "Arch: $(Agent.OSArchitecture)" echo "URL: $url" displayName: 'download SDR drivers' From fb539f09b96a67bed8beb846145afef503128a3d Mon Sep 17 00:00:00 2001 From: jopohl Date: Mon, 7 Jan 2019 04:08:31 +0100 Subject: [PATCH 42/88] fix var name --- azure-pipelines.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 6c3c9342a3..1ad0340e3e 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -55,28 +55,28 @@ jobs: matrix: Python35-64: python.version: '3.5' - python.arch: 'x64' + arch: 'x64' Python35-32: python.version: '3.5' - python.arch: 'x86' + arch: 'x86' Python36-64: python.version: '3.6' - python.arch: 'x64' + arch: 'x64' Python36-32: python.version: '3.6' - python.arch: 'x86' + arch: 'x86' Python37-64: python.version: '3.7' - python.arch: 'x64' + arch: 'x64' Python37-32: python.version: '3.7' - python.arch: 'x86' + arch: 'x86' steps: - task: UsePythonVersion@0 inputs: versionSpec: '$(python.version)' - architecture: '$(python.arch)' + architecture: '$(arch)' - script: | python -m pip install --upgrade pip @@ -85,9 +85,9 @@ jobs: displayName: 'Install dependencies' - powershell: | - if ($(Agent.OSArchitecture) -eq "X86") {$url="https://dl.dropboxusercontent.com/s/ky6prqc0zh4wspm/win-32.zip"} else {$url="https://dl.dropboxusercontent.com/s/3pdvo56amjjm7b7/win-64.zip"} + if ($arch -eq "x86") {$url="https://dl.dropboxusercontent.com/s/ky6prqc0zh4wspm/win-32.zip"} else {$url="https://dl.dropboxusercontent.com/s/3pdvo56amjjm7b7/win-64.zip"} Invoke-WebRequest -Uri $url -OutFile "C:\windlls.zip" - echo "Arch: $(Agent.OSArchitecture)" + echo "Arch: $arch" echo "URL: $url" displayName: 'download SDR drivers' From 8335eec8ebe4e879c291679146425a5fa7050c57 Mon Sep 17 00:00:00 2001 From: jopohl Date: Mon, 7 Jan 2019 04:11:46 +0100 Subject: [PATCH 43/88] add braces --- azure-pipelines.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 1ad0340e3e..06b6aa16e3 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -78,19 +78,19 @@ jobs: versionSpec: '$(python.version)' architecture: '$(arch)' + - powershell: | + if (($arch) -eq "x86") {$url="https://dl.dropboxusercontent.com/s/ky6prqc0zh4wspm/win-32.zip"} else {$url="https://dl.dropboxusercontent.com/s/3pdvo56amjjm7b7/win-64.zip"} + Invoke-WebRequest -Uri $url -OutFile "C:\windlls.zip" + echo "Arch: $(arch)" + echo "URL: $url" + displayName: 'download SDR drivers' + - script: | python -m pip install --upgrade pip pip install -r data/requirements.txt pip install pytest pytest-faulthandler displayName: 'Install dependencies' - - powershell: | - if ($arch -eq "x86") {$url="https://dl.dropboxusercontent.com/s/ky6prqc0zh4wspm/win-32.zip"} else {$url="https://dl.dropboxusercontent.com/s/3pdvo56amjjm7b7/win-64.zip"} - Invoke-WebRequest -Uri $url -OutFile "C:\windlls.zip" - echo "Arch: $arch" - echo "URL: $url" - displayName: 'download SDR drivers' - - task: ExtractFiles@1 inputs: archiveFilePatterns: 'C:\windlls.zip' From 95b4700154a458939f8b67db2eca68020b1e3851 Mon Sep 17 00:00:00 2001 From: jopohl Date: Mon, 7 Jan 2019 04:14:48 +0100 Subject: [PATCH 44/88] add braces --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 06b6aa16e3..20575c21bf 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -79,7 +79,7 @@ jobs: architecture: '$(arch)' - powershell: | - if (($arch) -eq "x86") {$url="https://dl.dropboxusercontent.com/s/ky6prqc0zh4wspm/win-32.zip"} else {$url="https://dl.dropboxusercontent.com/s/3pdvo56amjjm7b7/win-64.zip"} + if ($(arch) -eq 'x86') {$url="https://dl.dropboxusercontent.com/s/ky6prqc0zh4wspm/win-32.zip"} else {$url="https://dl.dropboxusercontent.com/s/3pdvo56amjjm7b7/win-64.zip"} Invoke-WebRequest -Uri $url -OutFile "C:\windlls.zip" echo "Arch: $(arch)" echo "URL: $url" From 716962ba81b2f4b0660bb1b2e002e392bacc4693 Mon Sep 17 00:00:00 2001 From: jopohl Date: Mon, 7 Jan 2019 04:18:15 +0100 Subject: [PATCH 45/88] add --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 20575c21bf..c0076edeb1 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -79,7 +79,7 @@ jobs: architecture: '$(arch)' - powershell: | - if ($(arch) -eq 'x86') {$url="https://dl.dropboxusercontent.com/s/ky6prqc0zh4wspm/win-32.zip"} else {$url="https://dl.dropboxusercontent.com/s/3pdvo56amjjm7b7/win-64.zip"} + if ("$(arch)" -eq "x86") {$url="https://dl.dropboxusercontent.com/s/ky6prqc0zh4wspm/win-32.zip"} else {$url="https://dl.dropboxusercontent.com/s/3pdvo56amjjm7b7/win-64.zip"} Invoke-WebRequest -Uri $url -OutFile "C:\windlls.zip" echo "Arch: $(arch)" echo "URL: $url" From b79a72980a4a5f37bf684ec352dd45583d0e0361 Mon Sep 17 00:00:00 2001 From: jopohl Date: Mon, 7 Jan 2019 04:21:29 +0100 Subject: [PATCH 46/88] rename to python arch --- azure-pipelines.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index c0076edeb1..55c02ac491 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -55,33 +55,33 @@ jobs: matrix: Python35-64: python.version: '3.5' - arch: 'x64' + python.arch: 'x64' Python35-32: python.version: '3.5' - arch: 'x86' + python.arch: 'x86' Python36-64: python.version: '3.6' - arch: 'x64' + python.arch: 'x64' Python36-32: python.version: '3.6' - arch: 'x86' + python.arch: 'x86' Python37-64: python.version: '3.7' - arch: 'x64' + python.arch: 'x64' Python37-32: python.version: '3.7' - arch: 'x86' + python.arch: 'x86' steps: - task: UsePythonVersion@0 inputs: versionSpec: '$(python.version)' - architecture: '$(arch)' + architecture: '$(python.arch)' - powershell: | - if ("$(arch)" -eq "x86") {$url="https://dl.dropboxusercontent.com/s/ky6prqc0zh4wspm/win-32.zip"} else {$url="https://dl.dropboxusercontent.com/s/3pdvo56amjjm7b7/win-64.zip"} + if ("$(python.arch)" -eq "x86") {$url="https://dl.dropboxusercontent.com/s/ky6prqc0zh4wspm/win-32.zip"} else {$url="https://dl.dropboxusercontent.com/s/3pdvo56amjjm7b7/win-64.zip"} Invoke-WebRequest -Uri $url -OutFile "C:\windlls.zip" - echo "Arch: $(arch)" + echo "Arch: $(python.arch)" echo "URL: $url" displayName: 'download SDR drivers' From 7b4f77bb67fa674aa3a0127379ad0780d9159bb6 Mon Sep 17 00:00:00 2001 From: jopohl Date: Mon, 7 Jan 2019 04:30:17 +0100 Subject: [PATCH 47/88] remove echos --- azure-pipelines.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 55c02ac491..a844013a49 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -81,8 +81,6 @@ jobs: - powershell: | if ("$(python.arch)" -eq "x86") {$url="https://dl.dropboxusercontent.com/s/ky6prqc0zh4wspm/win-32.zip"} else {$url="https://dl.dropboxusercontent.com/s/3pdvo56amjjm7b7/win-64.zip"} Invoke-WebRequest -Uri $url -OutFile "C:\windlls.zip" - echo "Arch: $(python.arch)" - echo "URL: $url" displayName: 'download SDR drivers' - script: | From 7d79ee86feb3b7ec9c4e19eee1e7c14dc398e904 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Mon, 7 Jan 2019 11:35:56 +0100 Subject: [PATCH 48/88] improve test --- tests/test_simulator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_simulator.py b/tests/test_simulator.py index 3699e7dd6e..208e51d8e2 100644 --- a/tests/test_simulator.py +++ b/tests/test_simulator.py @@ -345,7 +345,7 @@ def test_external_program_simulator(self): self.alice.send_raw_data(np.zeros(self.num_zeros_for_pause, dtype=np.complex64), 1) bits = self.__demodulate(conn) - self.assertEqual(bits[0], "101010101") + self.assertEqual(bits[0].rstrip("0"), "101010101") time.sleep(0.5) QTest.qWait(1000) From 5231fea67aa46b6cb8a4d057e942faf44ea244ea Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Mon, 7 Jan 2019 13:07:13 +0100 Subject: [PATCH 49/88] coverage only for python 3.6 --- azure-pipelines.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index a844013a49..b0d9199def 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -34,7 +34,14 @@ jobs: - script: | touch tests/show_gui pytest -s --boxed --junitxml=junit/test-results.xml --cov=src/urh --cov-report=xml --cov-report=html --cov-config tests/.coveragerc tests - displayName: 'pytest' + displayName: 'pytest with coverage' + condition: eq(variables['python.version'], '3.6') + + - script: | + touch tests/show_gui + pytest -s --boxed --junitxml=junit/test-results.xml tests + displayName: 'pytest without coverage' + condition: ne(variables['python.version'], '3.6') - task: PublishTestResults@2 condition: succeededOrFailed() From 965bcd1166656ddbffdc06f28aef22b40aade32f Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Mon, 7 Jan 2019 13:21:27 +0100 Subject: [PATCH 50/88] add coveralls --- azure-pipelines.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index b0d9199def..b6164557ac 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -25,7 +25,7 @@ jobs: python -m pip install --upgrade pip pip install -r data/requirements.txt sudo apt-get install libhackrf-dev librtlsdr-dev xvfb - pip install pytest!=4.1 pytest-xdist pytest-xvfb pytest-cov + pip install pytest!=4.1 pytest-xdist pytest-xvfb pytest-cov coveralls displayName: 'Install dependencies' - script: python setup.py build_ext --inplace @@ -33,7 +33,7 @@ jobs: - script: | touch tests/show_gui - pytest -s --boxed --junitxml=junit/test-results.xml --cov=src/urh --cov-report=xml --cov-report=html --cov-config tests/.coveragerc tests + pytest -s --boxed --junitxml=junit/test-results.xml --cov=src/urh --cov-report=xml --cov-report=html --cov-report= --cov-config tests/.coveragerc tests displayName: 'pytest with coverage' condition: eq(variables['python.version'], '3.6') @@ -55,6 +55,12 @@ jobs: summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/coverage.xml' reportDirectory: '$(System.DefaultWorkingDirectory)/**/htmlcov' + - script: | + coverage combine + coveralls --rcfile=tests/.coveragerc + displayName: 'upload to coveralls' + condition: eq(variables['python.version'], '3.6') + - job: 'Windows' pool: vmImage: 'vs2017-win2016' From 31777d59e7033bbf11c4226f6f1f04d35f36b9ea Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Mon, 7 Jan 2019 13:26:00 +0100 Subject: [PATCH 51/88] add testrun --- azure-pipelines.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index b6164557ac..1d837b2bfe 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -43,6 +43,12 @@ jobs: displayName: 'pytest without coverage' condition: ne(variables['python.version'], '3.6') + - script: | + pip install . + urh --version + urh autoclose + displayName: 'Testrun' + - task: PublishTestResults@2 condition: succeededOrFailed() inputs: @@ -114,6 +120,12 @@ jobs: - script: pytest --junitxml=junit/test-results.xml -s -v tests displayName: 'pytest' + - script: | + pip install . + urh --version + urh autoclose + displayName: 'Testrun' + - task: PublishTestResults@2 condition: succeededOrFailed() inputs: @@ -147,6 +159,12 @@ jobs: - script: pytest --junitxml=junit/test-results.xml -s -v tests displayName: 'pytest' + - script: | + pip install . + urh --version + urh autoclose + displayName: 'Testrun' + - task: PublishTestResults@2 condition: succeededOrFailed() inputs: From 95c7d79777f313d54a1637ffdd630b6174b6463d Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Mon, 7 Jan 2019 13:39:26 +0100 Subject: [PATCH 52/88] change var --- azure-pipelines.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 1d837b2bfe..dcfd53d54b 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -46,7 +46,7 @@ jobs: - script: | pip install . urh --version - urh autoclose + xvfb-run urh autoclose displayName: 'Testrun' - task: PublishTestResults@2 @@ -63,7 +63,7 @@ jobs: - script: | coverage combine - coveralls --rcfile=tests/.coveragerc + COVERALLS_REPO_TOKEN=%COVERALLS_TOKEN% coveralls --rcfile=tests/.coveragerc displayName: 'upload to coveralls' condition: eq(variables['python.version'], '3.6') From 28ee525a6259dcf8a4ca53b7b0ec66f40ab51724 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Mon, 7 Jan 2019 13:42:21 +0100 Subject: [PATCH 53/88] change var --- azure-pipelines.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index dcfd53d54b..48bc570b85 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -63,7 +63,8 @@ jobs: - script: | coverage combine - COVERALLS_REPO_TOKEN=%COVERALLS_TOKEN% coveralls --rcfile=tests/.coveragerc + echo $COVERALLS_TOKEN + COVERALLS_REPO_TOKEN=$COVERALLS_TOKEN coveralls --rcfile=tests/.coveragerc displayName: 'upload to coveralls' condition: eq(variables['python.version'], '3.6') From 133f1cc53e2f2590f19560a73a6688d90e46009e Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Mon, 7 Jan 2019 13:55:17 +0100 Subject: [PATCH 54/88] dummy commit --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 48bc570b85..2db409026e 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -164,7 +164,7 @@ jobs: pip install . urh --version urh autoclose - displayName: 'Testrun' + displayName: 'Test run' - task: PublishTestResults@2 condition: succeededOrFailed() From 033b28eac84d111180ed8c349860d3b13267562e Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Mon, 7 Jan 2019 14:11:55 +0100 Subject: [PATCH 55/88] test var --- azure-pipelines.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 2db409026e..fbc9a73c0d 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -63,8 +63,9 @@ jobs: - script: | coverage combine - echo $COVERALLS_TOKEN - COVERALLS_REPO_TOKEN=$COVERALLS_TOKEN coveralls --rcfile=tests/.coveragerc + echo $COVERALLSTOKEN + echo $SYSTEM_DEBUG + COVERALLS_REPO_TOKEN=$COVERALLSTOKEN coveralls --rcfile=tests/.coveragerc displayName: 'upload to coveralls' condition: eq(variables['python.version'], '3.6') From 0a92113d7991acadb9fd5410db3e1ff704fb5161 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Mon, 7 Jan 2019 14:26:42 +0100 Subject: [PATCH 56/88] add timeout for ci --- azure-pipelines.yml | 2 -- tests/test_send_recv_dialog_gui.py | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index fbc9a73c0d..2cac7be6d6 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -63,8 +63,6 @@ jobs: - script: | coverage combine - echo $COVERALLSTOKEN - echo $SYSTEM_DEBUG COVERALLS_REPO_TOKEN=$COVERALLSTOKEN coveralls --rcfile=tests/.coveragerc displayName: 'upload to coveralls' condition: eq(variables['python.version'], '3.6') diff --git a/tests/test_send_recv_dialog_gui.py b/tests/test_send_recv_dialog_gui.py index 8594f0aca3..414112b5a8 100644 --- a/tests/test_send_recv_dialog_gui.py +++ b/tests/test_send_recv_dialog_gui.py @@ -188,6 +188,8 @@ def test_spectrum(self): Qt.LeftButton, Qt.NoModifier) QApplication.postEvent(w, event) QApplication.instance().processEvents() + QTest.qWait(50) + self.assertIsNotNone(spectrum_dialog.ui.graphicsViewFFT.scene().frequency_marker) spectrum_dialog.ui.btnStop.click() From 78fceb00976bd8ba3917812e5f0332232af14074 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Mon, 7 Jan 2019 14:31:39 +0100 Subject: [PATCH 57/88] remove coverage upload from travis --- .travis.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6942897279..908dc6f141 100644 --- a/.travis.yml +++ b/.travis.yml @@ -87,15 +87,5 @@ script: - urh --version - urh autoclose -after_success: - - | - if [[ $TRAVIS_PYTHON_VERSION == "3.6"* ]] - then - coverage combine - coveralls --rcfile=tests/.coveragerc - else - echo "coverage upload only for python 3.6" - fi - after_script: - cat /tmp/build_log.txt From 7fb5c47bac9dd4ff2753fe6326f09a7d001f93b5 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Mon, 7 Jan 2019 15:19:39 +0100 Subject: [PATCH 58/88] reset travis --- .travis.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.travis.yml b/.travis.yml index 908dc6f141..6942897279 100644 --- a/.travis.yml +++ b/.travis.yml @@ -87,5 +87,15 @@ script: - urh --version - urh autoclose +after_success: + - | + if [[ $TRAVIS_PYTHON_VERSION == "3.6"* ]] + then + coverage combine + coveralls --rcfile=tests/.coveragerc + else + echo "coverage upload only for python 3.6" + fi + after_script: - cat /tmp/build_log.txt From 84e5ccb89cd03260546e66fc376f8520dc388465 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Mon, 7 Jan 2019 15:58:17 +0100 Subject: [PATCH 59/88] try pullrequest id --- azure-pipelines.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 2cac7be6d6..9f2c772637 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -63,7 +63,8 @@ jobs: - script: | coverage combine - COVERALLS_REPO_TOKEN=$COVERALLSTOKEN coveralls --rcfile=tests/.coveragerc + echo $SYSTEM_PULLREQUEST_PULLREQUESTID + COVERALLS_REPO_TOKEN=$COVERALLSTOKEN CI_PULL_REQUEST=$SYSTEM_PULLREQUEST_PULLREQUESTID coveralls --rcfile=tests/.coveragerc displayName: 'upload to coveralls' condition: eq(variables['python.version'], '3.6') From 0a6f22ae7d6615a96aee84d1f489ae4d1c47b2d1 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Mon, 7 Jan 2019 16:07:29 +0100 Subject: [PATCH 60/88] try pullrequest id --- azure-pipelines.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 9f2c772637..60a8437a77 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -64,7 +64,9 @@ jobs: - script: | coverage combine echo $SYSTEM_PULLREQUEST_PULLREQUESTID - COVERALLS_REPO_TOKEN=$COVERALLSTOKEN CI_PULL_REQUEST=$SYSTEM_PULLREQUEST_PULLREQUESTID coveralls --rcfile=tests/.coveragerc + export CI_PULL_REQUEST=$SYSTEM_PULLREQUEST_PULLREQUESTID + echo $CI_PULL_REQUEST + COVERALLS_REPO_TOKEN=$COVERALLSTOKEN coveralls --rcfile=tests/.coveragerc displayName: 'upload to coveralls' condition: eq(variables['python.version'], '3.6') From f42ebff489f1aaf39686c5b3216a59d45594785f Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Mon, 7 Jan 2019 16:10:11 +0100 Subject: [PATCH 61/88] try pullrequest id --- azure-pipelines.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 60a8437a77..9f2c772637 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -64,9 +64,7 @@ jobs: - script: | coverage combine echo $SYSTEM_PULLREQUEST_PULLREQUESTID - export CI_PULL_REQUEST=$SYSTEM_PULLREQUEST_PULLREQUESTID - echo $CI_PULL_REQUEST - COVERALLS_REPO_TOKEN=$COVERALLSTOKEN coveralls --rcfile=tests/.coveragerc + COVERALLS_REPO_TOKEN=$COVERALLSTOKEN CI_PULL_REQUEST=$SYSTEM_PULLREQUEST_PULLREQUESTID coveralls --rcfile=tests/.coveragerc displayName: 'upload to coveralls' condition: eq(variables['python.version'], '3.6') From de0e2a8fcf1f7a31543ee99a426b60757448520f Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Mon, 7 Jan 2019 16:24:52 +0100 Subject: [PATCH 62/88] try pull nr --- azure-pipelines.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 9f2c772637..fcde5bb565 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -60,11 +60,13 @@ jobs: codeCoverageTool: Cobertura summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/coverage.xml' reportDirectory: '$(System.DefaultWorkingDirectory)/**/htmlcov' + condition: eq(variables['python.version'], '3.6') - script: | coverage combine echo $SYSTEM_PULLREQUEST_PULLREQUESTID - COVERALLS_REPO_TOKEN=$COVERALLSTOKEN CI_PULL_REQUEST=$SYSTEM_PULLREQUEST_PULLREQUESTID coveralls --rcfile=tests/.coveragerc + echo $SYSTEM_PULLREQUEST_PULLREQUESTNUMBER + COVERALLS_REPO_TOKEN=$COVERALLSTOKEN CI_PULL_REQUEST=$SYSTEM_PULLREQUEST_PULLREQUESTNUMBER CI_NAME=azure coveralls --rcfile=tests/.coveragerc displayName: 'upload to coveralls' condition: eq(variables['python.version'], '3.6') From 15a3abaa00f57fe396b1bb391d401a5114430425 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Mon, 7 Jan 2019 17:03:34 +0100 Subject: [PATCH 63/88] use build quality check --- azure-pipelines.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index fcde5bb565..0ba6845a6a 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -62,13 +62,13 @@ jobs: reportDirectory: '$(System.DefaultWorkingDirectory)/**/htmlcov' condition: eq(variables['python.version'], '3.6') - - script: | - coverage combine - echo $SYSTEM_PULLREQUEST_PULLREQUESTID - echo $SYSTEM_PULLREQUEST_PULLREQUESTNUMBER - COVERALLS_REPO_TOKEN=$COVERALLSTOKEN CI_PULL_REQUEST=$SYSTEM_PULLREQUEST_PULLREQUESTNUMBER CI_NAME=azure coveralls --rcfile=tests/.coveragerc - displayName: 'upload to coveralls' - condition: eq(variables['python.version'], '3.6') + - task: mspremier.BuildQualityChecks.QualityChecks-task.BuildQualityChecks@5 + displayName: 'Check coverage' + inputs: + checkCoverage: true + allowCoverageVariance: true + coverageVariance: 0.1 + coverageDeltaType: percentage - job: 'Windows' pool: From 72f9e0bd597ced8a89c967ff8f1500f8d95987fa Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Mon, 7 Jan 2019 17:03:51 +0100 Subject: [PATCH 64/88] add condition --- azure-pipelines.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 0ba6845a6a..5c853d8019 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -64,6 +64,7 @@ jobs: - task: mspremier.BuildQualityChecks.QualityChecks-task.BuildQualityChecks@5 displayName: 'Check coverage' + condition: eq(variables['python.version'], '3.6') inputs: checkCoverage: true allowCoverageVariance: true From 79235090fd409d6374dad9e1d22bd0df83b3d40d Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Mon, 7 Jan 2019 17:16:53 +0100 Subject: [PATCH 65/88] switch to line coverage --- azure-pipelines.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 5c853d8019..b75d64c80b 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -70,6 +70,7 @@ jobs: allowCoverageVariance: true coverageVariance: 0.1 coverageDeltaType: percentage + coverageType: lines - job: 'Windows' pool: From 68d0f6c0bc9f6593b5a61b5f6b8721dbcf7f2df7 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Mon, 7 Jan 2019 17:31:30 +0100 Subject: [PATCH 66/88] test coverage --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index b75d64c80b..c508f35578 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -33,7 +33,7 @@ jobs: - script: | touch tests/show_gui - pytest -s --boxed --junitxml=junit/test-results.xml --cov=src/urh --cov-report=xml --cov-report=html --cov-report= --cov-config tests/.coveragerc tests + pytest -s --boxed --junitxml=junit/test-results.xml --cov=src/urh --cov-report=xml --cov-report=html tests displayName: 'pytest with coverage' condition: eq(variables['python.version'], '3.6') From a17a7f07662bd5b49fc9dfcdae4f1f821bfed636 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Mon, 7 Jan 2019 17:40:43 +0100 Subject: [PATCH 67/88] add cov config --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index c508f35578..6c8638f1fd 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -33,7 +33,7 @@ jobs: - script: | touch tests/show_gui - pytest -s --boxed --junitxml=junit/test-results.xml --cov=src/urh --cov-report=xml --cov-report=html tests + pytest -s --boxed --junitxml=junit/test-results.xml --cov=src/urh --cov-report=xml --cov-report=html --cov-config tests/.coveragerc tests displayName: 'pytest with coverage' condition: eq(variables['python.version'], '3.6') From f15d0cb4d2bd8eb2f2c2e2086ae2e53f5575ed79 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Mon, 7 Jan 2019 19:01:34 +0100 Subject: [PATCH 68/88] add build deps task --- azure-pipelines.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 6c8638f1fd..3b26f33657 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -122,6 +122,12 @@ jobs: - script: python setup.py build_ext --inplace displayName: "Build extensions" + - script: | + pip install wheel twine six appdirs packaging cx_freeze + pip install "pyaudio; python_version < '3.7'" + displayName: "Install build deps" + condition: contains(variables['Build.SourceBranch'], 'refs/tags/') + - script: pytest --junitxml=junit/test-results.xml -s -v tests displayName: 'pytest' From a871301b404801ef7bb542138933f868468e8c8c Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Mon, 7 Jan 2019 20:19:40 +0100 Subject: [PATCH 69/88] test build --- azure-pipelines.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 3b26f33657..fa22491cc3 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -125,8 +125,16 @@ jobs: - script: | pip install wheel twine six appdirs packaging cx_freeze pip install "pyaudio; python_version < '3.7'" + python -c "import tempfile, os; open(os.path.join(tempfile.gettempdir(), 'urh_releasing'), 'w').close()" displayName: "Install build deps" - condition: contains(variables['Build.SourceBranch'], 'refs/tags/') + #condition: contains(variables['Build.SourceBranch'], 'refs/tags/') + + - script: | + python setup.py bdist_wheel + IF "%PYTHON_VERSION%" == "3.6" (python data\build_cx.py) + dir dist + displayName: "Build MSI and wheel" + #condition: contains(variables['Build.SourceBranch'], 'refs/tags/') - script: pytest --junitxml=junit/test-results.xml -s -v tests displayName: 'pytest' From 7c4c8972168a9714859e9a0529ff08cffe1b0e39 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Mon, 7 Jan 2019 20:47:50 +0100 Subject: [PATCH 70/88] conditions --- azure-pipelines.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index fa22491cc3..457b3912c6 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -127,14 +127,14 @@ jobs: pip install "pyaudio; python_version < '3.7'" python -c "import tempfile, os; open(os.path.join(tempfile.gettempdir(), 'urh_releasing'), 'w').close()" displayName: "Install build deps" - #condition: contains(variables['Build.SourceBranch'], 'refs/tags/') + condition: contains(variables['Build.SourceBranch'], 'refs/tags/') - script: | python setup.py bdist_wheel IF "%PYTHON_VERSION%" == "3.6" (python data\build_cx.py) dir dist displayName: "Build MSI and wheel" - #condition: contains(variables['Build.SourceBranch'], 'refs/tags/') + condition: contains(variables['Build.SourceBranch'], 'refs/tags/') - script: pytest --junitxml=junit/test-results.xml -s -v tests displayName: 'pytest' From 288bbaa773c3e7620dbd935e41ddf7d4197b53d9 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Mon, 7 Jan 2019 21:39:58 +0100 Subject: [PATCH 71/88] test var --- azure-pipelines.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 457b3912c6..09ce02d931 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -108,6 +108,7 @@ jobs: displayName: 'download SDR drivers' - script: | + echo $TWINE_REPOSITORY_URL python -m pip install --upgrade pip pip install -r data/requirements.txt pip install pytest pytest-faulthandler From 9257b389a3980330e54a08ef4cbe771d41c3b944 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Mon, 7 Jan 2019 21:41:50 +0100 Subject: [PATCH 72/88] add twine upload --- azure-pipelines.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 09ce02d931..60ec3f31a3 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -108,7 +108,7 @@ jobs: displayName: 'download SDR drivers' - script: | - echo $TWINE_REPOSITORY_URL + echo %TWINE_REPOSITORY_URL% python -m pip install --upgrade pip pip install -r data/requirements.txt pip install pytest pytest-faulthandler @@ -137,6 +137,10 @@ jobs: displayName: "Build MSI and wheel" condition: contains(variables['Build.SourceBranch'], 'refs/tags/') + - script: twine upload --skip-existing dist/*.whl + displayName: "Upload wheel to PyPi" + condition: contains(variables['Build.SourceBranch'], 'refs/tags/') + - script: pytest --junitxml=junit/test-results.xml -s -v tests displayName: 'pytest' From f1fc1f7e4ed0d5da2dae571b48932046c3506da9 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Mon, 7 Jan 2019 21:45:40 +0100 Subject: [PATCH 73/88] add echo --- azure-pipelines.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 60ec3f31a3..f52a1c0d58 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -108,6 +108,7 @@ jobs: displayName: 'download SDR drivers' - script: | + echo "Twine URL:" echo %TWINE_REPOSITORY_URL% python -m pip install --upgrade pip pip install -r data/requirements.txt From bc3c87cd049c22c8e42c5a3a5116e3658c2316e1 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Mon, 7 Jan 2019 21:58:29 +0100 Subject: [PATCH 74/88] test var --- azure-pipelines.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f52a1c0d58..ef7387d9d0 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -108,8 +108,6 @@ jobs: displayName: 'download SDR drivers' - script: | - echo "Twine URL:" - echo %TWINE_REPOSITORY_URL% python -m pip install --upgrade pip pip install -r data/requirements.txt pip install pytest pytest-faulthandler @@ -138,9 +136,13 @@ jobs: displayName: "Build MSI and wheel" condition: contains(variables['Build.SourceBranch'], 'refs/tags/') - - script: twine upload --skip-existing dist/*.whl + - script: echo %TWINE_USERNAME% #twine upload --skip-existing dist/*.whl displayName: "Upload wheel to PyPi" condition: contains(variables['Build.SourceBranch'], 'refs/tags/') + env: + TWINE_USERNAME: $(twine.username) + TWINE_PASSWORD: $(twine.password) + TWINE_REPOSITORY_URL: "https://upload.pypi.org/legacy/" - script: pytest --junitxml=junit/test-results.xml -s -v tests displayName: 'pytest' From 94d32cef8e4d2949b0b54a0f2f80f0f783428415 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Mon, 7 Jan 2019 21:58:44 +0100 Subject: [PATCH 75/88] test var --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ef7387d9d0..a45b608cda 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -138,7 +138,7 @@ jobs: - script: echo %TWINE_USERNAME% #twine upload --skip-existing dist/*.whl displayName: "Upload wheel to PyPi" - condition: contains(variables['Build.SourceBranch'], 'refs/tags/') + #condition: contains(variables['Build.SourceBranch'], 'refs/tags/') env: TWINE_USERNAME: $(twine.username) TWINE_PASSWORD: $(twine.password) From c34722107668d6824b81f43d2c6aae9a9df9a376 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Mon, 7 Jan 2019 22:06:43 +0100 Subject: [PATCH 76/88] twine upload --- azure-pipelines.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index a45b608cda..098074a012 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -136,9 +136,9 @@ jobs: displayName: "Build MSI and wheel" condition: contains(variables['Build.SourceBranch'], 'refs/tags/') - - script: echo %TWINE_USERNAME% #twine upload --skip-existing dist/*.whl + - script: twine upload --skip-existing dist/*.whl displayName: "Upload wheel to PyPi" - #condition: contains(variables['Build.SourceBranch'], 'refs/tags/') + condition: contains(variables['Build.SourceBranch'], 'refs/tags/') env: TWINE_USERNAME: $(twine.username) TWINE_PASSWORD: $(twine.password) From 34ae0f115f1e20c32feaba2856de0a98c0d1798b Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Mon, 7 Jan 2019 22:31:41 +0100 Subject: [PATCH 77/88] increase timeout for ci --- tests/test_simulator.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_simulator.py b/tests/test_simulator.py index 208e51d8e2..7629bd3287 100644 --- a/tests/test_simulator.py +++ b/tests/test_simulator.py @@ -129,7 +129,7 @@ def test_performance(self): receive_process.start() # Ensure receiver is running - time.sleep(2) + time.sleep(10) # spy = QSignalSpy(self.network_sdr_plugin_receiver.rcv_index_changed) simulator.start() @@ -141,7 +141,7 @@ def test_performance(self): # yappi.start() self.network_sdr_plugin_sender.send_raw_data(modulator.modulate(msg_a.encoded_bits), 1) - time.sleep(0.5) + time.sleep(1) # send some zeros to simulate the end of a message self.network_sdr_plugin_sender.send_raw_data(np.zeros(self.num_zeros_for_pause, dtype=np.complex64), 1) time.sleep(1) From 936427f3dfb53253334e50a2417927abb9c7be56 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Mon, 7 Jan 2019 23:07:43 +0100 Subject: [PATCH 78/88] fix test --- tests/test_simulator.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tests/test_simulator.py b/tests/test_simulator.py index 7629bd3287..3f92ce13d4 100644 --- a/tests/test_simulator.py +++ b/tests/test_simulator.py @@ -42,7 +42,11 @@ def receive(port, current_index, target_index, elapsed): start = False while True: - data = conn.recv(65536 * 8) + try: + data = conn.recv(65536 * 8) + except: + continue + if not start: start = True t = time.time() @@ -129,7 +133,7 @@ def test_performance(self): receive_process.start() # Ensure receiver is running - time.sleep(10) + time.sleep(2) # spy = QSignalSpy(self.network_sdr_plugin_receiver.rcv_index_changed) simulator.start() @@ -141,11 +145,11 @@ def test_performance(self): # yappi.start() self.network_sdr_plugin_sender.send_raw_data(modulator.modulate(msg_a.encoded_bits), 1) - time.sleep(1) + time.sleep(0.5) # send some zeros to simulate the end of a message self.network_sdr_plugin_sender.send_raw_data(np.zeros(self.num_zeros_for_pause, dtype=np.complex64), 1) - time.sleep(1) - receive_process.join(25) + time.sleep(0.5) + receive_process.join(15) logger.info("PROCESS TIME: {0:.2f}ms".format(elapsed.value)) From dbfe4ef64ad49590b6c2300f4c6debe9df2d8817 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Tue, 8 Jan 2019 10:41:01 +0100 Subject: [PATCH 79/88] test publish build artifacts --- azure-pipelines.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 098074a012..cfb976cefc 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -127,14 +127,24 @@ jobs: pip install "pyaudio; python_version < '3.7'" python -c "import tempfile, os; open(os.path.join(tempfile.gettempdir(), 'urh_releasing'), 'w').close()" displayName: "Install build deps" - condition: contains(variables['Build.SourceBranch'], 'refs/tags/') + #condition: contains(variables['Build.SourceBranch'], 'refs/tags/') - script: | python setup.py bdist_wheel IF "%PYTHON_VERSION%" == "3.6" (python data\build_cx.py) dir dist displayName: "Build MSI and wheel" - condition: contains(variables['Build.SourceBranch'], 'refs/tags/') + #condition: contains(variables['Build.SourceBranch'], 'refs/tags/') + + - task: PublishBuildArtifacts@1 + inputs: + pathtoPublish: dist/ + #artifactName: 'drop' + #condition: contains(variables['Build.SourceBranch'], 'refs/tags/') + #publishLocation: 'Container' # Options: container, filePath + #targetPath: # Required when publishLocation == FilePath + #parallel: false # Optional + #parallelCount: # Optional - script: twine upload --skip-existing dist/*.whl displayName: "Upload wheel to PyPi" From 8f2740ccc151a08ec9fabbccb3f88ec0291fc8d9 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Tue, 8 Jan 2019 10:55:47 +0100 Subject: [PATCH 80/88] test other archive name --- azure-pipelines.yml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index cfb976cefc..84290c0e65 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -126,25 +126,22 @@ jobs: pip install wheel twine six appdirs packaging cx_freeze pip install "pyaudio; python_version < '3.7'" python -c "import tempfile, os; open(os.path.join(tempfile.gettempdir(), 'urh_releasing'), 'w').close()" - displayName: "Install build deps" + displayName: "Install build dependencies" #condition: contains(variables['Build.SourceBranch'], 'refs/tags/') - script: | python setup.py bdist_wheel IF "%PYTHON_VERSION%" == "3.6" (python data\build_cx.py) dir dist - displayName: "Build MSI and wheel" + displayName: "Build MSI and Wheel" #condition: contains(variables['Build.SourceBranch'], 'refs/tags/') - task: PublishBuildArtifacts@1 inputs: pathtoPublish: dist/ - #artifactName: 'drop' + artifactName: 'dist' + displayName: "Publish Build Artifacts" #condition: contains(variables['Build.SourceBranch'], 'refs/tags/') - #publishLocation: 'Container' # Options: container, filePath - #targetPath: # Required when publishLocation == FilePath - #parallel: false # Optional - #parallelCount: # Optional - script: twine upload --skip-existing dist/*.whl displayName: "Upload wheel to PyPi" From c9f613e63823dfaa1ae604daab951025ea6acb26 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Tue, 8 Jan 2019 11:03:57 +0100 Subject: [PATCH 81/88] fix test --- tests/test_simulator.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/test_simulator.py b/tests/test_simulator.py index 3f92ce13d4..ff35a28f4a 100644 --- a/tests/test_simulator.py +++ b/tests/test_simulator.py @@ -44,22 +44,22 @@ def receive(port, current_index, target_index, elapsed): while True: try: data = conn.recv(65536 * 8) - except: - continue - if not start: - start = True - t = time.time() + if not start: + start = True + t = time.time() - if len(data) > 0: - while len(data) % 8 != 0: - data += conn.recv(len(data) % 8) + if len(data) > 0: + while len(data) % 8 != 0: + data += conn.recv(len(data) % 8) - arr = np.frombuffer(data, dtype=np.complex64) - current_index.value += len(arr) + arr = np.frombuffer(data, dtype=np.complex64) + current_index.value += len(arr) - if current_index.value == target_index: - break + if current_index.value == target_index: + break + except: + continue conn.close() elapsed.value = 1000 * (time.time() - t) From b50244db3d5d9a54b23aa712568854f648765ba8 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Tue, 8 Jan 2019 11:16:58 +0100 Subject: [PATCH 82/88] split build task --- azure-pipelines.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 84290c0e65..879c89b1b8 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -129,19 +129,18 @@ jobs: displayName: "Install build dependencies" #condition: contains(variables['Build.SourceBranch'], 'refs/tags/') - - script: | - python setup.py bdist_wheel - IF "%PYTHON_VERSION%" == "3.6" (python data\build_cx.py) - dir dist - displayName: "Build MSI and Wheel" - #condition: contains(variables['Build.SourceBranch'], 'refs/tags/') + - script: python setup.py bdist_wheel + displayName: "Build python wheel" + + - script: python data\build_cx.py + condition: eq(variables['python.version'], '3.6') + displayName: "Build MSI" - task: PublishBuildArtifacts@1 inputs: pathtoPublish: dist/ artifactName: 'dist' displayName: "Publish Build Artifacts" - #condition: contains(variables['Build.SourceBranch'], 'refs/tags/') - script: twine upload --skip-existing dist/*.whl displayName: "Upload wheel to PyPi" From c80b819c8d03221ddaf57b7ad1b1d5ab0cb3e77c Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Tue, 8 Jan 2019 12:25:53 +0100 Subject: [PATCH 83/88] add github release task --- azure-pipelines.yml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 879c89b1b8..b956704716 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -34,13 +34,13 @@ jobs: - script: | touch tests/show_gui pytest -s --boxed --junitxml=junit/test-results.xml --cov=src/urh --cov-report=xml --cov-report=html --cov-config tests/.coveragerc tests - displayName: 'pytest with coverage' + displayName: 'Run pytest with coverage' condition: eq(variables['python.version'], '3.6') - script: | touch tests/show_gui pytest -s --boxed --junitxml=junit/test-results.xml tests - displayName: 'pytest without coverage' + displayName: 'Run pytest without coverage' condition: ne(variables['python.version'], '3.6') - script: | @@ -150,8 +150,18 @@ jobs: TWINE_PASSWORD: $(twine.password) TWINE_REPOSITORY_URL: "https://upload.pypi.org/legacy/" + - task: GitHubRelease@0 + displayName: 'GitHub release' + condition: contains(variables['Build.SourceBranch'], 'refs/tags/') + inputs: + gitHubConnection: 'github release connection' + repositoryName: jopohl/urh + assets: 'dist/*.msi' + assetUploadMode: 'replace' + addChangeLog: true + - script: pytest --junitxml=junit/test-results.xml -s -v tests - displayName: 'pytest' + displayName: 'Run pytest' - script: | pip install . @@ -190,7 +200,7 @@ jobs: displayName: "Build extensions" - script: pytest --junitxml=junit/test-results.xml -s -v tests - displayName: 'pytest' + displayName: 'Run pytest' - script: | pip install . From 9a47cfacf1941f7c24c70d5d0836a84be5c1fd47 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Tue, 8 Jan 2019 12:33:26 +0100 Subject: [PATCH 84/88] fix syntax --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index b956704716..1e61052728 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -161,7 +161,7 @@ jobs: addChangeLog: true - script: pytest --junitxml=junit/test-results.xml -s -v tests - displayName: 'Run pytest' + displayName: 'Run pytest' - script: | pip install . From c4761bb3596529fa936962e0b582a382dbec15a4 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Tue, 8 Jan 2019 12:38:43 +0100 Subject: [PATCH 85/88] try conn --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 1e61052728..1b4ee4e689 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -154,7 +154,7 @@ jobs: displayName: 'GitHub release' condition: contains(variables['Build.SourceBranch'], 'refs/tags/') inputs: - gitHubConnection: 'github release connection' + gitHubConnection: 'githubconn' repositoryName: jopohl/urh assets: 'dist/*.msi' assetUploadMode: 'replace' From 6a8528b6e2b389bd51876e907602718afbcc0985 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Tue, 8 Jan 2019 12:42:51 +0100 Subject: [PATCH 86/88] try conn --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 1b4ee4e689..3881ae8da8 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -154,7 +154,7 @@ jobs: displayName: 'GitHub release' condition: contains(variables['Build.SourceBranch'], 'refs/tags/') inputs: - gitHubConnection: 'githubconn' + gitHubConnection: 'github connection 1' repositoryName: jopohl/urh assets: 'dist/*.msi' assetUploadMode: 'replace' From ba47535e2643e7156c0f0946b73c2645d8b0e566 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Tue, 8 Jan 2019 12:56:59 +0100 Subject: [PATCH 87/88] add tag trigger --- azure-pipelines.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 3881ae8da8..233160e6f8 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,5 +1,6 @@ trigger: - master +- refs/tags/v* jobs: From bc9848105e1deaad9d596592959f763cf7c3dc49 Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Tue, 8 Jan 2019 14:24:41 +0100 Subject: [PATCH 88/88] cleanup --- azure-pipelines.yml | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 233160e6f8..2b5307937d 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -44,12 +44,6 @@ jobs: displayName: 'Run pytest without coverage' condition: ne(variables['python.version'], '3.6') - - script: | - pip install . - urh --version - xvfb-run urh autoclose - displayName: 'Testrun' - - task: PublishTestResults@2 condition: succeededOrFailed() inputs: @@ -73,6 +67,12 @@ jobs: coverageDeltaType: percentage coverageType: lines + - script: | + pip install . + urh --version + xvfb-run urh autoclose + displayName: 'Testrun' + - job: 'Windows' pool: vmImage: 'vs2017-win2016' @@ -128,7 +128,6 @@ jobs: pip install "pyaudio; python_version < '3.7'" python -c "import tempfile, os; open(os.path.join(tempfile.gettempdir(), 'urh_releasing'), 'w').close()" displayName: "Install build dependencies" - #condition: contains(variables['Build.SourceBranch'], 'refs/tags/') - script: python setup.py bdist_wheel displayName: "Build python wheel" @@ -164,18 +163,18 @@ jobs: - script: pytest --junitxml=junit/test-results.xml -s -v tests displayName: 'Run pytest' - - script: | - pip install . - urh --version - urh autoclose - displayName: 'Testrun' - - task: PublishTestResults@2 condition: succeededOrFailed() inputs: testResultsFiles: '**/test-*.xml' testRunTitle: 'Publish test results for Python $(python.version)' + - script: | + pip install . + urh --version + urh autoclose + displayName: 'Testrun' + - job: 'OSX' pool: vmImage: 'macOS-10.13' @@ -203,14 +202,14 @@ jobs: - script: pytest --junitxml=junit/test-results.xml -s -v tests displayName: 'Run pytest' - - script: | - pip install . - urh --version - urh autoclose - displayName: 'Test run' - - task: PublishTestResults@2 condition: succeededOrFailed() inputs: testResultsFiles: '**/test-*.xml' testRunTitle: 'Publish test results for Python $(python.version)' + + - script: | + pip install . + urh --version + urh autoclose + displayName: 'Test run'