Skip to content

[IMPROVEMENT] Add tests for --stdin, --udp and --tcp - #2414

Open
Deepak-negi11 wants to merge 4 commits into
CCExtractor:masterfrom
Deepak-negi11:test/cli-network-options
Open

Deepak-negi11 wants to merge 4 commits into
CCExtractor:masterfrom
Deepak-negi11:test/cli-network-options

Conversation

@Deepak-negi11

@Deepak-negi11 Deepak-negi11 commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

In raising this pull request, I confirm the following (please check boxes):

Reason for this PR:

  • This PR adds new functionality.
  • This PR fixes a bug that I have personally experienced or that a real user has reported and for which a sample exists.
  • This PR is porting code from C to Rust.

Sanity check:

  • I have read and understood the contributors guide.
  • I have checked that another pull request for this purpose does not exist.
  • If the PR adds new functionality, I've added it to the changelog. If it's just a bug fix, I have NOT added it to the changelog.
  • I am NOT adding new C code unless it's to fix an existing, reproducible bug.

Repro instructions:

cd src/rust && cargo test --lib cli_tests

Example of what they catch: remove self.set_input_format_type(InFormat::Bin) from the --tcp handling in parser.rs. All 214 parser tests still pass; test_tcp_reaches_c fails.

I also checked that these options work end to end on macOS with Closed Caption EIA.ts from https://streams.videolan.org/streams/ts/:

Input Result
cat sample.ts | ccextractor --stdin 19 cues, identical to reading the file
sending the file over UDP to ccextractor --udp 127.0.0.1:7312 19 cues, identical
ccextractor sample.ts --sendto 127.0.0.1:7311 into ccextractor --tcp 7311 19 cues, identical except the last cue's end time (set when the connection closes)

Part of #2408. Depends on #2411.

Problem

--stdin, --udp and --tcp had no test that passes them on the command line.

What this adds

  • Tests that check the C settings, with new and old spellings:
  • --stdin sets input_source to stdin and no timeout (live_stream -1), as in v0.94.
  • --udp sets input_source to network and the port (both spellings); the addr:port and src@addr:port forms set the address and the source address.
    • --tcp sets input_source to TCP, the port, and the binary (RCWT) input format.
  • These options don't allow an input file, so the test helper now has a variant without one.
  • They're removed from UNTESTED_OPTIONS (10 → 7).

Testing

  • cargo test (445 passed), cargo fmt --check, cargo clippy -- -D warnings.

Copilot AI balanced review requested due to automatic review settings October 20, 2026 19:58

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Deepak-negi11
Deepak-negi11 force-pushed the test/cli-network-options branch from 5b46935 to ded8b3f Compare October 24, 2026 23:04
@ccextractor-bot

Copy link
Copy Markdown
Collaborator
CCExtractor CI platform finished running the test files on linux. 81/237 tests matched the approved output:
Report Name Tests Passed
Broken 0/13
CEA-708 1/14
DVB 0/7
DVD 0/3
DVR-MS 0/2
General 0/27
Hardsubx 1/1
Hauppage 0/3
MP4 0/3
NoCC 10/10
Options 69/86
Teletext 0/21
WTV 0/13
XDS 0/34

156 tests do not match the approved output. That is the pass/fail verdict. Whether this branch caused it is a separate question, answered below.


Compared with the tip of master — test 9744, commit 0bf2a94:

  • 27 pass there and fail here
  • 0 fail there and pass here
  • 3 fail on both, with different output
  • 126 fail on both, byte for byte the same

Pass there, fail here:

  • ccextractor --autoprogram --out=ttxt --latin1 --ucla --xds 725a49f871...
  • ccextractor --autoprogram --out=ttxt --xds --latin1 --ucla d037c7509e...
  • ccextractor --autoprogram --out=smptett --latin1 --ucla e274a73653...
  • ccextractor --autoprogram --out=ttxt --xds --latin1 --ucla e274a73653...
  • ccextractor --autoprogram --out=ttxt --xds --latin1 --ucla 85058ad37e...
  • ccextractor --autoprogram --out=ttxt --latin1 --ucla --xds b22260d065...
  • ccextractor --autoprogram --out=srt --latin1 --ucla b22260d065...
  • ccextractor --autoprogram --out=ttxt --latin1 --xds --ucla c813e713a0...
  • ccextractor --autoprogram --out=srt --latin1 --ucla c813e713a0...
  • ccextractor --autoprogram --out=ttxt --latin1 --ucla --xds 27fab4dbb6...
  • ccextractor --autoprogram --out=srt --latin1 --ucla 27fab4dbb6...
  • ccextractor --autoprogram --out=ttxt --latin1 --ucla --xds bbd5bb52fc...
  • ccextractor --autoprogram --out=srt --latin1 --ucla bbd5bb52fc...
  • ccextractor --autoprogram --out=ttxt --latin1 --ucla --xds b992e0cccb...
  • ccextractor --autoprogram --out=ttxt --latin1 --ucla --xds d0291cdcf6...
  • ccextractor --autoprogram --out=ttxt --latin1 --ucla 7d2730d38e...
  • ccextractor --autoprogram --out=srt --latin1 --ucla 7d2730d38e...
  • ccextractor --autoprogram --out=ttxt --latin1 --ucla --xds c8dc039a88...
  • ccextractor --autoprogram --out=srt --latin1 --ucla c8dc039a88...
  • ccextractor --autoprogram --out=ttxt --latin1 --ucla --xds 53339f3455...
  • ccextractor --autoprogram --out=srt --latin1 --ucla 53339f3455...
  • ccextractor --autoprogram --out=ttxt --latin1 --ucla --xds 83b03036a2...
  • ccextractor --autoprogram --out=srt --latin1 --ucla 83b03036a2...
  • ccextractor --autoprogram --out=ttxt --latin1 5ae2007a79...
  • ccextractor --autoprogram --out=ttxt --latin1 1e44efd810...
  • ccextractor --autoprogram --out=ttxt --latin1 add511677c...
  • ccextractor --service 1 --out=ttxt da904de35d...

Fail on both but produce different output — behaviour moved even though the verdict did not:


Compared with the commit this branch was cut from — test 9750, commit d7eb132:

  • 45 pass there and fail here
  • 0 fail there and pass here
  • 5 fail on both, with different output
  • 106 fail on both, byte for byte the same

Pass there, fail here:

Fail on both but produce different output — behaviour moved even though the verdict did not:


This branch changes the behaviour of 30 test(s) relative to the tip of master. Those are the ones worth looking at; anything else in the list fails the same way on both sides.

@ccextractor-bot

Copy link
Copy Markdown
Collaborator
CCExtractor CI platform finished running the test files on windows. 171/237 tests matched the approved output:
Report Name Tests Passed
Broken 9/13
CEA-708 2/14
DVB 0/7
DVD 3/3
DVR-MS 2/2
General 25/27
Hardsubx 1/1
Hauppage 3/3
MP4 3/3
NoCC 10/10
Options 69/86
Teletext 0/21
WTV 12/13
XDS 32/34

66 tests do not match the approved output. That is the pass/fail verdict. Whether this branch caused it is a separate question, answered below.


Compared with the tip of master — test 9693, commit af4b28d:

  • 0 pass there and fail here
  • 157 fail there and pass here
  • 42 fail on both, with different output
  • 24 fail on both, byte for byte the same

Fail on both but produce different output — behaviour moved even though the verdict did not:

Fail there, pass here:


Compared with the commit this branch was cut from: the same run as the tip of master (test 9693), so the comparison above already covers it.


This branch changes the behaviour of 42 test(s) relative to the tip of master. Those are the ones worth looking at; anything else in the list fails the same way on both sides.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants