Trying to read a webpage in Hound, I get a compilation error for Hound.start_session - selenium

I started a new project and configured it like so:
mix new example
cd example
I emptied ´lib/example.ex´ and placed the following code there:
Application.start :hound
defmodule Example do
use Hound.Helpers
def run do
Hound.start_session
navigate_to "http://akash.im"
IO.inspect page_title()
# Automatically invoked if the session owner process crashes
Hound.end_session
end
end
Example.run
This is the sample code provided at https://github.com/HashNuke/hound/blob/master/notes/simple-browser-automation.md
Then I installed Selenium server via brew install selenium-server-standalone (I'm on MacOS), started it via brew services start selenium-server-standalone and added config :hound, driver: "selenium" to config/config.exs
I added Application.ensure_all_started(:hound) as the first line of test/test_helper.exs.
Finally, I added {:hound, "~> 1.0"} to mix.exs and ran mix test. That is when I get the following compilation error:
localhost:example alex$ mix test
===> Compiling parse_trans
===> Compiling mimerl
===> Compiling metrics
===> Compiling unicode_util_compat
===> Compiling idna
==> jason
Compiling 8 files (.ex)
Generated jason app
==> ssl_verify_fun
Compiling 7 files (.erl)
Generated ssl_verify_fun app
===> Compiling certifi
===> Compiling hackney
==> hound
Compiling 37 files (.ex)
Generated hound app
==> example
Compiling 1 file (.ex)
== Compilation error in file lib/example.ex ==
** (ArgumentError) argument error
(stdlib) :ets.lookup(Hound.SessionServer, #PID<0.592.0>)
(hound) lib/hound/session_server.ex:19: Hound.SessionServer.current_session_id/1
(hound) lib/hound/session_server.ex:13: Hound.SessionServer.session_for_pid/2
lib/example.ex:7: Example.run/0
localhost:example alex$ mix test
Compiling 1 file (.ex)
== Compilation error in file lib/example.ex ==
** (ArgumentError) argument error
(stdlib) :ets.lookup(Hound.SessionServer, #PID<0.160.0>)
(hound) lib/hound/session_server.ex:19: Hound.SessionServer.current_session_id/1
(hound) lib/hound/session_server.ex:13: Hound.SessionServer.session_for_pid/2
lib/example.ex:7: Example.run/0
Am I forgetting a step somewhere or configuring things incorrectly? Any help immensely appreciated, thanks!

I emptied lib/example.ex and placed the following code there:
defmodule Example do
...
end
Example.run
There is a difference between .ex files and .exs files. You decided to put that code in the application's main .ex file. Get rid of this line:
Example.run
Then, to execute Example.run() you do this:
.../example$ iex -S mix
iex(1)> Example.run
"Akash Manohar // #HashNuke"
:ok
Or, you can change the extension to .exs, then run the code with this:
.../example$ mix run lib/example.exs
On the other hand, if you want mix test to run a test, then you have to put the test in the test directory. For example:
defmodule ExampleTest do
use ExUnit.Case
use Hound.Helpers
test "page title is correct" do
Hound.start_session
navigate_to "http://akash.im"
#IO.inspect page_title()
assert page_title() == "Akash Manohar // #HashNuke"
Hound.end_session
end
end
In the hound exunit example here, the hound_session() call caused an error for me:
15:06:33.736 [error] GenServer Hound.SessionServer terminating
** (RuntimeError) could not create a new session: timeout, check webdriver is running
(hound) lib/hound/session_server.ex:101: Hound.SessionServer.create_session/2

Related

Karate Performance testing : Getting build failure with error "Unrecognized VM option 'UseBiasedLocking'

I am trying to reuse Karate tests for performance testing with Gatling and Scala.
I have configured everything as described in documentation. But then when I run the mvn command I am getting error "Unrecognized VM option 'UseBiasedLocking' Error: Could not create the Java Virtual Machine."
mvn command used to run tests: mvn test-compile gatling:test
Tried with looking at Env path variables and running the mvn command with different options. But still getting same error
Failed to execute goal io.gatling:gatling-maven-plugin:4.1.5:test (default-cli) on project PerformanceTesting: Gatling failed.: Process exited with an error: 1 (Exit value: 1)
Below is the POM file
Scala File
The issue is resolved after upgrading the gatling.plugin.version to 4.2.7 as my Java version 19 is not supporting old gatling plugin.
Below article helped to resolve
Unrecognized VM option 'UseBiasedLocking' Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit

Building C++ Pybind11 extension with setuptools and CMake generates .so directory

I am trying to use setuptools to install a C++ library with a Pybind11 interface using CMake. For using CMake with setuptools, I am using the code in the following answer: Extending setuptools extension to use CMake in setup.py?
I am able to build the library by hand with cmake.
Unfortunately however, when executing pip install . in the root directory of my project, the build fails.
While the first call to cmake (self.spawn(['cmake', str(cwd)] + cmake_args)) finishes without any error, executing the second call (self.spawn(['cmake', '--build', '.'] + build_args)) gives me the following error:
/users/thoerman/miniconda3/envs/postproc_np_products/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: cannot open output file /users/thoerman/postproc_np_products/build/lib.linux-x86_64-cpython-37/postproc_ops_cpp.cpython-37m-x86_64-linux-gnu.so: Is a directory
collect2: error: ld returned 1 exit status
gmake[3]: *** [/users/thoerman/postproc_np_products/build/lib.linux-x86_64-cpython-37/postproc_ops_cpp.cpython-37m-x86_64-linux-gnu.so] Error 1
gmake[2]: *** [CMakeFiles/postproc_ops_cpp.dir/all] Error 2
gmake[1]: *** [CMakeFiles/postproc_ops_cpp.dir/rule] Error 2
gmake: *** [postproc_ops_cpp] Error 2
But when running the exact same commands on the command line inside the build_temp directory, everything works just fine.
Does anyone have a hint for me, what might be going wrong?
After further digging into the problem, I found the solution myself.
The problem was with the lines
extdir = pathlib.Path(self.get_ext_fullpath(ext.name))
extdir.mkdir(parents=True, exist_ok=True)
This created a directory for the target to be built. Building the target then failed, since there was already a directory with the same name.
I was able to solve it by replacing the second line as follows:
extdir.parent.mkdir(parents=True, exist_ok=True)

Cannot install kernel-devsrc

I'm trying to set up my environment to use Yocto's generated SDK to compile my out-of-tree module, but for some reason, I'm getting an error.
cp: cannot stat 'arch/arm/kernel/module.lds': No such file or directory
I'm using Poky distribution and meta-raspberrypi which is needed because I'm using the RPI ZeroW board.
Apart from this everything works fine. I'm able to compile the entire image and load it on the board.
Here is the line I've added to local.conf
TOOLCHAIN_TARGET_TASK_append = " kernel-devsrc"
as I've found in the documentation.
Also below you can find the whole log from the compilation.
DEBUG: Executing python function extend_recipe_sysroot
NOTE: Direct dependencies are ['virtual:native:/home/pp/yocto-hh/sources/poky/meta/recipes-bsp/u-boot/u-boot-tools_2020.07.bb:do_populate_sysroot', '/home/pp/yocto-hh/sources/poky/meta/recipes-devtools/binutils/binutils-cross_2.35.1.bb:do_populate_sysroot', '/home/pp/yocto-hh/sources/poky/meta/recipes-kernel/kmod/kmod-native_git.bb:do_populate_sysroot', '/home/pp/yocto-hh/sources/poky/meta/recipes-devtools/gcc/gcc-cross_10.2.bb:do_populate_sysroot', 'virtual:native:/home/pp/yocto-hh/sources/poky/meta/recipes-support/gmp/gmp_6.2.0.bb:do_populate_sysroot', 'virtual:native:/home/pp/yocto-hh/sources/poky/meta/recipes-devtools/pkgconfig/pkgconfig_git.bb:do_populate_sysroot', 'virtual:native:/home/pp/yocto-hh/sources/poky/meta/recipes-extended/xz/xz_5.2.5.bb:do_populate_sysroot', 'virtual:native:/home/pp/yocto-hh/sources/poky/meta/recipes-connectivity/openssl/openssl_1.1.1k.bb:do_populate_sysroot', 'virtual:native:/home/pp/yocto-hh/sources/poky/meta/recipes-devtools/bison/bison_3.7.2.bb:do_populate_sysroot', '/home/pp/yocto-hh/sources/poky/meta/recipes-devtools/quilt/quilt-native_0.66.bb:do_populate_sysroot', 'virtual:native:/home/pp/yocto-hh/sources/poky/meta/recipes-extended/bc/bc_1.07.1.bb:do_populate_sysroot', '/home/pp/yocto-hh/sources/poky/meta/recipes-core/glibc/glibc_2.32.bb:do_populate_sysroot', 'virtual:native:/home/pp/yocto-hh/sources/poky/meta/recipes-devtools/patch/patch_2.7.6.bb:do_populate_sysroot', '/home/pp/yocto-hh/sources/poky/meta/recipes-kernel/kern-tools/kern-tools-native_git.bb:do_populate_sysroot', 'virtual:native:/home/pp/yocto-hh/sources/poky/meta/recipes-devtools/pseudo/pseudo_git.bb:do_populate_sysroot', '/home/pp/yocto-hh/sources/poky/meta/recipes-devtools/gcc/gcc-runtime_10.2.bb:do_populate_sysroot']
NOTE: Installed into sysroot: []
NOTE: Skipping as already exists in sysroot: ['u-boot-tools-native', 'binutils-cross-arm', 'kmod-native', 'gcc-cross-arm', 'gmp-native', 'pkgconfig-native', 'xz-native', 'openssl-native', 'bison-native', 'quilt-native', 'bc-native', 'glibc', 'patch-native', 'kern-tools-native', 'pseudo-native', 'gcc-runtime', 'python3-native', 'gnu-config-native', 'autoconf-native', 'libtool-native', 'gtk-doc-native', 'automake-native', 'zlib-native', 'texinfo-dummy-native', 'readline-native', 'flex-native', 'attr-native', 'libmpc-native', 'mpfr-native', 'linux-libc-headers', 'gettext-minimal-native', 'libgcc', 'libnsl2-native', 'gdbm-native', 'libffi-native', 'bzip2-native', 'util-linux-native', 'sqlite3-native', 'libtirpc-native', 'm4-native', 'ncurses-native', 'libcap-ng-native', 'libpcre2-native']
DEBUG: Python function extend_recipe_sysroot finished
DEBUG: Executing shell function do_install
cp: cannot stat 'arch/arm/kernel/module.lds': No such file or directory
WARNING: exit code 1 from a shell command.
ERROR: Execution of '/home/pp/yocto-hh/build/tmp/work/hhctrl-poky-linux-gnueabi/kernel-devsrc/1.0-r0/temp/run.do_install.109942' failed with exit code 1:
cp: cannot stat 'arch/arm/kernel/module.lds': No such file or directory
WARNING: exit code 1 from a shell command
The command I am using to produce the SDK is:
bitbake name-of-my-image -c populate_sdk
What could be the problem here? Or how should I debug it? I've found a few touching on the subject and it seems that it should be already fixed, but for some reason, in my environment, it still does not work.
Missing the module.lds file in the latest kernel. Apply the following source code as a patch in the kernel and build the image.
diff -Naur a/arch/arm/kernel/module.lds b/arch/arm/kernel/module.lds
--- a/arch/arm/kernel/module.lds 1970-01-01 05:30:00.000000000 +0530
+++ b/arch/arm/kernel/module.lds 2020-02-28 21:53:45.000000000 +0530
## -0,0 +1,5 ##
+/* SPDX-License-Identifier: GPL-2.0 */
+SECTIONS {
+ .plt : { BYTE(0) }
+ .init.plt : { BYTE(0) }
+}

sencha build giving error stbuild exited with non-zero code : 7

I wanted to create .apk file of my sencha application so I executed below command
sencha package build packager.json
but when I executed above command,it generates error as given below.
'C:\Program' is not recognized as an internal or external command,operable program or batch file.
""D:/Android/AndroidSDKr15\tools\android" create project --target android-16 --name chartDemoApp --activity STActivity --path "../build/" --package triumphsys. mobility.chartDemoApp"
Could not run ant with error: 1
Failed to package application
[ERR] stbuild exited with non-zero code : 7
even I have attached my command prompt here and packager.json here.
please help me to resolve it.
I was able to solve the problem by uninstalling "C:\Program files\Sencha Cmd" and again re-installing it at "C:\Sencha" without any spaces in folder name. and it worked for me.

rubber stuck compiling ruby

for some reason whenever i try to spawn a server with rubber it gets stuck after compiling ruby-1.9.2.
If I SSH into the server, I see that before it finishes compiling, almost at the very end, the rubber script disconnects the connection.
** [out :: stageone.foo.com] ruby-1.9.2-p0 - #compiling
If I try to do cap rubber:bootstrap it fails at trying to install mongrel citing that my ruby installation might not be complete.
Fetching: mongrel-1.1.5.gem (100%)39%)
** Building native extensions. This could take a while...
** ERROR: Error installing mongrel:
** ERROR: Failed to build gem native extension.
**
** /usr/local/rvm/rubies/ruby-1.9.2-p0/bin/ruby extconf.rb
I'm trying to create a staging server using the "complete_mongrel_mysql" script.
any ideas?
Explanation is on the mailing list:
https://groups.google.com/d/msg/rubber-ec2/K-ahRFZpAAk/2fTJI5EeURwJ
Workaround checked into code for next release at:
https://github.com/wr0ngway/rubber/commit/64299e2005dcae9006273a6f915bf01dd8c87192