Skip to content

okirch/twopence

 
 

Repository files navigation

What is Twopence

  • Twopence is a test executor
  • it can run tests in a KVM virtual machine without using the network
  • it can also run more traditional SSH tests in a remote machine
  • it can send the tests through a serial cable too

How does Twopence work

  • Twopence is basically a set of libraries
  • shell, ruby, and python wrappers are provided for convenience
  • each library is seen as a plugin,
  • currenly available plugins are virtio (KVM), ssh, serial, and tcp

How would I use it

Have a look at the examples:

A note on security

  • the test server runs on the system under test as root, performs no authentication, and will execute whatever command it is asked to
  • the SSH tests assume that you have published a public key with a private key without passphrase
  • in short, Twopence is very unsafe and should be reserved to pure test environments (test labs, no production servers)

How do I compile it

  • run the following commands as root (openSUSE/SLE):
# zypper install libssh-devel ruby-devel rubygem-rake-compiler python-devel
  • on Ubuntu:
# apt-get install libssh-dev ruby-dev rake-compiler python-dev
  • on Fedora
# dnf install libssh-devel ruby-devel rubygem-rake-compiler python-devel redhat-rpm-config
  • then run the following command, as a normal user:
$ ./configure --prefix=/usr --etcdir=/etc
$ make
  • and again as root user:
$ make install
$ ldconfig

How do I run the examples with SSH

  • on the system under test, make sure the sshd damon is started:
$ service sshd start

and that it is not being blocked by the firewall

  • on the testing system, create a pair of SSH keys:
$ ssh-keygen -t rsa

without setting a passphrase

  • copy the public key t* the system under test:
$ scp ~/.ssh/id_rsa.pub joe@sut.example.com:.
  • then, on the system under test, append the public key t* the authorized keys file:
cat id_rsa.pub >> ~/.ssh/authorized keys
  • repeat for each account that will be used to run the tests
  • in the directory /usr/local/lib/twopence/ adapt the first lines of test.rb and test.sh to the IP address or hostname of your system under test
  • run the following commands:
$ cd examples
$ /usr/local/lib/twopence/test.sh
$ ruby /usr/local/lib/twopence/test.rb

How do I run the examples with virtio

  • setup a KVM virtual machine
  • declare a UNIX domain socket
  • to do that, you can use virt-manager: Hardware => Channel => Path = the directory and name of your socket file Target type = virtio Target name = org.opensuse.twopence.0
  • or you can use the provided script:
$ /usr/local/lib/twopence/add_virtio_channel.sh mydomain
  • start the VM
  • copy the test server into the VM:
$ scp /usr/local/lib/twopence/twopence_test_server root@sut.example.com:.

instead of scp, you may use shared folders or whichever method you prefer

  • inside of the VM, run the server as root:
$ ./twopence_test_server
  • in the directory /usr/local/lib/twopence/ adapt the first lines of test.rb and test.sh to the name of the socket file you just created; for example:
export TARGET=virtio:/var/run/twopence/test.sock
  • run the following commands:
$ cd examples
$ export LD_LIBRARY_PATH=../library
$ ruby /usr/local/lib/twopence/test.rb
  • if you get error opening the communication, check the permissions of the socket file:
$ ls -l /var/run/twopence/test.sock

How do I run the examples with a serial cable

  • connect a null-modem cable to the system under test
  • connect the other end to the testing machine
  • determine the port name on both ends (you can use "minicom" to do that)
  • copy the test server into the system under test:
$ scp /usr/local/lib/twopence/twopence_test_server root@sut.example.com:.

instead of scp, you may use shared folders or whichever method you prefer

  • inside of the sut, run the server as root:
$ ./twopence_test_server
  • in the directory /usr/local/lib/twopence/ adapt the first lines of test.rb and test.sh to the name of the character device; for example:
export TARGET=serial:/dev/ttyS0
  • run the following commands:
$ cd examples
$ /usr/local/lib/twopence/test.sh
$ ruby /usr/local/lib/twopence/test.rb
  • if you get error opening the communication, check the permissions of the character device file:
$ ls -l /dev/ttyS0

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 74.6%
  • Roff 9.8%
  • Python 9.5%
  • Shell 3.8%
  • Makefile 1.3%
  • Ruby 1.0%