mirror of
https://github.com/ossrs/srs.git
synced 2025-02-15 04:42:04 +00:00
GB28181: Enable regression test for gb28181. v5.0.122
1. Build regression test tool for gb28181.
2. Run regression test for gb28181.
3. Format go code and eliminate logs.
4. Change base docker to ubuntu20.
PICK 7750bdae10
This commit is contained in:
parent
bc381a0242
commit
3f7c4a7ff4
32 changed files with 3882 additions and 9727 deletions
17
.github/workflows/test.yml
vendored
17
.github/workflows/test.yml
vendored
|
@ -171,16 +171,15 @@ jobs:
|
|||
uses: actions/checkout@v3
|
||||
# Tests
|
||||
- name: Build test image
|
||||
run: docker build --tag srs:test -f trunk/Dockerfile.test .
|
||||
run: docker build --tag srs:test --build-arg MAKEARGS='-j2' -f trunk/Dockerfile.test .
|
||||
# For utest
|
||||
- name: Run SRS utest
|
||||
run: docker run --rm srs:test bash -c 'make utest && ./objs/srs_utest'
|
||||
run: docker run --rm srs:test ./objs/srs_utest
|
||||
# For regression-test
|
||||
- name: Run SRS regression-test
|
||||
run: |
|
||||
docker run --rm srs:test bash -c 'make && \
|
||||
./objs/srs -c conf/regression-test.conf && \
|
||||
cd 3rdparty/srs-bench && make && ./objs/srs_test -test.v'
|
||||
docker run --rm srs:test bash -c './objs/srs -c conf/regression-test.conf && \
|
||||
cd 3rdparty/srs-bench && ./objs/srs_test -test.v && ./objs/srs_gb28181_test -test.v'
|
||||
runs-on: ubuntu-20.04
|
||||
|
||||
coverage:
|
||||
|
@ -192,7 +191,7 @@ jobs:
|
|||
uses: actions/checkout@v3
|
||||
# Tests
|
||||
- name: Build coverage image
|
||||
run: docker build --tag srs:cov -f trunk/Dockerfile.cov .
|
||||
run: docker build --tag srs:cov --build-arg MAKEARGS='-j2' -f trunk/Dockerfile.cov .
|
||||
# For coverage
|
||||
- name: Run SRS covergae
|
||||
if: ${{ startsWith(github.ref, 'refs/heads/') || startsWith(github.ref, 'refs/pull/') }}
|
||||
|
@ -210,9 +209,9 @@ jobs:
|
|||
#
|
||||
echo "For github.ref=${{ github.ref }}, github.sha=${{ github.sha }}"
|
||||
echo "SRS_BRANCH=$SRS_BRANCH, SRS_PR=$SRS_PR, SRS_SHA=$SRS_SHA, SRS_PROJECT=$SRS_PROJECT"
|
||||
docker run --rm --env CODECOV_TOKEN=$CODECOV_TOKEN \
|
||||
--env SRS_BRANCH=$SRS_BRANCH --env SRS_PR=$SRS_PR --env SRS_SHA=$SRS_SHA --env SRS_PROJECT=$SRS_PROJECT \
|
||||
srs:cov bash -c 'make utest && ./objs/srs_utest && bash auto/codecov.sh'
|
||||
docker run --rm --env CODECOV_TOKEN=$CODECOV_TOKEN --env SRS_BRANCH=$SRS_BRANCH \
|
||||
--env SRS_PR=$SRS_PR --env SRS_SHA=$SRS_SHA --env SRS_PROJECT=$SRS_PROJECT \
|
||||
srs:cov bash -c './objs/srs_utest && bash auto/codecov.sh'
|
||||
#
|
||||
runs-on: ubuntu-20.04
|
||||
|
||||
|
|
1
trunk/3rdparty/srs-bench/.gitignore
vendored
1
trunk/3rdparty/srs-bench/.gitignore
vendored
|
@ -7,3 +7,4 @@ objs
|
|||
|
||||
.format.txt
|
||||
.DS_Store
|
||||
*.log
|
10
trunk/3rdparty/srs-bench/Makefile
vendored
10
trunk/3rdparty/srs-bench/Makefile
vendored
|
@ -3,7 +3,7 @@
|
|||
default: bench test
|
||||
|
||||
clean:
|
||||
rm -f ./objs/srs_bench ./objs/srs_test
|
||||
rm -f ./objs/srs_bench ./objs/srs_test ./objs/srs_gb28181_test
|
||||
|
||||
.format.txt: *.go srs/*.go vnet/*.go janus/*.go gb28181/*.go
|
||||
gofmt -w .
|
||||
|
@ -14,12 +14,16 @@ bench: ./objs/srs_bench
|
|||
./objs/srs_bench: .format.txt *.go srs/*.go vnet/*.go janus/*.go gb28181/*.go Makefile
|
||||
go build -mod=vendor -o objs/srs_bench .
|
||||
|
||||
test: ./objs/srs_test
|
||||
test: ./objs/srs_test ./objs/srs_gb28181_test
|
||||
|
||||
./objs/srs_test: .format.txt *.go srs/*.go vnet/*.go Makefile
|
||||
go test ./srs -mod=vendor -c -o ./objs/srs_test
|
||||
|
||||
./objs/srs_gb28181_test: .format.txt *.go gb28181/*.go Makefile
|
||||
go test ./gb28181 -mod=vendor -c -o ./objs/srs_gb28181_test
|
||||
|
||||
help:
|
||||
@echo "Usage: make [bench|test]"
|
||||
@echo " bench Make the bench to ./objs/srs_bench"
|
||||
@echo " test Make the test tool to ./objs/srs_test"
|
||||
@echo " test Make the test tool to ./objs/srs_test and ./objs/srs_gb28181_test"
|
||||
|
||||
|
|
26
trunk/3rdparty/srs-bench/README.md
vendored
26
trunk/3rdparty/srs-bench/README.md
vendored
|
@ -7,10 +7,20 @@ WebRTC benchmark on [pion/webrtc](https://github.com/pion/webrtc) for [SRS](http
|
|||
编译和使用:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/ossrs/srs-bench.git && git checkout feature/rtc &&
|
||||
make && ./objs/srs_bench -h
|
||||
git clone -b feature/rtc https://github.com/ossrs/srs-bench.git &&
|
||||
cd srs-bench && make && ./objs/srs_bench -h
|
||||
```
|
||||
|
||||
编译和启动SRS:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/ossrs/srs.git &&
|
||||
cd srs/trunk && ./configure && make &&
|
||||
./objs/srs -c conf/console.conf
|
||||
```
|
||||
|
||||
请按下面的操作启动测试。
|
||||
|
||||
## Player for Live
|
||||
|
||||
直播播放压测,一个流,很多个播放。
|
||||
|
@ -102,11 +112,7 @@ ffmpeg -re -i doc/source.200kbps.768x320.flv -c copy -f flv -y rtmp://localhost/
|
|||
回归测试需要先启动[SRS](https://github.com/ossrs/srs/issues/307),支持WebRTC推拉流:
|
||||
|
||||
```bash
|
||||
if [[ ! -z $(ifconfig en0 inet| grep 'inet '|awk '{print $2}') ]]; then
|
||||
docker run -p 1935:1935 -p 8080:8080 -p 1985:1985 -p 8000:8000/udp \
|
||||
--rm --env CANDIDATE=$(ifconfig en0 inet| grep 'inet '|awk '{print $2}')\
|
||||
registry.cn-hangzhou.aliyuncs.com/ossrs/srs:4 objs/srs -c conf/rtc.conf
|
||||
fi
|
||||
./objs/srs -c conf/rtc.conf
|
||||
```
|
||||
|
||||
然后运行回归测试用例,如果只跑一次,可以直接运行:
|
||||
|
@ -235,6 +241,12 @@ make && ./objs/srs_bench -sfu gb28181 --help
|
|||
go test ./gb28181 -mod=vendor -v -count=1
|
||||
```
|
||||
|
||||
也可以用make编译出重复使用的二进制:
|
||||
|
||||
```bash
|
||||
make && ./objs/srs_gb28181_test -test.v
|
||||
```
|
||||
|
||||
支持的参数如下:
|
||||
|
||||
* `-srs-sip`,SIP服务器地址。默认值:`tcp://127.0.0.1:5060`
|
||||
|
|
3112
trunk/3rdparty/srs-bench/avatar.log
vendored
3112
trunk/3rdparty/srs-bench/avatar.log
vendored
File diff suppressed because it is too large
Load diff
2773
trunk/3rdparty/srs-bench/bbb.log
vendored
2773
trunk/3rdparty/srs-bench/bbb.log
vendored
File diff suppressed because it is too large
Load diff
2
trunk/3rdparty/srs-bench/gb28181/gb_test.go
vendored
2
trunk/3rdparty/srs-bench/gb28181/gb_test.go
vendored
|
@ -24,8 +24,8 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
"github.com/ghettovoice/gosip/sip"
|
||||
"github.com/ossrs/go-oryx-lib/logger"
|
||||
"github.com/ossrs/go-oryx-lib/errors"
|
||||
"github.com/ossrs/go-oryx-lib/logger"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
|
4
trunk/3rdparty/srs-bench/vendor/github.com/ghettovoice/gosip/sip/parser/error.go
generated
vendored
4
trunk/3rdparty/srs-bench/vendor/github.com/ghettovoice/gosip/sip/parser/error.go
generated
vendored
|
@ -11,7 +11,9 @@ type InvalidStartLineError string
|
|||
func (err InvalidStartLineError) Syntax() bool { return true }
|
||||
func (err InvalidStartLineError) Malformed() bool { return false }
|
||||
func (err InvalidStartLineError) Broken() bool { return true }
|
||||
func (err InvalidStartLineError) Error() string { return "parser.InvalidStartLineError: " + string(err) }
|
||||
func (err InvalidStartLineError) Error() string {
|
||||
return "parser.InvalidStartLineError: " + string(err)
|
||||
}
|
||||
|
||||
type InvalidMessageFormat string
|
||||
|
||||
|
|
1
trunk/3rdparty/srs-bench/vendor/github.com/sirupsen/logrus/terminal_check_bsd.go
generated
vendored
1
trunk/3rdparty/srs-bench/vendor/github.com/sirupsen/logrus/terminal_check_bsd.go
generated
vendored
|
@ -10,4 +10,3 @@ func isTerminal(fd int) bool {
|
|||
_, err := unix.IoctlGetTermios(fd, ioctlReadTermios)
|
||||
return err == nil
|
||||
}
|
||||
|
||||
|
|
1
trunk/3rdparty/srs-bench/vendor/github.com/sirupsen/logrus/terminal_check_unix.go
generated
vendored
1
trunk/3rdparty/srs-bench/vendor/github.com/sirupsen/logrus/terminal_check_unix.go
generated
vendored
|
@ -10,4 +10,3 @@ func isTerminal(fd int) bool {
|
|||
_, err := unix.IoctlGetTermios(fd, ioctlReadTermios)
|
||||
return err == nil
|
||||
}
|
||||
|
||||
|
|
|
@ -11,8 +11,8 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/mgutz/ansi"
|
||||
"github.com/sirupsen/logrus"
|
||||
"golang.org/x/crypto/ssh/terminal"
|
||||
)
|
||||
|
||||
|
|
|
@ -1,12 +1,21 @@
|
|||
FROM ossrs/srs:dev-gcc7-cache
|
||||
FROM ossrs/srs:ubuntu20-cache
|
||||
|
||||
# Install depends tools.
|
||||
RUN yum install -y gcc make gcc-c++ patch unzip perl git
|
||||
ARG MAKEARGS
|
||||
RUN echo "MAKEARGS: ${MAKEARGS}"
|
||||
|
||||
# https://serverfault.com/questions/949991/how-to-install-tzdata-on-a-ubuntu-docker-image
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
|
||||
# For go to build and run utest.
|
||||
ENV PATH $PATH:/usr/local/go/bin
|
||||
|
||||
RUN apt update -y && apt install -y gcc make g++ patch unzip perl git libasan5
|
||||
|
||||
# Build and install SRS.
|
||||
COPY . /srs
|
||||
WORKDIR /srs/trunk
|
||||
|
||||
# Note that we must enable the gcc7 or link failed.
|
||||
RUN scl enable devtoolset-7 -- ./configure --srt=on --gb28181=on --apm=on --h265=on --utest=on --gcov=on --sanitizer=off
|
||||
RUN scl enable devtoolset-7 -- make utest
|
||||
RUN ./configure --srt=on --gb28181=on --apm=on --h265=on --utest=on --gcov=on --sanitizer=off
|
||||
RUN make utest ${MAKEARGS}
|
||||
|
||||
|
|
|
@ -1,16 +1,24 @@
|
|||
FROM ossrs/srs:dev-gcc7-cache
|
||||
RUN yum install -y gcc make gcc-c++ patch unzip perl git
|
||||
FROM ossrs/srs:ubuntu20-cache
|
||||
|
||||
ARG MAKEARGS
|
||||
RUN echo "MAKEARGS: ${MAKEARGS}"
|
||||
|
||||
# https://serverfault.com/questions/949991/how-to-install-tzdata-on-a-ubuntu-docker-image
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
|
||||
# For go to build and run utest.
|
||||
ENV PATH $PATH:/usr/local/go/bin
|
||||
|
||||
RUN apt update -y && apt install -y gcc make g++ patch unzip perl git libasan5
|
||||
|
||||
# Build and install SRS.
|
||||
COPY . /srs
|
||||
WORKDIR /srs/trunk
|
||||
|
||||
# Note that we must enable the gcc7 or link failed.
|
||||
RUN scl enable devtoolset-7 -- ./configure --srt=on --gb28181=on --apm=on --h265=on --utest=on
|
||||
RUN scl enable devtoolset-7 -- make utest
|
||||
RUN ./configure --srt=on --gb28181=on --srt=on --gb28181=on --apm=on --h265=on --utest=on
|
||||
RUN make utest ${MAKEARGS}
|
||||
|
||||
# Build benchmark tool.
|
||||
RUN cd 3rdparty/srs-bench && make
|
||||
RUN cd 3rdparty/srs-bench && make ${MAKEARGS}
|
||||
|
||||
# Run utest
|
||||
RUN ./objs/srs_utest
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
listen 1935;
|
||||
max_connections 1000;
|
||||
|
||||
# For clion, use console as output.
|
||||
daemon off;
|
||||
srs_log_tank console;
|
||||
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
|
||||
listen 1935;
|
||||
max_connections 1000;
|
||||
daemon on; disable_daemon_for_docker off; srs_log_tank file;
|
||||
|
||||
# Force to daemon and write logs to file.
|
||||
daemon on;
|
||||
disable_daemon_for_docker off;
|
||||
srs_log_tank file;
|
||||
|
||||
stream_caster {
|
||||
enabled on;
|
||||
|
|
|
@ -24,6 +24,7 @@ The changelog for SRS.
|
|||
|
||||
## SRS 5.0 Changelog
|
||||
|
||||
* v5.0, 2022-12-31, GB28181: Enable regression test for gb28181. v5.0.122
|
||||
* v5.0, 2022-12-31, Refine configure to guess OS automatically. v5.0.121
|
||||
* v5.0, 2022-12-31, Refine default config file for SRS. v5.0.120
|
||||
* v5.0, 2022-12-26, For [#939](https://github.com/ossrs/srs/issues/939): FLV: Fix bug for header flag gussing. v5.0.119
|
||||
|
|
|
@ -9,6 +9,6 @@
|
|||
|
||||
#define VERSION_MAJOR 5
|
||||
#define VERSION_MINOR 0
|
||||
#define VERSION_REVISION 121
|
||||
#define VERSION_REVISION 122
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue