From 3c0b1d2d0e7008dff3b425d335323ca2d5f48c8f Mon Sep 17 00:00:00 2001 From: Federico Ceratto Date: Sat, 20 May 2023 14:13:24 +0100 Subject: [PATCH 1/5] Reflow --- QA/common.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/QA/common.py b/QA/common.py index 656cb0027a..a374729842 100644 --- a/QA/common.py +++ b/QA/common.py @@ -9,12 +9,12 @@ def execute(args): - """ Execute a specified command """ + """Execute a specified command""" subprocess.run(args) def execute_jafar_and_miniooni(ooni_exe, outfile, experiment, tag, args): - """ Executes jafar and miniooni. Returns the test keys. """ + """Executes jafar and miniooni. Returns the test keys.""" tmpoutfile = "/tmp/{}".format(outfile) with contextlib.suppress(FileNotFoundError): os.remove(tmpoutfile) # just in case @@ -40,17 +40,17 @@ def execute_jafar_and_miniooni(ooni_exe, outfile, experiment, tag, args): def read_result(outfile): - """ Reads the result of an experiment """ + """Reads the result of an experiment""" return json.load(open(outfile, "rb")) def test_keys(result): - """ Returns just the test keys of a specific result """ + """Returns just the test keys of a specific result""" return result["test_keys"] def check_maybe_binary_value(value): - """ Make sure a maybe binary value is correct """ + """Make sure a maybe binary value is correct""" assert isinstance(value, str) or ( isinstance(value, dict) and value["format"] == "base64" @@ -59,8 +59,8 @@ def check_maybe_binary_value(value): def with_free_port(func): - """ This function executes |func| passing it a port number on localhost - which is bound but not listening for new connections """ + """This function executes |func| passing it a port number on localhost + which is bound but not listening for new connections""" # See with contextlib.closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as sock: sock.bind(("127.0.0.1", 0)) From 61c49fcf541a44a4d23839be5e942088310bd32a Mon Sep 17 00:00:00 2001 From: Federico Ceratto Date: Sat, 20 May 2023 13:56:15 +0100 Subject: [PATCH 2/5] Enable PR QA run --- .github/workflows/qa.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/qa.yml b/.github/workflows/qa.yml index 2594b72194..8a736c9c17 100644 --- a/.github/workflows/qa.yml +++ b/.github/workflows/qa.yml @@ -1,6 +1,7 @@ # Runs quality assurance checks name: "qa" on: + pull_request: push: branches: - "release/**" From bffdceb0605968764768dac774f06f345148355c Mon Sep 17 00:00:00 2001 From: Federico Ceratto Date: Sat, 20 May 2023 14:13:41 +0100 Subject: [PATCH 3/5] Disable ASLR --- QA/common.py | 2 ++ QA/rundocker.bash | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/QA/common.py b/QA/common.py index a374729842..52520a6650 100644 --- a/QA/common.py +++ b/QA/common.py @@ -20,6 +20,8 @@ def execute_jafar_and_miniooni(ooni_exe, outfile, experiment, tag, args): os.remove(tmpoutfile) # just in case execute( [ + "setarch", + "--addr-no-randomize", "./jafar", "-main-command", "./QA/minioonilike.py {} -n -o '{}' --home /tmp {}".format( diff --git a/QA/rundocker.bash b/QA/rundocker.bash index 77ec540b55..a70238b74e 100755 --- a/QA/rundocker.bash +++ b/QA/rundocker.bash @@ -8,7 +8,7 @@ GOVERSION=$(cat GOVERSION) cat > QA/Dockerfile << EOF FROM golang:$GOVERSION-alpine -RUN apk add gcc go git musl-dev iptables tmux bind-tools curl sudo python3 +RUN apk add gcc go git musl-dev iptables tmux bind-tools curl sudo python3 setarch EOF $DOCKER build -t jafar-qa ./QA/ From 5b00fa84e5d182bcea3fd61afc4254320ec27383 Mon Sep 17 00:00:00 2001 From: Federico Ceratto Date: Sat, 20 May 2023 14:21:31 +0100 Subject: [PATCH 4/5] Try util-linux --- QA/rundocker.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/QA/rundocker.bash b/QA/rundocker.bash index a70238b74e..8e881c8257 100755 --- a/QA/rundocker.bash +++ b/QA/rundocker.bash @@ -8,7 +8,7 @@ GOVERSION=$(cat GOVERSION) cat > QA/Dockerfile << EOF FROM golang:$GOVERSION-alpine -RUN apk add gcc go git musl-dev iptables tmux bind-tools curl sudo python3 setarch +RUN apk add gcc go git musl-dev iptables tmux bind-tools curl sudo python3 util-linux EOF $DOCKER build -t jafar-qa ./QA/ From d17191af258182911b5c2c997ed6112a5e637128 Mon Sep 17 00:00:00 2001 From: Federico Ceratto Date: Sat, 20 May 2023 14:24:52 +0100 Subject: [PATCH 5/5] Enable valgrind --- QA/common.py | 9 +++++++++ QA/rundocker.bash | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/QA/common.py b/QA/common.py index 52520a6650..64d3181d8c 100644 --- a/QA/common.py +++ b/QA/common.py @@ -20,8 +20,17 @@ def execute_jafar_and_miniooni(ooni_exe, outfile, experiment, tag, args): os.remove(tmpoutfile) # just in case execute( [ + # Disable ASLR "setarch", "--addr-no-randomize", + # Run cachegrind + "valgrind", + "--tool=cachegrind", + "--I1=32768,8,64", + "--D1=32768,8,64", + "--LL=8388608,16,64", + "--cachegrind-out-file=cachegrind.out", + # Run jafar "./jafar", "-main-command", "./QA/minioonilike.py {} -n -o '{}' --home /tmp {}".format( diff --git a/QA/rundocker.bash b/QA/rundocker.bash index 8e881c8257..45403950fa 100755 --- a/QA/rundocker.bash +++ b/QA/rundocker.bash @@ -8,7 +8,7 @@ GOVERSION=$(cat GOVERSION) cat > QA/Dockerfile << EOF FROM golang:$GOVERSION-alpine -RUN apk add gcc go git musl-dev iptables tmux bind-tools curl sudo python3 util-linux +RUN apk add gcc go git musl-dev iptables tmux bind-tools curl sudo python3 util-linux valgrind EOF $DOCKER build -t jafar-qa ./QA/