How to set tag for Robot Framework in data driver tests? - tags

I am trying to add a tag in accordance with the documentation
https://github.com/Snooz82/robotframework-datadriver
Here is my example:
*** Settings ***
Test Template Template
*** Test Cases *** ${first} ${second} [Tags] [Documentation]
Test1 xxx 111 123
Test2 yyy 222 126
Test3 zzz 333 124
*** Keywords ***
Template
[Arguments] ${first} ${second}
Should be true ${TRUE}
But in this case, I got the error:
Keyword 'Template' expected 2 arguments, got 3.
I also saw this solution: How to Tag Data Driven Template Tests in Robot Framework
But in this case, I can not run a particular test by using -i test_tag

Welcome.
You can also set default tags like so:
*** Settings ***
Default Tags smoke
All test cases that do not have their own tags will receive tags defined as default tags.
Or you can use forced tags:
Force Tags req-882
All test cases in a file will receive such tags.
However, your example contains yet another problem. You're passing 3 arguments to your Template keyword, you have 3 columns of arguments in your test case table. It should be like this:
*** Test Cases *** ${first} ${second}
Test1 xxx 111
Test2 yyy 222
Test3 zzz 333
So the whole working example:
*** Settings ***
Default Tags smoke
Test Template Template
*** Test Cases *** ${first} ${second}
Test1 xxx 111
Test2 yyy 222
Test3 zzz 333
*** Keywords ***
Template
[Arguments] ${first} ${second}
Should be true ${TRUE}
when I run $ robot --include smoke test.robot, I get:
and when I run $ robot --exclude smoke test.robot, I get:
EDIT:
If you want to set tags per test case, the syntax is:
*** Test Cases *** ${first} ${second}
Test1 xxx 111
[Tags] smoke
Test2 yyy 222
Test3 zzz 333
in which case, only Test1 will be executed when you issue $ robot -i smoke test.robot:

Related

Yocto Build Dependency on Debian Package

I am working on migrating from Debian to Yocto. As a result, many of the proprietary packages I am writing recipes for have dependencies on Debian libraries which do not appear to be available directly in Yocto. This might be a rookie question, but I'm trying to figure out how to do this.
Below, I have one of my recipe for a Makefile C project that was generated with recipetool create:
# Recipe created by recipetool
# This is the basis of a recipe and may need further editing in order to be fully functional.
# (Feel free to remove these comments when editing.)
# WARNING: the following LICENSE and LIC_FILES_CHKSUM values are best guesses - it is
# your responsibility to verify that the values are complete and correct.
#
# The following license files were not able to be identified and are
# represented as "Unknown" below, you will need to check them yourself:
# debian/copyright
LICENSE = "Unknown"
LIC_FILES_CHKSUM = "file://debian/copyright;md5=some-hash"
SRC_URI = "git://git#my-project.git;protocol=ssh"
# Modify these as desired
PV = "1.0+git${SRCPV}"
SRCREV = "<...>"
S = "${WORKDIR}/git"
DEPENDS = "systemd"
# NOTE: this is a Makefile-only piece of software, so we cannot generate much of the
# recipe automatically - you will need to examine the Makefile yourself and ensure
# that the appropriate arguments are passed in.
do_compile () {
oe_runmake my-project
}
As you can see, I have specified a dependency on systemd. However, the dependency I really think I need is the Debian package libsystemd.
Whenever I bitbake this recipe, I get the following:
NOTE: Executing Tasks
ERROR: <recipe-name> do_compile: oe_runmake failed
ERROR: <recipe-name> do_compile: Execution of '/home/mitch/bin/yocto/project-name/build/tmp/work/armv7vet2hf-neon-poky-linux-gnueabi/recipe-name/1.0+gitAUTOINC+...-r0/temp/run.do_compile.13271' failed with exit code 1:
make[1]: Entering directory '/home/mitch/bin/yocto/project-name/build/tmp/work/armv7vet2hf-neon-poky-linux-gnueabi/recipe-name/1.0+gitAUTOINC+...-r0/git/src/core'
CC file-name.c
../file-name.c:6:10: fatal error: systemd/sd-daemon.h: No such file or directory
6 | #include <systemd/sd-daemon.h>
| ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [Makefile:93: build/file-name.o] Error 1
make[1]: Leaving directory '/home/mitch/bin/yocto/project-name/build/tmp/work/armv7vet2hf-neon-poky-linux-gnueabi/recipe-name/1.0+gitAUTOINC+...-r0/git/src/core'
make: *** [Makefile:72: some-recipe] Error 2
WARNING: exit code 1 from a shell command.
ERROR: Logfile of failure stored in: /home/mitch/bin/yocto/project-name/build/tmp/work/armv7vet2hf-neon-poky-linux-gnueabi/recipe-name/1.0+gitAUTOINC+...-r0/temp/log.do_compile.13271
Log data follows:
| DEBUG: Executing shell function do_compile
| NOTE: make -j 24 my-project
| make[1]: Entering directory '/home/mitch/bin/yocto/project-name/build/tmp/work/armv7vet2hf-neon-poky-linux-gnueabi/recipe-name/1.0+gitAUTOINC+...-r0/git/src/core'
| CC my-file.c
| ../my-file.c:6:10: fatal error: systemd/sd-daemon.h: No such file or directory
| 6 | #include <systemd/sd-daemon.h>
| | ^~~~~~~~~~~~~~~~~~~~~
| compilation terminated.
| make[1]: *** [Makefile:93: build/my-file.o] Error 1
| make[1]: Leaving directory '/home/mitch/bin/yocto/project-name/build/tmp/work/armv7vet2hf-neon-poky-linux-gnueabi/recipe-name/1.0+gitAUTOINC+...-r0/git/src/core'
| make: *** [Makefile:72: my-project] Error 2
| ERROR: oe_runmake failed
| WARNING: exit code 1 from a shell command.
| ERROR: Execution of '/home/mitch/bin/yocto/project-name/build/tmp/work/armv7vet2hf-neon-poky-linux-gnueabi/recipe-name/1.0+gitAUTOINC+...-r0/temp/run.do_compile.13271' failed with exit code 1:
| make[1]: Entering directory '/home/mitch/bin/yocto/project-name/build/tmp/work/armv7vet2hf-neon-poky-linux-gnueabi/recipe-name/1.0+gitAUTOINC+...-r0/git/src/core'
| CC my-file.c
| ../my-file.c:6:10: fatal error: systemd/sd-daemon.h: No such file or directory
| 6 | #include <systemd/sd-daemon.h>
| | ^~~~~~~~~~~~~~~~~~~~~
| compilation terminated.
| make[1]: *** [Makefile:93: build/my-file.o] Error 1
| make[1]: Leaving directory '/home/mitch/bin/yocto/project-name/build/tmp/work/armv7vet2hf-neon-poky-linux-gnueabi/recipe-name/1.0+gitAUTOINC+...-r0/git/src/core'
| make: *** [Makefile:72: my-recipe] Error 2
| WARNING: exit code 1 from a shell command.
|
ERROR: Task (/home/mitch/bin/yocto/project-name/layers/meta-project/recipes-main/my-recipe/my-recipe_git.bb:do_compile) failed with exit code '1'
NOTE: Tasks Summary: Attempted 2166 tasks of which 2163 didn't need to be rerun and 1 failed.
To summarize, what this looks like is my project requires libraries provided by systemd. What am I missing here that would allow me to get this project to build? Is there a way to build it?
Okay, so I guess I was overthinking this. Yocto uses your system to compile the project. So, all I needed to do was provide the systemd header files on my host machine. Since I am running Ubuntu, installing libsystemd-dev on my host fixed the issue. I think that the DEPENDS on systemd will still be required for running on the Yocto system.

Kernel compilation fails due to PF_MAX > 44

I have a QEMU VM running an image of the Linux kernel 4.14.78.
On the host machine (a server with 96 cores), I am trying to compile a new update for the kernel with some changes I have made.
To make this process faster, I was using the host machine to compile for the target VM.
To do that I follow these steps:
copy the /boot/config-4.14.78 file from VM to host
put the copied file into the kernel source-code root directory, renaming it to .config in my
run make clean to clean it
run make menuconfig just to update the configs
run make -j$(nproc)
However, I am getting this error:
AS arch/x86/purgatory/setup-x86_64.o
CC arch/x86/purgatory/sha256.o
AS arch/x86/purgatory/entry64.o
CC arch/x86/purgatory/string.o
In file included from scripts/selinux/mdp/mdp.c:49:
./security/selinux/include/classmap.h:245:2: error: #error New address family defined, please update secclass_map.
245 | #error New address family defined, please update secclass_map.
| ^~~~~
make[3]: *** [scripts/Makefile.host:102: scripts/selinux/mdp/mdp] Error 1
make[2]: *** [scripts/Makefile.build:587: scripts/selinux/mdp] Error 2
make[2]: *** Waiting for unfinished jobs....
In file included from scripts/selinux/genheaders/genheaders.c:19:
./security/selinux/include/classmap.h:245:2: error: #error New address family defined, please update secclass_map.
245 | #error New address family defined, please update secclass_map.
| ^~~~~
CHK scripts/mod/devicetable-offsets.h
make[3]: *** [scripts/Makefile.host:102: scripts/selinux/genheaders/genheaders] Error 1
make[2]: *** [scripts/Makefile.build:587: scripts/selinux/genheaders] Error 2
make[1]: *** [scripts/Makefile.build:587: scripts/selinux] Error 2
make[1]: *** Waiting for unfinished jobs....
I have checked what causes this, and turns out that it is because of the:
include/linux/socket.h:211:#define AF_MAX 44 /* For now.. */
include/linux/socket.h:260:#define PF_MAX AF_MAX
Then, I followed this solution to print out the definition of PF_MAX at preprocessing time, and turns out that the PF_MAX is 45:
In file included from scripts/selinux/mdp/mdp.c:49:
./security/selinux/include/classmap.h:247:9: note: #pragma message: 45
247 | #pragma message(STRING(PF_MAX))
| ^~~~~~~
./security/selinux/include/classmap.h:250:2: error: #error New address family defined, please update secclass_map.
250 | #error New address family defined, please update secclass_map.
| ^~~~~
This 45 makes no sense for me, because I just checked that it is supposed to be 44.
I wonder if the build is considering the host machine instead of the target?
P.S.: These steps works fine on my local machine, which is a 8-cores machine, look the kernel version:
uname -a
Linux campes-note 5.4.86 #1 SMP Fri Jan 1 16:26:25 -03 2021 x86_64 x86_64 x86_64 GNU/Linux
UPDATE 1:
I tried to compile the kernel without any of my changes, following th above steps mentioned, and it did not compile as well, I get the same error.
UPDATE 2:
I found out that somehow, the compilation is looking at the host /usr/src/linux-headers-x.x.x files.
Instead, it should point to the same version as the target.
For that, I tried to follow this tutorial but I did not success. I am having a problem in one of the steps stated on this tutorial.
(Gathered from the now removed comments)
I have tried myself to build myself v4.14.78 followed by the latest available v4.14.214. I have found that former fails while the latter builds. So, I have bisected down to v4.14.116 that first builds correctly. Then I simple looked into the changes and found commit 760f8522ce08 ("selinux: use kernel linux/socket.h for genheaders and mdp") in the Linux stable tree which fixes the issue.
You may try to cherry-pick it to your branch and compile again.

MissingOutputException in snakemake

I'm trying to run a peak calling tool within a conda environment using snakemake.
The script looks as such (I only added the rows connect to the problem):
rule all:
input:
expand('{project}/{organism}/{mapper}/seacr/{pattern}.auc.threshold.bed', pattern = PATTERN, sample = IDS, organism = config['org'], project = config['project'], mapper = config['mapper']) # SEACR - run the peak calling
rule seacr_run:
input:
IP = '{project}/{organism}/{mapper}/seacr/IP_{PATTERN}.bedgraph',
IgG = '{project}/{organism}/{mapper}/seacr/IgG_{PATTERN}.bedgraph',
output:
bed1 = '{project}/{organism}/{mapper}/seacr/{PATTERN}.auc.threshold.bed',
shell:
'''
bash /fs/home/yeroslaviz/SEACR/SEACR_1.3.sh {input.IP} 0.01 non stringent {output.bed1}
'''
When running the -nps dryrun of the snamemake command I get the correct command printed to STDOUT
> snakemake -nps /fs/pool/pool-bcfngs/scripts/P193.ChipSeq.Snakemake -j 100
...
Building DAG of jobs...
Job counts:
count jobs
1 all
1 seacr_run
2
[Tue Mar 3 13:56:19 2020]
rule seacr_run:
input: P193/Mmu.GrCm38/bowtie2/seacr/IP_H3K4m3.bedgraph, P193/Mmu.GrCm38/bowtie2/seacr/IgG_H3K4m3.bedgraph
output: P193/Mmu.GrCm38/bowtie2/seacr/H3K4m3.auc.threshold.bed
jobid: 22
wildcards: project=P193, organism=Mmu.GrCm38, mapper=bowtie2, PATTERN=H3K4m3
bash /fs/home/yeroslaviz/SEACR/SEACR_1.3.sh P193/Mmu.GrCm38/bowtie2/seacr/IP_H3K4m3.bedgraph 0.01 non stringent P193/Mmu.GrCm38/bowtie2/seacr/H3K4m3.auc.threshold.bed
[Tue Mar 3 13:56:19 2020]
localrule all:
...
Job counts:
count jobs
1 all
1 seacr_run
2
This was a dry-run (flag -n). The order of jobs does not reflect the order of execution.
When running the command above in the command line the tool works without problems. But hwhen I try to run it within the snakemake workflow I get the following error:
Waiting at most 5 seconds for missing files.
MissingOutputException in line 67 of /fs/pool/pool-bcfngs/scripts/P193.ChipSeq.Snakemake:
Missing files after 5 seconds:
P193/Mmu.GrCm38/bowtie2/seacr/H3K4m3.auc.threshold.bed
This might be due to filesystem latency. If that is the case, consider to increase the wait time with --latency-wait.
Shutting down, this might take some time.
Exiting because a job execution failed. Look above for error message
Can anyone explain what is happening?
Thanks

PyTest Suppress Results Debug Statement

I am using PyTest with the following options: -s, -v, and --resultlog=results.txt. This suppresses print statements from my test, but prints the test names and results as they are run and logs the results to results.txt.
However, if any tests fail, I also get a spew of information containing traceback, debug, etc. Since I am logging this to a file anyway, I don't want it printed to the screen, cluttering up my output.
Is there any way to disable the printing of just these debug statements, but still have it logged to my results file?
Visual example:
Currently, I see something like this:
$ py.test -sv --resultlog=results.txt test.py
=============================== test session starts =========================
platform darwin -- Python 2.7.10, pytest-2.9.1, py-1.4.31, pluggy-0.3.1 -- /...
cachedir: .cache
rootdir: /Users/jdinkel/Documents, inifile:
plugins: profiling-1.1.1, session2file-0.1.9
collected 3 items
test.py::TestClass::test1 PASSED
test.py::TestClass::test2 PASSED
test.py::TestClass::test3 FAILED
===================================== FAILURES ==============================
__________________________________ TestClass.test3 __________________________
self = <test.TestClass instance at 0x10beb5320>
def test3(self):
> assert 0
E assert 0
test.py:7: AssertionError
========================== 1 failed, 2 passed in 0.01 seconds ===============
But I would like to see this:
$ py.test -sv --resultlog=results.txt test.py
=============================== test session starts =========================
platform darwin -- Python 2.7.10, pytest-2.9.1, py-1.4.31, pluggy-0.3.1 -- /...
cachedir: .cache
rootdir: /Users/jdinkel/Documents, inifile:
plugins: profiling-1.1.1, session2file-0.1.9
collected 3 items
test.py::TestClass::test1 PASSED
test.py::TestClass::test2 PASSED
test.py::TestClass::test3 FAILED
========================== 1 failed, 2 passed in 0.01 seconds ===============
With no change to the results.txt file.
You should use tb switch for controlling traceback.
e.g.
pytest tests/ -sv --tb=no --disable-warnings
--disable-warnings disable occasional pytest warnings which I assume you don't want either.
From pytest help:
--tb=style traceback print mode (auto/long/short/line/native/no).
In addition to the answer of #SilentGuy, -r N suppresses the summary of failed testcases.

Running specific test which is part of goal test in Makefile

I'm running "nmake test" and experience 2 failing tests.
Here is the Test Summary Report:
Test Summary Report
-------------------
../lib/File/Copy.t (Wstat: 256 Tests: 466 Failed: 1)
Failed test: 53
Non-zero exit status: 1
../lib/locale.t (Wstat: 0 Tests: 660 Failed: 1)
Failed test: 424
Files=2384, Tests=696984, 1309 wallclock secs (73.41 usr + 4.73 sys = 78.14 CPU)
How to run these 2 tests without running whole goal?
You can't. Those are commands inside of the Copy.t file. What you can do is run just the Copy.t with prove and add the -v flag to get it to be verbose though, and it will tell you exactly which one fails. But there is no way to just run one piece of a .t file.
That would look like this:
foo#bar: ~/file-copy $ prove -vl File/Copy.t