Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.

Commit 1c2de52

Browse files
committed
baseline for protocol evaluation
1 parent 913df5a commit 1c2de52

File tree

12 files changed

+74
-9
lines changed

12 files changed

+74
-9
lines changed

.github/workflows/autotest.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Test PR
2+
3+
on:
4+
pull_request_target:
5+
workflow_call:
6+
7+
jobs:
8+
test-protocol-with-repo-variables:
9+
if: vars.use_custom_variables
10+
runs-on: ubuntu-latest
11+
steps:
12+
- run: |
13+
export PROTOCOL=${{vars.PROCOL}} && ./tests/setup_and_run.sh
14+
test-protocol-with-repo-variables:
15+
if: ! vars.use_custom_variables
16+
runs-on: ubuntu-latest
17+
steps:
18+
- run: |
19+
source env.sh && ./tests/setup_and_run.sh

env.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/sh
2+
3+
# Change the PROTOCOL environment variable to set the execution pipeline for the given project
4+
# Possible values are
5+
# 1. HTTP
6+
# 2. FTP
7+
# 3. SMTP
8+
# 4. IRC
9+
10+
PROTOCOL=0

run.sh

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
#!/bin/sh
2-
3-
# Change the PROTOCOL environment variable to set the execution pipeline for the given project
4-
# Possible values are
5-
# 1. HTTP
6-
# 2. FTP
7-
# 3. SMTP
8-
# 4. IRC
9-
101
PROTOCOL=0
112

123
# Replace the next shell command with the entrypoint of your solution

tests/ftp/install.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
docker run --rm -d --name ftpd_server -p 21:21 -p 30000-30009:30000-30009 stilliard/pure-ftpd bash /run.sh -c 30 -C 10 -l puredb:/etc/pure-ftpd/pureftpd.pdb -E -j -R -P localhost -p 30000:30059

tests/ftp/run.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
./run.sh --user test --body test

tests/http/install.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
docker run -d -p 80:80 tiangolo/uvicorn-gunicorn-fastapi

tests/http/run.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
./run.sh --user test --body test

tests/irc/install.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
docker run -d ircd/unrealircd:latest

tests/irc/run.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
./run.sh --user test --body test

tests/setup_and_run.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/bash
2+
3+
if [[ -z "${PROTOCOL}" ]]; then
4+
echo "PROTOCOL environment variable is not set"
5+
exit 1
6+
fi
7+
8+
if [[ ! "${PROTOCOL}" =~ ^[1-4]$ ]]; then
9+
echo "Invalid value for PROTOCOL environment variable: ${PROTOCOL}. Must be 1, 2, 3 or 4"
10+
exit 1
11+
fi
12+
13+
dir_names=("http" "ftp" "smtp" "irc")
14+
dir_index=$((PROTOCOL - 1))
15+
tests_dir="tests/${dir_names[$dir_index]}"
16+
setup_sh="${test_dir}/install.sh"
17+
test_sh="${test_dir}/run.sh"
18+
19+
echo "Executing install.sh script: ${setup_sh}"
20+
${setup_sh}
21+
22+
if [[ $? -ne 0 ]]; then
23+
echo "Test setup failed"
24+
exit 1
25+
fi
26+
27+
echo "Setup succeeded"
28+
29+
echo "Executing run.sh script: ${test_sh}"
30+
${test_sh}
31+
32+
if [[ $? -ne 0 ]]; then
33+
echo "Test execution failed"
34+
exit 1
35+
fi
36+
37+
echo "Tests execution completed"

tests/smtp/install.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
docker run --rm -d -p 5000:80 -p 2525:25 rnwood/smtp4dev

tests/smtp/run.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
./run.sh --user test --body test

0 commit comments

Comments
 (0)