Skip to content

Commit

Permalink
Add tquic-integration.yml for multipath (#256)
Browse files Browse the repository at this point in the history
  • Loading branch information
iyangsj authored May 8, 2024
1 parent 7e89f53 commit fd1780a
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 11 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/tquic-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Integration

on:
push:
branches: [ "develop" ]
pull_request:
branches: [ "develop" ]
workflow_dispatch:

env:
CARGO_TERM_COLOR: always

jobs:
extra:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Build
run: cargo build --release --all
- name: Run integration tests for multipath
run: |
cd tools/tests/
bash ./tquic_tools_test.sh -b ../../target/release/ -t multipath_redundant,multipath_minrtt,multipath_roundrobin -f 1000M -p 5
8 changes: 5 additions & 3 deletions src/connection/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1161,7 +1161,7 @@ impl Connection {
self.multipath_scheduler = Some(build_multipath_scheduler(&self.multipath_conf));
self.paths.enable_multipath();
self.flags.insert(EnableMultipath);
trace!("{} enable multipath", &self.trace_id);
debug!("{} enable multipath", &self.trace_id);
}

// Prepare for sending NEW_CONNECTION_ID/NEW_TOKEN frames.
Expand Down Expand Up @@ -2528,12 +2528,14 @@ impl Connection {

// Processing the following subrange.
if r.start + (data_len as u64) < offset + length as u64 {
let tail_len =
(offset + length as u64 - r.start - data_len as u64) as usize;
let frame = Frame::Stream {
stream_id,
offset: r.start + data_len as u64,
length: length - data_len,
length: tail_len,
fin,
data: data.slice(data_len..),
data: data.slice(length - tail_len..),
};
space.buffered.push_front(frame, buffer_type);
}
Expand Down
32 changes: 24 additions & 8 deletions tools/tests/tquic_tools_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,18 @@ TEST_CASES="multipath_minrtt,multipath_roundrobin,multipath_redundant"
TEST_PID="$$"
TEST_FILE="10M"
PATH_NUM=4
LOG_LEVEL="debug"
EXIT_CODE=0

cleanup() {
set +e
pkill -P $TEST_PID
echo "exit with" $EXIT_CODE
exit $EXIT_CODE
}

# Ensure that all child processes have exited.
trap 'pkill -P $TEST_PID' EXIT
trap 'cleanup' EXIT

show_help() {
echo "Usage: $0 [options]"
Expand All @@ -38,10 +47,11 @@ show_help() {
echo " -t, Run the specified test cases."
echo " -f, File size for test cases, eg. 10M"
echo " -p, Path number for test cases, eg. 4"
echo " -g, Log level, eg. debug"
echo " -h, Display this help and exit."
}

while getopts ":b:w:t:f:p:lh" opt; do
while getopts ":b:w:t:f:p:g:lh" opt; do
case $opt in
b)
BIN_DIR="$OPTARG"
Expand All @@ -58,6 +68,9 @@ while getopts ":b:w:t:f:p:lh" opt; do
p)
PATH_NUM="$OPTARG"
;;
g)
LOG_LEVEL="$OPTARG"
;;
l)
echo $TEST_CASES
exit 0
Expand Down Expand Up @@ -117,33 +130,36 @@ test_multipath() {
# start tquic server
RUST_BACKTRACE=1 $BIN_DIR/tquic_server -l 127.0.8.8:8443 --enable-multipath --multipath-algor $algor \
--cert $cert_dir/cert.crt --key $cert_dir/cert.key --root $data_dir \
--active-cid-limit $CID_LIMIT --log-file $test_dir/server.log --log-level debug &
--active-cid-limit $CID_LIMIT --log-file $test_dir/server.log --log-level $LOG_LEVEL &
server_pid=$!
trap "kill $server_pid" RETURN

# start tquic client
mkdir -p $dump_dir
local_addresses=`seq -s, -f "127.0.0.%g" 1 $PATH_NUM`
RUST_BACKTRACE=1 $BIN_DIR/tquic_client -c 127.0.8.8:8443 --enable-multipath --multipath-algor $algor \
--local-addresses $local_addresses --active-cid-limit $CID_LIMIT \
--qlog-dir $qlog_dir --log-file $test_dir/client.log --log-level trace \
--qlog-dir $qlog_dir --log-file $test_dir/client.log --log-level $LOG_LEVEL \
--dump-dir $dump_dir \
https://example.org/$TEST_FILE

# check files
if ! cmp -s $dump_dir/$TEST_FILE $data_dir/$TEST_FILE; then
echo "Files not same $dump_dir/$TEST_FILE:$data_dir/$TEST_FILE"
exit 1
EXIT_CODE=100
exit $EXIT_CODE
fi

# check packets received
pnum=`grep "recv packet OneRTT" $test_dir/client.log | grep "local=.*" -o | sort | uniq -c | tee /dev/stderr | wc -l`
if [ $pnum != $PATH_NUM ]; then
echo "Not all path ($pnum/$PATH_NUM) received packets"
exit 1
EXIT_CODE=101
exit $EXIT_CODE
fi

echo "Test $algor OK"
# clean up
kill $server_pid
echo -e "Test $algor OK\n"
}

echo "$TEST_CASES" | sed 's/,/\n/g' | while read -r TEST_CASE; do
Expand Down

0 comments on commit fd1780a

Please sign in to comment.