dep-curl/tests/rtspserver.pl

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

134 lines
3.5 KiB
Perl
Raw Permalink Normal View History

2010-02-01 12:05:08 +00:00
#!/usr/bin/env perl
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
2010-02-01 12:05:08 +00:00
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
2020-11-04 14:02:01 +01:00
# are also available at https://curl.se/docs/copyright.html.
2010-02-01 12:05:08 +00:00
#
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
# copies of the Software, and permit persons to whom the Software is
# furnished to do so, under the terms of the COPYING file.
#
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
# KIND, either express or implied.
#
# SPDX-License-Identifier: curl
#
2010-02-01 12:05:08 +00:00
#***************************************************************************
use strict;
use warnings;
2010-02-01 12:05:08 +00:00
BEGIN {
push(@INC, $ENV{'srcdir'}) if(defined $ENV{'srcdir'});
push(@INC, ".");
2010-02-01 12:05:08 +00:00
}
use serverhelp qw(
server_pidfilename
server_logfilename
runtests: support multi-target cmake, drop workarounds from CI Support multi-target cmake builds via `CURL_DIRSUFFIX` env. For example: `export CURL_DIRSUFFIX=Debug/`. Multi-target generators place their output to `src/<subdir>/`, `lib/<subdir>/`, `tests/server/<subdir>`, `tests/libtest/<subdir>` and `tests/unit/<subdir>/` by default. Before this patch, `runtests.pl` couldn't run on such builds because it expected the binaries under the their `<subdir>`-less directories. This patch allows to set such subdir and make `runtests.pl` find the binaries. In CI we use multi-target builds with tests for MSVC. It also helps Xcode-generator builds, though in CI we don't have such job running tests. There may be better solutions to configure this, but passing a custom value to `runtests.pl` including its subprocesses is somewhat tricky. The reason the configuration value expects the slash at the end is because MSYS is automagically expanding the env to a (wrong) absolute path if the slash is in the front. Also: - drop the `-DCMAKE_RUNTIME_OUTPUT_DIRECTORY_*=` workaround from CI. - replace `resolve` references in tests with a new `%RESOLVE` variable. It didn't use a filename extension before. After this patch it uses `exe_ext('TOOL')`. I'm not sure if this is the correct choice vs. `exe_ext('SRV')`. - fix `-c` option format in manual. - fix some whitespace. Note, in CI we still tweak `CMAKE_RUNTIME_OUTPUT_DIRECTORY_*` in jobs which share steps between `./configure` and cmake. It's easier that way. Ref: #15000 Cherry-picked from #16394 Closes #16452
2025-02-24 15:27:35 +01:00
server_exe
);
2010-02-01 12:05:08 +00:00
my $verbose = 0; # set to 1 for debugging
my $port = 8990; # a default
2010-02-01 12:05:08 +00:00
my $ipvnum = 4; # default IP version of rtsp server
2017-03-26 17:02:22 +02:00
my $idnum = 1; # default rtsp server instance number
2010-02-01 12:05:08 +00:00
my $proto = 'rtsp'; # protocol the rtsp server speaks
my $pidfile; # rtsp server pid file
my $portfile;
2010-02-01 12:05:08 +00:00
my $logfile; # rtsp server log file
my $srcdir;
my $flags = "";
my $path = '.';
my $logdir = $path .'/log';
while(@ARGV) {
if($ARGV[0] eq '--pidfile') {
if($ARGV[1]) {
$pidfile = $ARGV[1];
shift @ARGV;
}
}
elsif($ARGV[0] eq '--portfile') {
if($ARGV[1]) {
$portfile = $ARGV[1];
shift @ARGV;
}
}
2010-02-01 12:05:08 +00:00
elsif($ARGV[0] eq '--logfile') {
if($ARGV[1]) {
$logfile = $ARGV[1];
shift @ARGV;
}
}
elsif($ARGV[0] eq '--logdir') {
if($ARGV[1]) {
$logdir = $ARGV[1];
shift @ARGV;
}
}
2010-02-01 12:05:08 +00:00
elsif($ARGV[0] eq '--srcdir') {
if($ARGV[1]) {
$srcdir = $ARGV[1];
shift @ARGV;
}
}
elsif($ARGV[0] eq '--ipv4') {
$ipvnum = 4;
}
elsif($ARGV[0] eq '--ipv6') {
$ipvnum = 6;
}
elsif($ARGV[0] eq '--port') {
if($ARGV[1] =~ /^(\d+)$/) {
$port = $1;
shift @ARGV;
}
}
elsif($ARGV[0] eq '--id') {
if($ARGV[1] =~ /^(\d+)$/) {
$idnum = $1 if($1 > 0);
shift @ARGV;
}
}
elsif($ARGV[0] eq '--verbose') {
$verbose = 1;
}
else {
print STDERR "\nWarning: rtspserver.pl unknown parameter: '$ARGV[0]'\n";
2010-02-01 12:05:08 +00:00
}
shift @ARGV;
}
#***************************************************************************
# Initialize command line option dependent variables
#
if(!$pidfile) {
$pidfile = server_pidfilename($path, $proto, $ipvnum, $idnum);
}
2010-02-01 12:05:08 +00:00
if(!$srcdir) {
$srcdir = $ENV{'srcdir'} || '.';
}
if(!$logfile) {
$logfile = server_logfilename($logdir, $proto, $ipvnum, $idnum);
}
$flags .= "--pidfile \"$pidfile\" ".
"--portfile \"$portfile\" ".
"--logfile \"$logfile\" ".
"--logdir \"$logdir\" ";
2010-02-01 12:05:08 +00:00
$flags .= "--ipv$ipvnum --port $port --srcdir \"$srcdir\"";
$| = 1;
runtests: support multi-target cmake, drop workarounds from CI Support multi-target cmake builds via `CURL_DIRSUFFIX` env. For example: `export CURL_DIRSUFFIX=Debug/`. Multi-target generators place their output to `src/<subdir>/`, `lib/<subdir>/`, `tests/server/<subdir>`, `tests/libtest/<subdir>` and `tests/unit/<subdir>/` by default. Before this patch, `runtests.pl` couldn't run on such builds because it expected the binaries under the their `<subdir>`-less directories. This patch allows to set such subdir and make `runtests.pl` find the binaries. In CI we use multi-target builds with tests for MSVC. It also helps Xcode-generator builds, though in CI we don't have such job running tests. There may be better solutions to configure this, but passing a custom value to `runtests.pl` including its subprocesses is somewhat tricky. The reason the configuration value expects the slash at the end is because MSYS is automagically expanding the env to a (wrong) absolute path if the slash is in the front. Also: - drop the `-DCMAKE_RUNTIME_OUTPUT_DIRECTORY_*=` workaround from CI. - replace `resolve` references in tests with a new `%RESOLVE` variable. It didn't use a filename extension before. After this patch it uses `exe_ext('TOOL')`. I'm not sure if this is the correct choice vs. `exe_ext('SRV')`. - fix `-c` option format in manual. - fix some whitespace. Note, in CI we still tweak `CMAKE_RUNTIME_OUTPUT_DIRECTORY_*` in jobs which share steps between `./configure` and cmake. It's easier that way. Ref: #15000 Cherry-picked from #16394 Closes #16452
2025-02-24 15:27:35 +01:00
exec("exec ".server_exe('rtspd')." $flags");