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.
pull/3349/head
winlin 2 years ago
parent 4b09a7d686
commit 7750bdae10

@ -171,16 +171,15 @@ jobs:
uses: actions/checkout@v3 uses: actions/checkout@v3
# Tests # Tests
- name: Build test image - 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 # For utest
- name: Run SRS 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 # For regression-test
- name: Run SRS regression-test - name: Run SRS regression-test
run: | run: |
docker run --rm srs:test bash -c 'make && \ docker run --rm srs:test bash -c './objs/srs -c conf/regression-test.conf && \
./objs/srs -c conf/regression-test.conf && \ cd 3rdparty/srs-bench && ./objs/srs_test -test.v && ./objs/srs_gb28181_test -test.v'
cd 3rdparty/srs-bench && make && ./objs/srs_test -test.v'
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
coverage: coverage:
@ -192,7 +191,7 @@ jobs:
uses: actions/checkout@v3 uses: actions/checkout@v3
# Tests # Tests
- name: Build coverage image - 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 # For coverage
- name: Run SRS covergae - name: Run SRS covergae
if: ${{ startsWith(github.ref, 'refs/heads/') || startsWith(github.ref, 'refs/pull/') }} 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 "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" 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 \ docker run --rm --env CODECOV_TOKEN=$CODECOV_TOKEN --env SRS_BRANCH=$SRS_BRANCH \
--env SRS_BRANCH=$SRS_BRANCH --env SRS_PR=$SRS_PR --env SRS_SHA=$SRS_SHA --env SRS_PROJECT=$SRS_PROJECT \ --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' srs:cov bash -c './objs/srs_utest && bash auto/codecov.sh'
# #
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04

@ -7,3 +7,4 @@ objs
.format.txt .format.txt
.DS_Store .DS_Store
*.log

@ -3,7 +3,7 @@
default: bench test default: bench test
clean: 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 .format.txt: *.go srs/*.go vnet/*.go janus/*.go gb28181/*.go
gofmt -w . 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 ./objs/srs_bench: .format.txt *.go srs/*.go vnet/*.go janus/*.go gb28181/*.go Makefile
go build -mod=vendor -o objs/srs_bench . 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 ./objs/srs_test: .format.txt *.go srs/*.go vnet/*.go Makefile
go test ./srs -mod=vendor -c -o ./objs/srs_test 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: help:
@echo "Usage: make [bench|test]" @echo "Usage: make [bench|test]"
@echo " bench Make the bench to ./objs/srs_bench" @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"

@ -7,10 +7,20 @@ WebRTC benchmark on [pion/webrtc](https://github.com/pion/webrtc) for [SRS](http
编译和使用: 编译和使用:
```bash ```bash
git clone https://github.com/ossrs/srs-bench.git && git checkout feature/rtc && git clone -b feature/rtc https://github.com/ossrs/srs-bench.git &&
make && ./objs/srs_bench -h 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 ## 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推拉流 回归测试需要先启动[SRS](https://github.com/ossrs/srs/issues/307)支持WebRTC推拉流
```bash ```bash
if [[ ! -z $(ifconfig en0 inet| grep 'inet '|awk '{print $2}') ]]; then ./objs/srs -c conf/rtc.conf
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
``` ```
然后运行回归测试用例,如果只跑一次,可以直接运行: 然后运行回归测试用例,如果只跑一次,可以直接运行:
@ -235,6 +241,12 @@ make && ./objs/srs_bench -sfu gb28181 --help
go test ./gb28181 -mod=vendor -v -count=1 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` * `-srs-sip`SIP服务器地址。默认值`tcp://127.0.0.1:5060`

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -24,8 +24,8 @@ import (
"context" "context"
"fmt" "fmt"
"github.com/ghettovoice/gosip/sip" "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/errors"
"github.com/ossrs/go-oryx-lib/logger"
"testing" "testing"
"time" "time"
) )

@ -11,7 +11,9 @@ type InvalidStartLineError string
func (err InvalidStartLineError) Syntax() bool { return true } func (err InvalidStartLineError) Syntax() bool { return true }
func (err InvalidStartLineError) Malformed() bool { return false } func (err InvalidStartLineError) Malformed() bool { return false }
func (err InvalidStartLineError) Broken() bool { return true } 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 type InvalidMessageFormat string

@ -10,4 +10,3 @@ func isTerminal(fd int) bool {
_, err := unix.IoctlGetTermios(fd, ioctlReadTermios) _, err := unix.IoctlGetTermios(fd, ioctlReadTermios)
return err == nil return err == nil
} }

@ -10,4 +10,3 @@ func isTerminal(fd int) bool {
_, err := unix.IoctlGetTermios(fd, ioctlReadTermios) _, err := unix.IoctlGetTermios(fd, ioctlReadTermios)
return err == nil return err == nil
} }

@ -11,8 +11,8 @@ import (
"sync" "sync"
"time" "time"
"github.com/sirupsen/logrus"
"github.com/mgutz/ansi" "github.com/mgutz/ansi"
"github.com/sirupsen/logrus"
"golang.org/x/crypto/ssh/terminal" "golang.org/x/crypto/ssh/terminal"
) )

@ -1,12 +1,21 @@
FROM ossrs/srs:dev-gcc7-cache FROM ossrs/srs:ubuntu20-cache
# Install depends tools. ARG MAKEARGS
RUN yum install -y gcc make gcc-c++ patch unzip perl git 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. # Build and install SRS.
COPY . /srs COPY . /srs
WORKDIR /srs/trunk WORKDIR /srs/trunk
# Note that we must enable the gcc7 or link failed. # Note that we must enable the gcc7 or link failed.
RUN scl enable devtoolset-7 -- ./configure --srt=on --gb28181=on --utest=on --apm=on --gcov=on --sanitizer=off RUN ./configure --srt=on --gb28181=on --utest=on --apm=on --gcov=on --sanitizer=on
RUN scl enable devtoolset-7 -- make utest RUN make utest ${MAKEARGS}

@ -1,16 +1,24 @@
FROM ossrs/srs:dev-gcc7-cache FROM ossrs/srs:ubuntu20-cache
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. # Build and install SRS.
COPY . /srs COPY . /srs
WORKDIR /srs/trunk WORKDIR /srs/trunk
# Note that we must enable the gcc7 or link failed. # Note that we must enable the gcc7 or link failed.
RUN scl enable devtoolset-7 -- ./configure --srt=on --gb28181=on --apm=on --utest=on RUN ./configure --srt=on --gb28181=on --apm=on --utest=on
RUN scl enable devtoolset-7 -- make utest RUN make utest ${MAKEARGS}
# Build benchmark tool. # 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; listen 1935;
max_connections 1000; max_connections 1000;
# For clion, use console as output.
daemon off; daemon off;
srs_log_tank console; srs_log_tank console;

@ -1,7 +1,11 @@
listen 1935; listen 1935;
max_connections 1000; 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 { stream_caster {
enabled on; enabled on;

@ -8,6 +8,7 @@ The changelog for SRS.
## SRS 5.0 Changelog ## 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 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-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 * 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_MAJOR 5
#define VERSION_MINOR 0 #define VERSION_MINOR 0
#define VERSION_REVISION 121 #define VERSION_REVISION 122
#endif #endif

Loading…
Cancel
Save