Skip to content

Commit

Permalink
Ci fixes (#39)
Browse files Browse the repository at this point in the history
* add ptrace caps to ci-docker

* seccomp opt to allow gdbserver to enable aslr

* increase sleeptime in test_gdbprotocol

* execute gdbs target.run() as blocking=True

* Fix ci-ubuntu version of gdb to 8.1-0ubuntu3

The most modern version of gdb, 8.1-0ubuntu3.1, introduces a bug when it
comes to 32bit binaries on 64bit systems. This affects our CI, hence,
let's use the slightly older 8.1-0ubuntu3 instead.
Thanks for bringing this bug to our attention goes to @reyammer.

* disabled temporary logging on testcase
  • Loading branch information
mariusmue authored Nov 4, 2019
1 parent 953b1dd commit 64d10c4
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ services:

before_install:
- docker pull ubuntu:18.04
- docker run -v /home/travis/build/$TRAVIS_REPO_SLUG:/avatar2 --name ubuntu -dit ubuntu:18.04
- docker run -v /home/travis/build/$TRAVIS_REPO_SLUG:/avatar2 --name ubuntu --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -dit ubuntu:18.04
- docker exec ubuntu apt-get update
- docker exec ubuntu apt-get install -y sudo

Expand All @@ -20,9 +20,9 @@ install:
- docker exec ubuntu apt-get install -y python python-pip
- docker exec ubuntu apt-get install -y python3 python3-pip
- docker exec ubuntu apt-get install -y libc6-i386
- docker exec ubuntu apt-get install -y gdb
- docker exec ubuntu apt-get install -y gdb=8.1-0ubuntu3
- docker exec ubuntu apt-get install -y pkg-config
- docker exec ubuntu apt-get install -y gdb-multiarch
- docker exec ubuntu apt-get install -y gdb-multiarch=8.1-0ubuntu3
- docker exec ubuntu apt-get install -y libcapstone3
- docker exec ubuntu apt-get install -y libcapstone-dev
- docker exec ubuntu pip2 install --upgrade pip
Expand Down
2 changes: 1 addition & 1 deletion avatar2/targets/gdb_target.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def init(self):
@watch('TargetCont')
@action_valid_decorator_factory(TargetStates.INITIALIZED, 'execution')
@synchronize_state(TargetStates.RUNNING)
def run(self):
def run(self, blocking=True):
return self.protocols.execution.run()

def cont(self, blocking=True):
Expand Down
1 change: 1 addition & 0 deletions tests/smoke/target_wait.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import avatar2
import os
import logging
import sys

from time import sleep
from nose.tools import *
Expand Down
13 changes: 8 additions & 5 deletions tests/test_gdbprotocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

from nose.tools import *

SLEEP_TIME = 1

port = 4444
p = None
Expand Down Expand Up @@ -60,7 +61,8 @@ def test_break_run_and_read_write_mem():
ret = g.cont()
assert_equal(ret, True)
# todo: enable waiting
time.sleep(.2)

time.sleep(SLEEP_TIME)

ret = g.read_memory(0x08048000, 4)
assert_equal(ret, 0x464c457f)
Expand All @@ -81,23 +83,24 @@ def test_continue_stopping_stepping():
ret = g.stop()
assert_equal(ret, True)

time.sleep(.2)
time.sleep(SLEEP_TIME)

ret = g.step()
assert_equal(ret, True)

time.sleep(.2)
time.sleep(SLEEP_TIME)

@with_setup(setup_helloworld, teardown_func)
def test_wacthpoint():
def test_watchpoint():
ret = g.set_watchpoint(0x080484c0, read=True,
write=False)
assert_equal(ret, True)

ret = g.cont()
assert_equal(ret, True)

time.sleep(.2)

time.sleep(SLEEP_TIME)

ret = g.read_memory(0x08048000, 4)
assert_equal(ret, 0x464c457f)
Expand Down

0 comments on commit 64d10c4

Please sign in to comment.