Phpunit runs in shell but fails in Jenkins' - jenkins

When I run PhpUnit tests in shell, they run OK, but when run from Jenkin's build step (Execute Shell), it fails with:
[workspace] $ /bin/sh -xe /tmp/hudson3868615221631158667.sh
+ phpunit --log-junit trunk/tests/phpunit_results.xml --bootstrap trunk/tests/bootstrap.php trunk/tests/
E_WARNING: mkdir(): No such file or directory
in Nette/common/Configurator.php(255)
in Nette/common/Configurator.php(255) mkdir()
in Nette/common/Configurator.php(141) Nette\Configurator->getCacheDirectory()
in trunk/tests/bootstrap.php(14) Nette\Configurator->createRobotLoader()
in phpunit/Util/Fileloader.php(93) include_once()
in phpunit/Util/Fileloader.php(77) PHPUnit_Util_Fileloader::load()
in phpunit/TextUI/Command.php(808) PHPUnit_Util_Fileloader::checkAndLoad()
in phpunit/TextUI/Command.php(586) PHPUnit_TextUI_Command->handleBootstrap()
in phpunit/TextUI/Command.php(141) PHPUnit_TextUI_Command->handleArguments()
in phpunit/TextUI/Command.php(132) PHPUnit_TextUI_Command->run()
in local/bin/phpunit(586) PHPUnit_TextUI_Command::main()
Build step 'Execute shell' marked build as failure
I found some similar questions, but none of them answered/fixed my problem.
Here is the result of running from shell:
user#server:~/$ phpunit --log-junit trunk/tests/phpunit_results.xml --bootstrap trunk/tests/bootstrap.php trunk/tests/
ccccPHPUnit 4.1.3 by Sebastian Bergmann.
.......
Time: 128 ms, Memory: 6.75Mb
OK (7 tests, 8 assertions)
I welcome every suggestion.

Related

Docker selenium firefox image creation issue

I'm trying to create a selenium firefox node image. I've added the "COPY generate_config /opt/bin/generate_config" command to copy the generate_config file from local. Then when I run the command "RUN /opt/bin/generate_config > /opt/selenium/config.json" , I get error -
**# #10 0.320 /bin/sh: 1: /opt/bin/generate_config: not found
------**
executor failed running [/bin/sh -c /opt/bin/generate_config > /opt/selenium/config.json]: exit code: 127
Can anyone please help me with solution
I tried adding sudo, changing the cat command. nothing worked.

How to see Bazel build output?

How do you view stdout of bazel build as it happens?
I want to see all the logs written to stdout during a bazel build.
No one of these allows it to show the ls command before after it has failed
$ bazel build --show_progress --worker_verbose --verbose_failures --verbose_explanations=true -s --test_output=streamed :build
genrule(
name = "build",
cmd = "ls && sleep 60 && exit 1",
)
$ bazel build --show_progress --worker_verbose --verbose_failures --verbose_explanations=true -s --test_output=streamed :build
WARNING: --verbose_explanations has no effect when --explain=<file> is not enabled
INFO: Analyzed target //:build (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
SUBCOMMAND: # //:build [action 'Executing genrule //:build']
(cd /private/var/tmp/_bazel_kevinsimper/f9e6a72c146c5ad83b84a8ebf539f8b2/execroot/__main__ && \
exec env - \
PATH=/usr/local/sbin \
/bin/bash -c 'source external/bazel_tools/tools/genrule/genrule-setup.sh; ls && sleep 60 && exit 1')
ERROR: /Users/kevinsimper/testproject/BUILD:1:1: Executing genrule //:build failed (Exit 1)
BUILD
TESTFILE
Target //:build failed to build
INFO: Elapsed time: 60.256s, Critical Path: 60.04s
INFO: 0 processes.
FAILED: Build did NOT complete successfully
There's no way to stream action stdout/stderr while it's executing, unless it's a test while using the --test_output=streamed flag.
You can follow an underhanded approach. If your build includes small number of lengthy actions, it is feasible to snoop for output in bazel-out/_tmp/actions/std{err,out}-* as it happens. This works for me with Bazel 3.1.0.

SGE - can't get password entry for user "jenkins"

I'm running the following SGE command thru Jenkins without any problem:
qsub -N my_job_name -q my_queue -l hostname=my_hostname -w e -notify -m n -cwd -b y -o /dev/null -e my_error_path -v my_env_var ...
Your job 1082782 ("my_job_name") has been submitted
Finished: SUCCESS
I'm running a tool/script thru Jenkins that calls the previous SGE command and I get the following issue:
Q: Submitting my_job_name to SGE queue my_queue
S: my_job_name not compared:
SGE job exited
Job ID was 1082783
---------- Full accounting info from SGE ----------
SGE job entered error state: 1082783
TextTest terminated this job as a result. SGE's error reason follows:
error reason 1: can't get password entry for user "jenkins". Either the user does not exist or NIS error!
Results:
Tests that did not succeed:
my_job_name not compared: SGE job exited
Tests Run: 1, Incomplete: 1
Build step 'Execute shell' marked build as failure
Finished: FAILURE
Any ideas? Thanks :)

PhantomJS failed to load URL on Jetty running on Jenkins

I want to use the Siesta testing Framework with PhantomJS on a local server and there is no problem. I worked like in http://www.bryntum.com/forum/viewtopic.php?f=20&t=3068 and on my machine, there were nothing to complain about, so i want to combine it with Jenkins.
But using Jenkins an Error 403 appears.
What I do:
Copy the files of my project in the webapps folder of Jetty (incl.
Framework )
Start the jetty server (so far no problems)
Use the PhantomJs of the framwork on my
localhost:port/project/index.html
And there my Problem starts:
Failed to load URL: localhost:port/project/index.html(Status 403)
I searched for some results but didn't find anything that solves this problem.
Every hint is welcome
Thanks
To see what i've done:
My Jenkins Shell Script
JETTY="jetty-distribution-9.2.0.v20140526"
JETTYWEB="$JETTY/webapps"
DIR="$WORKSPACE/$JETTYWEB/myProject/src/test"
PHANTOM="$DIR/Siesta_Framework/bin"
rm -r "$JETTYWEB/myProject/"
mkdir "$JETTYWEB/myProject/"
cp -pr "src/" "$JETTYWEB/myProject/"
chmod u+x -R $JETTYWEB/
cd $WORKSPACE/$JETTY
# Start des Servers
java -DSTOP.PORT=11183 -jar start.jar -DSTOP.KEY=tadam &
sleep 5
#jenkins "$DIR/browse-autmation.html?phantom=true&enableCodeCoverage=false&hasPreviousReport=false&page=0
cd $PHANTOM
#curl http://localhost:11182/myProject/src/test/browse-automation.html
./phantomjs "http://127.0.0.1:11182/myProject/src/test/browse-automation.html"
#"http://.../ci/job/test-phatomJS/ws/src/test/browse-automation.html?phantom=true&enableCodeCoverage=false&hasPreviousReport=false&page=0"
#curl http://127.0.0.1:11182/myProject/src/test/Siesta_Framework/bin/phantomjs
sleep 15
# Stop des Servers -DSTOP.KEY=tadam
cd $WORKSPACE/$JETTY
java -DSTOP.PORT=11183 -DSTOP.KEY=tadam -jar start.jar --stop
And the Result was:
[EnvInject] - Loading node environment variables.
Building remotely on ja_lin01 in workspace /var/opt/coinop/data/workspace/test-phatomJS
Fetching changes from the remote Git repository
Fetching upstream changes from gitlab#moso-ci-srv.novalocal:b.rohn/myProject.git
Checking out Revision a056b4ac6a7b47a4e77f3f80c5b7cbc51167cefc (origin/master)
[test-phatomJS] $ /bin/bash -xe /tmp/hudson8419984949815797813.sh
+ JETTY=jetty-distribution-9.2.0.v20140526
+ JETTYWEB=jetty-distribution-9.2.0.v20140526/webapps
+ DIR=/var/opt/coinop/data/workspace/test-phatomJS/jetty-distribution-9.2.0.v20140526/webapps/myProject/src/test
+ PHANTOM=/var/opt/coinop/data/workspace/test-phatomJS/jetty-distribution-9.2.0.v20140526/webapps/myProject/src/test/Siesta_Framework/bin
+ rm -r jetty-distribution-9.2.0.v20140526/webapps/myProject/
+ mkdir jetty-distribution-9.2.0.v20140526/webapps/myProject/
+ cp -pr src/ jetty-distribution-9.2.0.v20140526/webapps/myProject/
+ chmod u+x -R jetty-distribution-9.2.0.v20140526/webapps/
+ cd /var/opt/coinop/data/workspace/test-phatomJS/jetty-distribution-9.2.0.v20140526
+ sleep 5
+ java -DSTOP.PORT=11183 -jar start.jar -DSTOP.KEY=tadam
WARNING: System properties and/or JVM args set. Consider using --dry-run or --exec
2014-07-01 15:37:10.895:INFO::main: Logging initialized #1014ms
2014-07-01 15:37:12.451:INFO:oejs.Server:main: jetty-9.2.0.v20140526
2014-07-01 15:37:12.480:INFO:oejdp.ScanningAppProvider:main: Deployment monitor [file:/data/coinop/data/workspace/test-phatomJS/jetty-distribution-9.2.0.v20140526/webapps/] at interval 1
2014-07-01 15:37:13.232:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext#57cd102a{/myProject,file:/data/coinop/data/workspace/test-phatomJS/jetty-distribution-9.2.0.v20140526/webapps/myProject/,AVAILABLE}{/myProject}
2014-07-01 15:37:13.255:INFO:oejs.ServerConnector:main: Started ServerConnector#6d622548{HTTP/1.1}{0.0.0.0:11182}
2014-07-01 15:37:13.255:INFO:oejs.Server:main: Started #3388ms
+ cd /var/opt/coinop/data/workspace/test-phatomJS/jetty-distribution-9.2.0.v20140526/webapps/myProject/src/test/Siesta_Framework/bin
+ ./phantomjs http://127.0.0.1:11182/myProject/src/test/browse-automation.html
/var/opt/coinop/data/workspace/test-phatomJS/jetty-distribution-9.2.0.v20140526/webapps/myProject/src/test/Siesta_Framework/bin
Launching PhantomJS 1.6.0 at http://127.0.0.1:11182/myProject/src/test/browse-automation.html
Failed to load URL: http://127.0.0.1:11182/myProject/src/test/browse-automation.html?phantom=true&enableCodeCoverage=false&hasPreviousReport=false&page=0(status: 403)
Process leaked file descriptors. See http://wiki.jenkins-ci.org/display/JENKINS/Spawning+processes+from+build for more information
Build step 'Execute shell' marked build as failure
2014-07-01 15:37:24.931:INFO:oejs.ServerConnector:Thread-0: Stopped ServerConnector#6d622548{HTTP/1.1}{0.0.0.0:11182}
Finished: FAILURE
after long searching i noticed, that the phantomjs call doesn't have all the informations it need. It needs the directory itself. So my resolution was: install phantomjs on the linux server and use this phantomjs, including the directory and the phantom script of the framework: now it works.
my actually call is:
./phantomjs "$DIR/phantomjs-launcher.js" $DIR http://127.0.0.1:11182/myProject/browse-automation.html
Situation: i cd in my phtomjs directory on the linux machine and give it the "DIR" of my framework/bin

Invoke build using sshexec in remote machine does not work

I have setup a SSH server in my remote machine (Windows) executing the following commands in my windows machine.
<sshexec host="host"
port="port"
username="uname"
password="pass"
trust="true"
Command="(E:; cd \buildProjectDemo\build\; ant -propertyfile configurable.properties build-installer)"
/>
But, the command does not execute in the remote machine. It just gives the output as,
hostExec:
[sshexec] Connecting to host
[sshexec] cmd : (E:; cd \buildProjectDemo\build\; ant -propertyfile configurable.properties build-installer)
BUILD SUCCESSFUL
What could be the problem?
The command needs to be changed as
Command="e: && cd E:\buildProjectDemo\build &ant -propertyfile configurable.properties build-installer"

Resources