Bitbake build error, Patch does not apply bitbake error? - patch

I created new question, because I felt the previous one had been answered and this belongs in a new place.
I run bitbake core-image-minimal and I get the following error:
ERROR: systemd-1_232-r0 do_patch: Command Error: 'quilt --quiltrc /home/rama/repositories/poky/build/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/systemd/1_232-r0/recipe-sysroot-native/etc/quiltrc push' exited with 0 Output:
Applying patch 0001-systemd-udevd.service.in-set-MountFlags-shared.patch
patching file units/systemd-udevd.service.in
Hunk #1 FAILED at 21.
1 out of 1 hunk FAILED -- rejects in file units/systemd-udevd.service.in
Patch 0001-systemd-udevd.service.in-set-MountFlags-shared.patch does not apply (enforce with -f)
ERROR: systemd-1_232-r0 do_patch: Function failed: patch_do_patch
ERROR: Logfile of failure stored in: /home/rama/repositories/poky/build/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/systemd/1_232-r0/temp/log.do_patch.5314
ERROR: Task (/home/rama/repositories/poky/meta/recipes-core/systemd/systemd_232.bb:do_patch) failed with exit code '1'
I located the place where the patch is written in file meta-toradex/recipes-core/systemd/systemd_%.bbappend :
FILESEXTRAPATHS_prepend := "${THISDIR}/systemd:"
SRC_URI += " \
file://rndis.network \
file://0001-systemd-udevd.service.in-set-MountFlags-shared.patch \
"
PACKAGECONFIG_append = " networkd"
do_install_append() {
# The network files need to be in /usr/lib/systemd, not ${systemd_unitdir}...
install -d ${D}${prefix}/lib/systemd/network/
install -m 0644 ${WORKDIR}/rndis.network ${D}${prefix}/lib/systemd/network/
}
FILES_${PN} += " \
${nonarch_base_libdir}/systemd/network \
I was told that I can :
Remove the patch.
Apply it manually.
To remove the path, Should I just remove it from SRC_URI list?
How does one apply patch manually? I tried to google this, I did not quite get how this can be done.
Any help is appreciated, Thank you.

When looking at repo manifest, meta-toradex is not used, and in meta-toradex, it says oe-core BSP layer (obsolete). I think you're not using the right environment.
Nevertheless, if you want to check patch problem, you can use devshell with bitbake -c devshell systemd, then type quilt push in new console. You then need to analyze with patch fails to apply by looking at patch file and corresponding source code.
You should not modify existing layer, and create your own layer overriding recipes, but if you want to, you can indeed remove patch to SRC_URI, then use bitbake -c clean systemd; bitbake systemd and it should be OK.
In Toradex developer knowledge-base, if you are making a new environment, i think you need to look at V2.1 and Later Images section.

Related

scan-build always reports No Bugs found with make but working with single file on Linux

I am trying to use scan-build to do static analysis for my project.
When I run the scan-build with single .cpp or .c file , it reports the bugs correctly.
But when I use with cmake/make , it always says No Bugs found.
Commands used:
scan-build --use-cc /usr/bin/gcc --use-c++ /usr/bin/c++ --keep-cc cmake -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/c++
scan-build -V -v -v --use-cc /usr/bin/gcc --use-c++ /usr/bin/c++ --keep-cc --force-analyze-debug-code -analyze-headers -stats --status-bugs --use-analyzer=/llvm-project/build/bin/clang-15 --analyzer-target --keep-going -enable-checker all checkers separated by comma -o reports path
Actual Output:
scan-build: Analysis run complete.
scan-build: Removing directory '/tmp/scan-build-' because it contains no reports.
scan-build: No bugs found.
Expected Output:
scan-build bugs with html reports
Single file output:
11: warning: Division by zero [core.DivideZero]
return 5/(x-x); // warn
~^~~~~~
1 warning generated.
scan-build: Analysis run complete.
scan-build: 1 bug found.
scan-build: Run 'scan-view /tmp/scan-build-' to examine bug reports.
I have tried all the other options mentioned in this forum, but nothing worked for me.
Tried below also,
export CCC_CC=clang
export CCC_CXX=clang++
Would be very helpful if someone provide exact options that can work and generate bugs with gcc/make.

GNU/GUIX fails to locate custom modules specified in a manifest

I'm trying run guix package install for following manifest:
(specifications->manifest
'("noguix-hugo" ;; A CUSTOM MODULE implemented in /module/root-1/site-lisp/nonguix-hugo.scm
"go"))
The custom module in the manifest is declared as follows:
(define-module (nonguix-hugo)
;; implementation detail
;; ....
)
And the installation command looks like:
guix package --load-path="/module/root1/site-lisp" \
--load-path="/module/root-2/site-lisp" \
--manifest="/path/to/manifest.scm" \
--profile="/path/to/profile"
The command fails with error message:
guix package: error: noguix-hugo: unknown package
However, building the noguix-hugo using guix build command works just fine
guix build --load-path="/module/root1/site-lisp" \
--load-path="/module/root-2/site-lisp" \
nonguix-package
# The command builds and outputs the module location as expected
# /gnu/store/7js349wb17371225njzll9gma8kmwf-nonguix-hugo-1.0
My question:
Why does Guix succeed to locate the module when building it,
but can't seem to locate it when specified in a manifest file.
I even tried adding a (use-modules (nonguix-hugo)) to the manifest and setting GUIX_PACKAGE_PATH as specified in[1], yet the install still fails.
References
[1] https://guix.gnu.org/manual/en/html_node/Package-Modules.html
Okay, turns out this was a typo in the manifest:
(specifications->manifest
'("noguix-hugo"
"go"))
which should be corrected to:
(specifications->manifest
'("nonguix-hugo" ;; <= this line
"go"))
Sheesh!....

ParseError at /meta/classes/image.bbclass Could not inherit file classes/image_types_uboot.bbclass?

UPDATE : It started to bitbake!!
I now get the following error, and it stops to bitbake core-image-minimal in the middle:
Initialising tasks: 100% |##################################################################################################################| Time: 0:00:04
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
ERROR: systemd-1_232-r0 do_patch: Command Error: 'quilt --quiltrc /home/rama/repositories/poky/build/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/systemd/1_232-r0/recipe-sysroot-native/etc/quiltrc push' exited with 0 Output:
Applying patch 0001-systemd-udevd.service.in-set-MountFlags-shared.patch
patching file units/systemd-udevd.service.in
Hunk #1 FAILED at 21.
1 out of 1 hunk FAILED -- rejects in file units/systemd-udevd.service.in
Patch 0001-systemd-udevd.service.in-set-MountFlags-shared.patch does not apply (enforce with -f)
ERROR: systemd-1_232-r0 do_patch: Function failed: patch_do_patch
ERROR: Logfile of failure stored in: /home/rama/repositories/poky/build/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/systemd/1_232-r0/temp/log.do_patch.1928
ERROR: Task (/home/rama/repositories/poky/meta/recipes-core/systemd/systemd_232.bb:do_patch) failed with exit code '1'
NOTE: Tasks Summary: Attempted 1156 tasks of which 1105 didn't need to be rerun and 1 failed.
Summary: 1 task failed:
/home/rama/repositories/poky/meta/recipes-core/systemd/systemd_232.bb:do_patch
Summary: There were 2 WARNING messages shown.
Summary: There were 2 ERROR messages shown, returning a non-zero exit code.
This is the build configuration output of bitbake I finally get:
Build Configuration:
BB_VERSION = "1.34.0"
BUILD_SYS = "x86_64-linux"
NATIVELSBSTRING = "universal-4.8"
TARGET_SYS = "arm-poky-linux-gnueabi"
MACHINE = "apalis-imx6"
DISTRO = "poky"
DISTRO_VERSION = "2.3.2"
TUNE_FEATURES = "arm armv7a vfp thumb neon callconvention-hard cortexa9"
TARGET_FPU = "hard"
meta
meta-poky
meta-yocto-bsp
meta-toradex = "pyro:a75a2f4272226e924d8c9deb699a19ca9e606a5b"
meta-mender-core = "pyro:302111e4a79e4844cad536fcc9475764eb254611"
meta-freescale = "pyro:06178400afbd641a6709473fd21d893dcd3cfbfa"
meta-freescale-3rdparty = "pyro:9613dbc02ca970122a01c935bc9e5789ced73a9d"
EDIT : as suggested by #Anders I replaced meta-fsl-arm and meta-fsl-arm-extra which were on pyro branch (I checked) with meta-freescale-3rdparty. I now get the following error:
ERROR: Layer 'fsl-arm-extra' depends on layer 'freescale-layer', but this layer is not enabled in your configuration
ERROR: Layer 'fsl-arm-extra' depends on layer 'freescale-layer', but this layer is not enabled in your configuration
EDIT: It said the file is missing so I supplied it the following file from here http://cgit.openembedded.org/openembedded-core/tree/meta/classes/image_types_uboot.bbclass?h=daisy
created a file and now I get the following error:
ERROR: /home/rama/repositories/poky/meta-fsl-arm/recipes-fsl/images/fsl-image-mfgtool-initramfs.bb: No IMAGE_CMD defined for IMAGE_FSTYPES entry 'sdimg' - possibly invalid type name or missing support class
ERROR: Failed to parse recipe: /home/rama/repositories/poky/meta-fsl-arm/recipes-fsl/images/fsl-image-mfgtool-initramfs.bb
I tried bitbaking a file, when I did I get the following error:
ERROR: ParseError at /home/rama/repositories/poky/meta/classes/image.bbclass:185: Could not inherit file classes/image_types_uboot.bbclass
I have the following meta-layers, all on the pyro branch, I tried playing around with the branches I still get the same error somehow :
meta
meta-mender-core
meta-toradex
meta-fsl-arm
meta-fsl-arm-extra
meta-qt5
If I add the meta-angstrom to the above I get the following error:
ERROR: ExpansionError during parsing /home/rama/repositories/poky/meta-angstrom/recipes-angstrom/angstrom/angstrom-version.bb
Traceback (most recent call last):
bb.data_smart.ExpansionError: Failure expanding variable do_install, expression was install -d /home/rama/repositories/poky/build/tmp/work/apalis_imx6-poky-linux-gnueabi/angstrom-version/2_2.3.2-r12/image/etc
echo "Angstrom 2.3.2 (Core edition)" > /home/rama/repositories/poky/build/tmp/work/apalis_imx6-poky-linux-gnueabi/angstrom-version/2_2.3.2-r12/image/etc/angstrom-version
echo "Built from branch: pyro" >> /home/rama/repositories/poky/build/tmp/work/apalis_imx6-poky-linux-gnueabi/angstrom-version/2_2.3.2-r12/image/etc/angstrom-version
echo "Revision: a75a2f4272226e924d8c9deb699a19ca9e606a5b" >> /home/rama/repositories/poky/build/tmp/work/apalis_imx6-poky-linux-gnueabi/angstrom-version/2_2.3.2-r12/image/etc/angstrom-version
echo "Target system: arm-poky-linux-gnueabi" >> /home/rama/repositories/poky/build/tmp/work/apalis_imx6-poky-linux-gnueabi/angstrom-version/2_2.3.2-r12/image/etc/angstrom-version
echo "${#get_layers(bb, d)}" > /home/rama/repositories/poky/build/tmp/work/apalis_imx6-poky-linux-gnueabi/angstrom-version/2_2.3.2-r12/image/etc/angstrom-build-info
echo "VERSION=\"2.3.2\"" > /home/rama/repositories/poky/build/tmp/work/apalis_imx6-poky-linux-gnueabi/angstrom-version/2_2.3.2-r12/image/etc/os-release
echo "VERSION_ID=\"2.3.2\"" > /home/rama/repositories/poky/build/tmp/work/apalis_imx6-poky-linux-gnueabi/angstrom-version/2_2.3.2-r12/image/etc/os-release
echo "NAME=\"Angstrom\"" >> /home/rama/repositories/poky/build/tmp/work/apalis_imx6-poky-linux-gnueabi/angstrom-version/2_2.3.2-r12/image/etc/os-release
echo "ID=\"angstrom\"" >> /home/rama/repositories/poky/build/tmp/work/apalis_imx6-poky-linux-gnueabi/angstrom-version/2_2.3.2-r12/image/etc/os-release
echo "PRETTY_NAME=\"The Ångström Distribution 2.3.2\"" >> /home/rama/repositories/poky/build/tmp/work/apalis_imx6-poky-linux-gnueabi/angstrom-version/2_2.3.2-r12/image/etc/os-release
echo "ANSI_COLOR=\"1;35\"" >> /home/rama/repositories/poky/build/tmp/work/apalis_imx6-poky-linux-gnueabi/angstrom-version/2_2.3.2-r12/image/etc/os-release
echo "HOME_URL=\"http://www.angstrom-distribution.org\"" >> /home/rama/repositories/poky/build/tmp/work/apalis_imx6-poky-linux-gnueabi/angstrom-version/2_2.3.2-r12/image/etc/os-release
install -d /home/rama/repositories/poky/build/tmp/work/apalis_imx6-poky-linux-gnueabi/angstrom-version/2_2.3.2-r12/image/usr/bin
install -m 0755 /home/rama/repositories/poky/build/tmp/work/apalis_imx6-poky-linux-gnueabi/angstrom-version/2_2.3.2-r12/lsb_release /home/rama/repositories/poky/build/tmp/work/apalis_imx6-poky-linux-gnueabi/angstrom-version/2_2.3.2-r12/image/usr/bin/
which triggered exception AttributeError: 'module' object has no attribute 'getVar'
I need to bitbake file and install it on my apalis imx6, do I need this meta-angstrom layer?
If I change the machine to qemux64 and I remove the toradex,fsl,angstrom layers, it starts to bitabke just fine! So its definitely a problem with those layers.
Any help is appreciated!
I am executing this on Ubuntu 14.04
EDIT: Switching to master branch on meta-angstrom I was able to solve the second, error however I still get the first error. Hope this helps somebody else.
EDIT: It seems the problem has recurred, no idea why still investigating
EDIT: When I bit bake I get stuff this like :
Loading cache: 100% |############################################################################################################################################| Time: 0:00:00
Loaded 158 entries from dependency cache.
NOTE: /home/rama/repositories/poky/meta-qt5/recipes-qt/qt5/qttools_git.bb: base_contains is deprecated, please use bb.utils.contains instead. | ETA: 0:00:16
NOTE: /home/rama/repositories/poky/meta-qt5/recipes-qt/qt5/qttools_git.bb: base_contains is deprecated, please use bb.utils.contains instead.
NOTE: /home/rama/repositories/poky/meta-qt5/recipes-qt/qt5/qtdeclarative_git.bb: base_contains is deprecated, please use bb.utils.contains instead.
NOTE: /home/rama/repositories/poky/meta-qt5/recipes-qt/qt5/qttools_git.bb: base_contains is deprecated, please use bb.utils.contains instead.
NOTE: /home/rama/repositories/poky/meta-qt5/recipes-qt/qt5/qttools_git.bb: base_contains is deprecated, please use bb.utils.contains instead.
No info on the layers.
My layers are all upto date, and I have switched them to master.
How else can I get layer info?
EDIT:
This is what I get from bitbake, no other information whatsoever
bitbake core-image-minimal
WARNING: Host distribution "ubuntu-14.04" has not been validated with this version of the build system; you may possibly experience unexpected failures. It is recommended that you use a tested distribution.
NOTE: /home/rama/repositories/poky/meta-qt5/recipes-qt/qt5/qttools_git.bb: base_contains is deprecated, please use bb.utils.contains instead. | ETA: 0:00:16
NOTE: /home/rama/repositories/poky/meta-qt5/recipes-qt/qt5/qttools_git.bb: base_contains is deprecated, please use bb.utils.contains instead.
NOTE: /home/rama/repositories/poky/meta-qt5/recipes-qt/qt5/qtwebkit-examples_git.bb: base_contains is deprecated, please use bb.utils.contains instead.
NOTE: /home/rama/repositories/poky/meta-qt5/recipes-qt/qt5/qtwebkit-examples_git.bb: base_contains is deprecated, please use bb.utils.contains instead.
NOTE: /home/rama/repositories/poky/meta-qt5/recipes-qt/qt5/qttools_git.bb: base_contains is deprecated, please use bb.utils.contains instead.
NOTE: /home/rama/repositories/poky/meta-qt5/recipes-qt/qt5/qttools_git.bb: base_contains is deprecated, please use bb.utils.contains instead.
NOTE: /home/rama/repositories/poky/meta-qt5/recipes-qt/qt5/qttools_git.bb: base_contains is deprecated, please use bb.utils.contains instead. | ETA: 0:00:17
NOTE: /home/rama/repositories/poky/meta-qt5/recipes-qt/qt5/qttools_git.bb: base_contains is deprecated, please use bb.utils.contains instead.
EDIT : local.conf
MACHINE ?= "apalis-imx6"
MENDER_FEATURES_ENABLE_append = " mender-uboot"
DISTRO ?= "poky"
PACKAGE_CLASSES ?= "package_rpm"
#SDKMACHINE ?= "i686"
EXTRA_IMAGE_FEATURES ?= "debug-tweaks"
USER_CLASSES ?= "buildstats image-mklibs image-prelink"
PATCHRESOLVE = "noop"
BB_DISKMON_DIRS = "\
STOPTASKS,${TMPDIR},1G,100K \
STOPTASKS,${DL_DIR},1G,100K \
STOPTASKS,${SSTATE_DIR},1G,100K \
STOPTASKS,/tmp,100M,100K \
ABORT,${TMPDIR},100M,1K \
ABORT,${DL_DIR},100M,1K \
ABORT,${SSTATE_DIR},100M,1K \
ABORT,/tmp,10M,1K"
PACKAGECONFIG_append_pn-qemu-native = " sdl"
PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl"
MENDER_ARTIFACT_NAME = "demo-mender-artifact"
INHERIT += "mender-full"
INHERIT += "rm_work"
DISTRO_FEATURES_append = " systemd"
VIRTUAL-RUNTIME_init_manager = "systemd"
DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit"
VIRTUAL-RUNTIME_initscripts = ""
IMAGE_FSTYPES = "ext4"
bblayers.conf:
# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf
# changes incompatibly
POKY_BBLAYERS_CONF_VERSION = "2"
BBPATH = "${TOPDIR}"
BBFILES ?= ""
BBLAYERS ?= " \
/home/rama/repositories/poky/meta \
/home/rama/repositories/poky/meta-poky \
/home/rama/repositories/poky/meta-yocto-bsp \
/home/rama/repositories/meta-mender/meta-mender-core \
/home/rama/repositories/poky/meta-toradex \
/home/rama/repositories/poky/meta-fsl-arm \
/home/rama/repositories/poky/meta-fsl-arm-extra \
/home/rama/repositories/poky/meta-qt5 \
"
I remove meta-angstrom from the layers, it seems to give me some other errors as well.
Am I missing some layers?
I tried adding the meta-openembedded layers like meta-oe and so on, I got some errors like :
ERROR: ParseError at /home/rama/repositories/poky/meta-openembedded/meta-oe/recipes-support/maliit/maliit-plugins_git.bb:7: Could not inherit file classes/qt4x11.bbclass
so I removed it as well.
Your error:
ERROR: /home/rama/repositories/poky/meta-fsl-arm/recipes-fsl/images/fsl-image-mfgtool-initramfs.bb: No IMAGE_CMD defined for IMAGE_FSTYPES entry 'sdimg' - possibly invalid type name or missing support class
ERROR: Failed to parse recipe: /home/rama/repositories/poky/meta-fsl-arm/recipes-fsl/images/fsl-image-mfgtool-initramfs.bb
suggests that one of your layers aren't updated to pyro. Looking further at your issue, meta-fsl-arm is severely outdated! (No pyro branch etc). This layer has been replaces by meta-freescale.
You probably will have to take a closer look at eg meta-fsl-arm-extra too, to see if it's currently maintained and updated or not.
This is the reason I asked you about the exact branches and versions of each layer. There is no pyro branch for meta-fsl-arm!

Cannot load a plugin to frama-c with call to ocamlyices functions

I am trying to develop a plugin to frama-c.
I did build the application, which has several files, and then created the makefile referencing all the files i needed.
I am able to use make and then make install and execute the plugin. My problem appears when i call functions from the ocamlyices library in a function...
I am still able to do the make and make install and when i try to execute i get the following error:
[kernel] warning: cannot load plug-in 'name' (incompatible with Fluorine-20130601).
[kernel] user error: option `<name>' is unknown.
use `frama-c -help' for more information.
[kernel] Frama-C aborted: invalid user input.
So it says it is incompatible when I add the call to ocamlyices functions. Is there any option/configuration I am missing somewhere?
Thank you for your help.
The final solution looked like this:
FRAMAC_SHARE := $(shell frama-c.byte -print-path)
FRAMAC_LIBDIR := $(shell frama-c.byte -print-libpath)
PLUGIN_NAME = Fact
# All needed files
PLUGIN_CMO = ../base/basic_types concolic_search run_fact ../lib/lib
PLUGIN_DOCFLAGS = -I ../base -I ../lib -I $(YICES) -I /usr/lib/ocaml/batteries -I ../instrumentation
PLUGIN_BFLAGS = -I ../base -I ../lib -I $(YICES) -I ../instrumentation
PLUGIN_OFLAGS = -I ../base -I ../lib -I $(YICES) -I ../instrumentation
PLUGIN_EXTRA_BYTE = $(YICES)/ocamlyices.cma
PLUGIN_EXTRA_OPT = $(YICES)/ocamlyices.cmxa
include $(FRAMAC_SHARE)/Makefile.dynamic
The variable $(YICES) is defined as
export YICES="/usr/local/lib/ocaml/3.12.1/ocamlyices"
As mentioned by Anne, if your plug-in uses an external library that is not already included by Frama-C itself, you need a few more steps than for a basic plug-in, especially setting PLUGIN_EXTRA_BYTE and PLUGIN_EXTRA_OPT to the external libraries that you want to be linked to your plug-in. It might also be necessary to adapt the flags passed to the linker with PLUGIN_LINK_BFLAGS and PLUGIN_LINK_OFLAGS, but this is heavily dependent on ocamlyices itself. More information on the variables that can be used to customize the compilation of your plug-in can be found in section 5.3.3 of Frama-C's development guide.

Jenkins Build Script exits after Google Test execution

I am building a Qt GUI application via Jenkins. I added 3 build steps:
Building the test executable
Running the test executable
compiling a coverage report with gcovr
For some reason, the shell task for running the test executable stops after execution. Even a simple echo does not run after. The tests are written with Google Test and output xUnit XML files, which are analyzed after the build.
Some tests start the applications user interface, so I installed the jenkins xvnc plugin to get them to run.
The build tasks are as follows:
Build
cd $WORKSPACE/projectfiles/QMake
sh createbin.sh
Test
cd $WORKSPACE/bin
./Application --gtest_output=xml
Coverage Report
cd $WORKSPACE/projectfiles/QMake/out
gcovr -x -o coverage.xml
Now, an echo at the end of the first build task is correctly printed, but an echo at the end of the second is not. The third build task is therefore not even run, although the Google Test output is visible. I thought that maybe the problem is that some of the Google Tests fail, but why whould the script stop executing just because the tests fail?
Maybe someone can give me a hint on why the second task stops.
Edit
The console output looks like this:
Updating svn://repo/ to revision '2012-11-15T06:43:15.228 -0800'
At revision 2053
no change for svn://repo/ since the previous build
Starting xvnc
[VG5] $ vncserver :10
New 'ubuntu:10 (jenkins)' desktop is ubuntu:10
Starting applications specified in /var/lib/jenkins/.vnc/xstartup
Log file is /var/lib/jenkins/.vnc/ubuntu:10.log
[VG5] $ /bin/sh -xe /tmp/hudson7777833632767565513.sh
+ cd /var/lib/jenkins/workspace/projectfiles/QMake
+ sh createbin.sh
... Compiler output ...
+ echo Build Done
Build Done
[VG5] $ /bin/sh -xe /tmp/hudson4729703161621217344.sh
+ cd /var/lib/jenkins/workspace/VG5/bin
+ ./Application --gtest_output=xml
Xlib: extension "XInputExtension" missing on display ":10".
[==========] Running 29 tests from 8 test cases.
... Test output ...
3 FAILED TESTS
Build step 'Execute shell' marked build as failure
Terminating xvnc.
$ vncserver -kill :10
Killing Xvnc4 process ID 1953
Recording test results
Skipping Cobertura coverage report as build was not UNSTABLE or better ...
Finished: FAILURE
Generally, if one Build Step fails, the rest will not be executed.
Pay attention to this line from your log:
[VG5] $ /bin/sh -xe
The -x makes the shell print each command in console before execution.
The -e makes the shell exit with error if any of the commands failed.
A "fail" in this case, would be a return code of not 0 from any of the individual commands.
You can verify this by running this directly on the machine:
./Application --gtest_output=xml
echo $?
If the echo $? displays 0, it indicates successful completion of the previous command. If it displays anything else, it indicates an error code from the previous command (from ./Application), and Jenkins treats it as such.
Now, there are several things at play here. First is that your second Build Step (essentially a temporary shell script /tmp/hudson4729703161621217344.sh) is set to fail if one command fails (the default behaviour). When the Build Step fails, Jenkins will stop and fail the whole job.
You can fix this particular behaviour by adding set +e to the top of your second Build Step. This will not cause the script (Build Step) to fail due to individual command failure (it will display an error for the command, and continue).
However, the overall result of the script (Build Step) is the exit code of the last command. Since in your OP, you only have 2 commands in the script, and the last is failing, it will cause the whole script (Build Step) to be considered a failure, despite the +x that you've added. Note that if you add an echo as the 3rd command, this would actually work, since the last script command (echo) was successful, however this "workaround" is not what you need.
What you need is proper error handling added to your script. Consider this:
set +e
cd $WORKSPACE/bin && ./Application --gtest_output=xml
if ! [ $? -eq 0 ]; then
echo "Tests failed, however we are continuing"
else
echo "All tests passed"
fi
Three things are happening in the script:
First, we are telling shell not to exit on failure of individual commands
Then i've added basic error handling in the second line. The && means "execute ./Application if-and-only-if the previous cd was successful. You never know, maybe the bin folder is missing, or whatever else can happen. BTW, the && internally works on the same error code equals 0 principle
Lastly, there is now proper error handling for the result of ./Application. If the result is not 0, then we show that it had failed, else we show that it had passed. Note, this since the last command is not a (potentially) failing ./Application, but an echo from either of if-else possibilities, the overall result of the script (Built Step) will be a success (i.e 0), and the next Build Step will be executed.
BTW, you can as well put all 3 of your build steps into a single build step with proper error handling.
Yes... this answer may be a little longer than what's required, but i wanted you to understand how Jenkins and shell treat exit codes.

Resources