How to see execution logs when I use behave + allure in Jenkins? - allure

I used behave + allure in my Jenkins job:
Run command like this one.
behave -f allure_behave.formatter:AllureFormatter -o allure-results
When it finish I see Allure report, all working fine.
BUT during this process I do not see anything in the Console Output only this one.
How can I see proper console output there too during execution?

In a simple example it works, so maybe it works in your case too:
behave -f allure_behave.formatter:AllureFormatter -o allure-results -f pretty

Related

catch console output from background process

I have a program running on armbian single board computer. The program starts with -b option during the startup of the system. I created this simple shell script
#!/bin/bash
#Myprog server start
sudo -b /home/myprog/myprog
This program is C written and it sometimes outputs some information with printf functions. But since it is started with -b option there's is noting in the console.
Now when I log in to the armbian via ssh with Putty I want to occasionally read the output of this program. Is it even possible?
Not exactly what you’re asking, but generally speaking it’s better practice to redirect output to a log file than to try to interactively look at the console output for a background app.
Something like:
sudo -b /home/prog/myprog >> /home/prog/log.txt 2>&1
Should do it.
Then view output with
tail -f /home/prog/log.txt
If it’s really important to you to run interactively without logs, I would suggest running it from within “screen” without backgrounding it.
screen
sudo /home/prog/myprog
Then ctrl-d to detach and let it run in background. screen -r to reattach.

Creating Jmeter Report

I have a scheduled load test which runs daily. Scripts are triggered from CLI (.bat file) and will be creating a html report at the end of the test.
I am saving test report with testnameDATE, where currently the date part is updated manually.
I tried to automate the date part to get the system date on run time using '${__time(MMddyyyy)}', but for html part its not working and report is not getting created.
Eg:
D:
cd D:\Performance Testing\Tools\apache-jmeter-3.0\bin
jmeter -n -t "D:\Performance Testing\batch\DailyRun\Test_DailyRegression.jmx" -l "D:\Performance Testing\batch\DaiyRun\csv\Test${__time(MMddyyyy)}_001.csv" -e -o "D:\Performance Testing\batch\DaiyRun\html\Test${__time(MMddyyyy)}_001.html"
Windows doesn't know anything about JMeter Functions, given you run your JMeter test in command-line non-GUI mode you will need to use date command instead like:
jmeter -n -t ..\extras\Test.jmx -l Test_%date:~10,4%%date:~4,2%%date:~7,2%_001.csv
Demo:

posix_openpt() - error - Cant access tty, job control turned off

I'm using a psuedo terminal, /bin/sh -i, by calling normal commands for posix_openpty() then fork(), in language C.
When I run from command line GUI terminal like this
$ ./MyTerminal
or
$ sudo ./MyTerminal
or as root like this
# ./MyTerminal
all works very good and as expected, no problems.
However, when I make a systemd service file like this, it works fine
[Service]
User=root
But when I try to get systemd to run it as normal user like this
[Service]
User=debian
THe first output for /bin/sh -i is
/bin/sh: 0: can't access tty; job control turned off $
And the terminal does not really work.
When I run /bin/bash, fork() w/posix_openpty() is returns me this, but the terminal generally works ok
bash: cannot set terminal process group (-1): Inappropriate ioctl for device
bash: no job control in this shell
Is such a weird prolem because when running outside of systemd everything works perfect. I see this problem in 1 other question but no clear solution. So what I have to change to make systemd run my file perfectly? Thanks for your help.

why won't Jenkins write the ouput of my jmeter test to the specified logfile?

I have set up Jenkins to run my parameterized jmeter test (with the kind assistance of knowledgeable users here). I'm not using any other build technologies at the moment. I can run my tests and see the results in Jenkins as expected. However Jenkins is not writing the test data to my specified logfile. Here is my Windows batch script in Jenkins: C:\Users\MikeL\Documents\apache-jmeter\bin\jmeter.bat -n -t C:\Users\MikeL\Documents\apache-jmeter\bin\testApp.jmx -l log.jtl -Jenv=%env% -JloopCount=%loopCount% if I run jmeter -n -t testApp.jmx -l log.jtl -Jenv=dev -JloopCount=1 from the windows cmd prompt inside of jmeters bin dir It does create the log file as expected. If anyone knows why the Jenkins script won't output it I'd be very obliged.

Editing .desktop file to run executable as root?

I have compiled a c program into an executable that I would now like to integrate into the applications menu in Debian 7.4 XFCE. In order to run the application under normal circumstances, I am required to type
sudo myprogram
Now I have created my .desktop file and placed it in /usr/share/applications
[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=myprogram
Comment=configuration loader
Exec=sudo loader
Icon=/usr/share/icons/hicolor/48x48/apps/myprogram.png
Terminal=false
Categories=Development;IDE
The item is added to my applications menu as expected, and the icon shows up properly. The problem, however, is that double clicking the menu item to launch the application does nothing.
If I navigate to /usr/bin (where I have placed my executable) and type "sudo myprogram", the program launches as expected.
What can I do to fix this issue and get the program to launch from the menu? Perhaps /usr/bin is not the correct place to put it, or I have the incorrect Exec command. I greatly appreciate the help.
I ended up using (after installing gksu)
Exec = gksu myprogram
this launches a graphical sudo prompt, which is sufficient for my needs.
This is what the setuid bit in the permissions is for. It makes executables run with permissions of the file owner. This only works on actual executables, not on shell scripts!
sudo chmod u+s myprogram
sudo chown root myprogram
./myprogram # now runs as root
Please be careful when using this as it will always execute that program as root no matter who executes it. You can limit access by setting it to your usergroup and deny all execute.
chgrp "${USER}" myprogram # provided you have individual groups set up
chmod a-x myprogram # deny all execute
This approach does not need additional installation of packages.
Terminal=true opens a new terminal window which runs
sudo -i to ask for the password.
Then, using sh to run the program, the Terminal is closed and myprogram runs in the background because it has a & at the end.
[Desktop Entry]
Type=Application
Name=...
Exec=sudo -i sh -c "myprogram &"
Terminal=true
Request: Please report if it works under your OS.
Tested under:
Xubuntu
The pkexec solution from askubuntu:
Exec=pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY APP_COMMAND
Try adding this to .desktop
Path=/path/to/myprogram

Resources