-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for constant interval greater than 1000ms
- Loading branch information
Showing
3 changed files
with
12 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/usr/bin/expect -f | ||
|
||
# Deadline was not incremented correctly for intervals greater than 1000ms | ||
|
||
spawn time -p ./udpreplay -i lo -c 1001 ../test/test.pcap | ||
wait | ||
expect { | ||
default { exit 1 } | ||
"real 3.0" { exit 0 } | ||
} |
43070a6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rigtorp I believe the test is not exactly correct and the fix is incomplete. Sending 3 packets with a constant interval of 1.001 second inbeetween should only take 2.002 seconds, not 3.003 seconds as one might naively think. This is because packet P1 goes out at 0.0s, packet P2 at 1.001s and packet P3 at 2.002s mark. Assuming logic works correctly. There is some bug in timing code, which either causes pause between P1 or pause after P3, neither is really justified IMHO. My fork does not have this issue, feel free to cherry-pick some commits to get this fixed.
43070a6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is on purpose, it was the simplest implementation such that when using repeating mode the constant interval is honored. Doesn't seem worth it to complicate the code for this. You would need to not increment deadline for the first packet for the first repeat.