From da85d426adab8ad10188486a107c1d92ed532606 Mon Sep 17 00:00:00 2001 From: Frantisek Lachman Date: Wed, 28 Jun 2023 17:21:00 +0200 Subject: [PATCH 1/6] Try csmock in TF Signed-off-by: Frantisek Lachman --- .packit.yaml | 23 +++++++++-------------- plans/test.fmf | 25 ++++++++++++++----------- 2 files changed, 23 insertions(+), 25 deletions(-) diff --git a/.packit.yaml b/.packit.yaml index dce8acc3..ef39249a 100644 --- a/.packit.yaml +++ b/.packit.yaml @@ -10,13 +10,8 @@ downstream_package_name: hello # post-upstream-clone: "python3 setup.py sdist --dist-dir ." # current_version_command: ["python3", "setup.py", "--version"] # create_tarball_command: ["python3", "setup.py", "sdist", "--dist-dir", "."] -jobs: -- job: copr_build - trigger: pull_request - targets: - - fedora-stable-x86_64 - - fedora-rawhide-x86_64 +jobs: - job: copr_build trigger: release targets: @@ -28,14 +23,14 @@ jobs: targets: - fedora-stable -- job: tests +- job: copr_build trigger: pull_request targets: - - fedora-stable-x86_64 - - fedora-rawhide-x86_64 + - fedora-37 + - fedora-38 -- job: propose_downstream - trigger: release - packit_instances: ["stg"] - dist_git_branches: - - fedora-all +- job: tests + trigger: pull_request + targets: + - fedora-37 + - fedora-38 \ No newline at end of file diff --git a/plans/test.fmf b/plans/test.fmf index 0e6b5e26..122269b8 100644 --- a/plans/test.fmf +++ b/plans/test.fmf @@ -1,13 +1,16 @@ ---- +summary: + Check SRPM files with csmock +discover: + how: shell + tests: + - name: csmock + test: csmock -t cppcheck,clang /tmp/*.src.rpm prepare: - how: install - package: - - curl - - httpd - + - name: packages + how: install + package: + - csmock + - how: shell + script: cd /tmp && curl -O ${PACKIT_SRPM_URL} execute: - how: tmt - script: - - systemctl start httpd - - echo foo > /var/www/html/index.html - - curl http://localhost/ | grep foo + how: tmt \ No newline at end of file From 9b2a6e0b383acf174843b65c8eef195534f04ed2 Mon Sep 17 00:00:00 2001 From: Frantisek Lachman Date: Fri, 30 Jun 2023 10:49:05 +0200 Subject: [PATCH 2/6] Save results into data folder Signed-off-by: Frantisek Lachman --- plans/test.fmf | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plans/test.fmf b/plans/test.fmf index 122269b8..78e746f6 100644 --- a/plans/test.fmf +++ b/plans/test.fmf @@ -4,7 +4,9 @@ discover: how: shell tests: - name: csmock - test: csmock -t cppcheck,clang /tmp/*.src.rpm + test: "csmock --all-tools /tmp/*.src.rpm -o $TMT_TEST_DATA --force && cp $TMT_TEST_DATA/scan-results.html $TMT_TEST_DATA/viewer.html && echo -e '- result: pass\n name: /' > $TMT_TEST_DATA/results.yaml" + result: custom + require: bash prepare: - name: packages how: install From 142fc5376d1a2c6ea9a4d741469bddeaced660cb Mon Sep 17 00:00:00 2001 From: Frantisek Lachman Date: Fri, 30 Jun 2023 11:02:00 +0200 Subject: [PATCH 3/6] Run the build and test just once Signed-off-by: Frantisek Lachman --- .packit.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.packit.yaml b/.packit.yaml index ef39249a..1954d1e8 100644 --- a/.packit.yaml +++ b/.packit.yaml @@ -1,5 +1,5 @@ --- -packit_instances: ["prod", "stg"] +packit_instances: ["stg"] specfile_path: hello.spec files_to_sync: - .packit.yaml @@ -26,11 +26,9 @@ jobs: - job: copr_build trigger: pull_request targets: - - fedora-37 - fedora-38 - job: tests trigger: pull_request targets: - - fedora-37 - fedora-38 \ No newline at end of file From 09a010e9eec51d9debdbe02e433fdca407fee2fd Mon Sep 17 00:00:00 2001 From: Frantisek Lachman Date: Fri, 30 Jun 2023 11:26:12 +0200 Subject: [PATCH 4/6] Try to show the viewer.html Signed-off-by: Frantisek Lachman --- plans/test.fmf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plans/test.fmf b/plans/test.fmf index 78e746f6..c5defb69 100644 --- a/plans/test.fmf +++ b/plans/test.fmf @@ -4,7 +4,7 @@ discover: how: shell tests: - name: csmock - test: "csmock --all-tools /tmp/*.src.rpm -o $TMT_TEST_DATA --force && cp $TMT_TEST_DATA/scan-results.html $TMT_TEST_DATA/viewer.html && echo -e '- result: pass\n name: /' > $TMT_TEST_DATA/results.yaml" + test: "csmock --all-tools /tmp/*.src.rpm -o $TMT_TEST_DATA --force && cp $TMT_TEST_DATA/scan-results.html $TMT_TEST_DATA/viewer.html && echo -e '- result: pass\n name: /\n log:\n - scan.log\n - viewer.html' > $TMT_TEST_DATA/results.yaml" result: custom require: bash prepare: From 2d348cd39f3e06f375b4a8b1b59865b1e6bdc677 Mon Sep 17 00:00:00 2001 From: Frantisek Lachman Date: Fri, 30 Jun 2023 13:03:30 +0200 Subject: [PATCH 5/6] Reuse existing html file and match the result Signed-off-by: Frantisek Lachman --- plans/test.fmf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plans/test.fmf b/plans/test.fmf index c5defb69..87e9aee0 100644 --- a/plans/test.fmf +++ b/plans/test.fmf @@ -4,7 +4,7 @@ discover: how: shell tests: - name: csmock - test: "csmock --all-tools /tmp/*.src.rpm -o $TMT_TEST_DATA --force && cp $TMT_TEST_DATA/scan-results.html $TMT_TEST_DATA/viewer.html && echo -e '- result: pass\n name: /\n log:\n - scan.log\n - viewer.html' > $TMT_TEST_DATA/results.yaml" + test: "csmock --all-tools /tmp/*.src.rpm -o $TMT_TEST_DATA --force && echo -e '- result: pass' > $TMT_TEST_DATA/results.yaml || echo -e '- result: fail' > $TMT_TEST_DATA/results.yaml ; echo -e ' name: /\n log:\n - scan.log\n - scan-results.html' >> $TMT_TEST_DATA/results.yaml" result: custom require: bash prepare: From 2770bd58a9c7469f99c2cc65f0029f8ce5f542e5 Mon Sep 17 00:00:00 2001 From: Frantisek Lachman Date: Fri, 30 Jun 2023 15:30:31 +0200 Subject: [PATCH 6/6] Try running check on ksh Signed-off-by: Frantisek Lachman --- plans/test.fmf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plans/test.fmf b/plans/test.fmf index 87e9aee0..260e2ce3 100644 --- a/plans/test.fmf +++ b/plans/test.fmf @@ -13,6 +13,6 @@ prepare: package: - csmock - how: shell - script: cd /tmp && curl -O ${PACKIT_SRPM_URL} + script: cd /tmp && curl -O "https://kojipkgs.fedoraproject.org//packages/ksh/1.0.4/1.fc38/src/ksh-1.0.4-1.fc38.src.rpm" execute: how: tmt \ No newline at end of file