1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-14 20:31:56 +00:00

UTest: Enable sanitizer for utest. (#3247)

1. Enable sanitizer for utest.
2. Allow auto detect jobs for make.
3. Show more information about build cache.
This commit is contained in:
Winlin 2022-11-18 22:02:24 +08:00 committed by winlin
parent 5bae930621
commit 88641b535c
9 changed files with 29 additions and 29 deletions

View file

@ -27,8 +27,8 @@ jobs:
run: |
echo "pwd: $(pwd), who: $(whoami)"
docker run --rm -v $(pwd):$(pwd) -w $(pwd)/trunk ossrs/srs:ubuntu20-cache \
bash -c "./configure --jobs=2 && chmod 777 -R objs"
cd trunk && ./configure --jobs=2 && make -j2
bash -c "./configure && chmod 777 -R objs"
cd trunk && ./configure && make
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2

View file

@ -134,7 +134,7 @@ jobs:
run: docker run --rm srs:test bash -c 'make utest && ./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'
run: docker run --rm srs:test bash -c 'make && (./objs/srs -c conf/regression-test.conf; ./etc/init.d/srs status) && cd 3rdparty/srs-bench && make && ./objs/srs_test -test.v'
coverage:
name: coverage

View file

@ -4,9 +4,8 @@ FROM ${ARCH}${IMAGE} AS build
ARG BUILDPLATFORM
ARG TARGETPLATFORM
ARG JOBS=2
ARG SRS_AUTO_PACKAGER
RUN echo "BUILDPLATFORM: $BUILDPLATFORM, TARGETPLATFORM: $TARGETPLATFORM, JOBS: $JOBS, PACKAGER: ${#SRS_AUTO_PACKAGER}"
RUN echo "BUILDPLATFORM: $BUILDPLATFORM, TARGETPLATFORM: $TARGETPLATFORM, PACKAGER: ${#SRS_AUTO_PACKAGER}"
# https://serverfault.com/questions/949991/how-to-install-tzdata-on-a-ubuntu-docker-image
ENV DEBIAN_FRONTEND noninteractive
@ -24,7 +23,7 @@ WORKDIR /srs/trunk
# Build and install SRS.
# Note that SRT is enabled by default, so we configure without --srt=on.
RUN ./configure --jobs=${JOBS} --gb28181=on --sanitizer-static=on && make -j${JOBS} && make install
RUN ./configure --gb28181=on --sanitizer-static=on && make && make install
# All config files for SRS.
RUN cp -R conf /usr/local/srs/conf && \

View file

@ -1,74 +1,74 @@
########################################################
FROM ossrs/srs:dev-cache AS centos7-baseline
COPY . /srs
RUN cd /srs/trunk && ./configure --jobs=2 --srt=off --gb28181=off && make -j2
RUN cd /srs/trunk && ./configure --srt=off --gb28181=off && make
FROM ossrs/srs:dev-cache AS centos7-no-webrtc
COPY . /srs
RUN cd /srs/trunk && ./configure --jobs=2 --srt=off --gb28181=off --rtc=off && make -j2
RUN cd /srs/trunk && ./configure --srt=off --gb28181=off --rtc=off && make
FROM ossrs/srs:dev-cache AS centos7-no-asm
COPY . /srs
RUN cd /srs/trunk && ./configure --jobs=2 --srt=off --gb28181=off --nasm=off --srtp-nasm=off && make -j2
RUN cd /srs/trunk && ./configure --srt=off --gb28181=off --nasm=off --srtp-nasm=off && make
FROM ossrs/srs:dev-cache AS centos7-all
COPY . /srs
RUN cd /srs/trunk && ./configure --jobs=2 --srt=on --gb28181=on && make -j2
RUN cd /srs/trunk && ./configure --srt=on --gb28181=on && make
FROM ossrs/srs:dev-cache AS centos7-ansi-no-ffmpeg
COPY . /srs
RUN cd /srs/trunk && ./configure --jobs=2 --srt=off --gb28181=off --cxx11=off --cxx14=off --ffmpeg-fit=off && make -j2
RUN cd /srs/trunk && ./configure --srt=off --gb28181=off --cxx11=off --cxx14=off --ffmpeg-fit=off && make
########################################################
FROM ossrs/srs:dev6-cache AS centos6-baseline
COPY . /srs
RUN cd /srs/trunk && ./configure --jobs=2 --srt=off --gb28181=off --cxx11=off --cxx14=off --sanitizer=off && make -j2
RUN cd /srs/trunk && ./configure --srt=off --gb28181=off --cxx11=off --cxx14=off --sanitizer=off && make
FROM ossrs/srs:dev6-cache AS centos6-all
COPY . /srs
RUN cd /srs/trunk && ./configure --jobs=2 --srt=on --gb28181=on --cxx11=off --cxx14=off --sanitizer=off && make -j2
RUN cd /srs/trunk && ./configure --srt=on --gb28181=on --cxx11=off --cxx14=off --sanitizer=off && make
########################################################
FROM ossrs/srs:ubuntu16-cache AS ubuntu16-baseline
COPY . /srs
RUN cd /srs/trunk && ./configure --jobs=2 --srt=off --gb28181=off && make -j2
RUN cd /srs/trunk && ./configure --srt=off --gb28181=off && make
FROM ossrs/srs:ubuntu16-cache AS ubuntu16-all
COPY . /srs
RUN cd /srs/trunk && ./configure --jobs=2 --srt=on --gb28181=on && make -j2
RUN cd /srs/trunk && ./configure --srt=on --gb28181=on && make
########################################################
FROM ossrs/srs:ubuntu18-cache AS ubuntu18-baseline
COPY . /srs
RUN cd /srs/trunk && ./configure --jobs=2 --srt=off --gb28181=off && make -j2
RUN cd /srs/trunk && ./configure --srt=off --gb28181=off && make
FROM ossrs/srs:ubuntu18-cache AS ubuntu18-all
COPY . /srs
RUN cd /srs/trunk && ./configure --jobs=2 --srt=on --gb28181=on && make -j2
RUN cd /srs/trunk && ./configure --srt=on --gb28181=on && make
########################################################
FROM ossrs/srs:ubuntu20-cache AS ubuntu20-baseline
COPY . /srs
RUN cd /srs/trunk && ./configure --jobs=2 --srt=off --gb28181=off && make -j2
RUN cd /srs/trunk && ./configure --srt=off --gb28181=off && make
FROM ossrs/srs:ubuntu20-cache AS ubuntu20-all
COPY . /srs
RUN cd /srs/trunk && ./configure --jobs=2 --srt=on --gb28181=on && make -j2
RUN cd /srs/trunk && ./configure --srt=on --gb28181=on && make
########################################################
FROM ossrs/srs:ubuntu16-cross-arm AS ubuntu16-cross-armv7
COPY . /srs
RUN cd /srs/trunk && ./configure --jobs=2 --cross-build --cross-prefix=arm-linux-gnueabihf- && make -j2
RUN cd /srs/trunk && ./configure --cross-build --cross-prefix=arm-linux-gnueabihf- && make
FROM ossrs/srs:ubuntu16-cross-aarch64 AS ubuntu16-cross-aarch64
COPY . /srs
RUN cd /srs/trunk && ./configure --jobs=2 --cross-build --cross-prefix=aarch64-linux-gnu- && make -j2
RUN cd /srs/trunk && ./configure --cross-build --cross-prefix=aarch64-linux-gnu- && make
########################################################
FROM ossrs/srs:ubuntu20-cross-arm AS ubuntu20-cross-armv7
COPY . /srs
RUN cd /srs/trunk && ./configure --jobs=2 --cross-build --cross-prefix=arm-linux-gnueabihf- && make -j2
RUN cd /srs/trunk && ./configure --cross-build --cross-prefix=arm-linux-gnueabihf- && make
FROM ossrs/srs:ubuntu20-cross-aarch64 AS ubuntu20-cross-aarch64
COPY . /srs
RUN cd /srs/trunk && ./configure --jobs=2 --cross-build --cross-prefix=aarch64-linux-gnu- && make -j2
RUN cd /srs/trunk && ./configure --cross-build --cross-prefix=aarch64-linux-gnu- && make

View file

@ -8,5 +8,5 @@ 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 --utest=on --gcov=on --sanitizer=off --jobs=2
RUN scl enable devtoolset-7 -- make -j2 utest
RUN scl enable devtoolset-7 -- ./configure --srt=on --gb28181=on --utest=on --gcov=on --sanitizer=off
RUN scl enable devtoolset-7 -- make utest

View file

@ -10,5 +10,5 @@ RUN yum install -y zip
# Build and install SRS.
ADD srs-server-${version}.tar.gz /srs
WORKDIR /srs/srs-server-${version}/trunk
RUN ./scripts/package.sh --x86-x64 --jobs=2 --tag=${version}
RUN ./scripts/package.sh --x86-x64 --tag=${version}

View file

@ -6,8 +6,8 @@ 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 --utest=on --sanitizer=off --jobs=2
RUN scl enable devtoolset-7 -- make -j2 utest
RUN scl enable devtoolset-7 -- ./configure --srt=on --gb28181=on --utest=on
RUN scl enable devtoolset-7 -- make utest
# Build benchmark tool.
RUN cd 3rdparty/srs-bench && make

View file

@ -326,6 +326,7 @@ if [[ -d /usr/local/srs-cache/srs/trunk/objs && $(pwd) != "/usr/local/srs-cache/
echo "Build from cache, source=$SOURCE_DIR, target=$TARGET_DIR" &&
rm -rf $TARGET_DIR && mkdir -p ${SRS_OBJS} && cp -R $SOURCE_DIR $TARGET_DIR &&
du -sh /usr/local/srs-cache/srs/trunk/objs/Platform-* &&
du -sh /usr/local/srs-cache/srs/trunk/objs/Platform-*/* &&
du -sh objs/Platform-* &&
ls -lh objs
fi

View file

@ -2333,7 +2333,7 @@ srs_error_t SrsRecoverablePsContext::decode_rtp(SrsBuffer* stream, int reserved,
SrsRtpPacket rtp;
int pos = stream->pos();
if ((err = rtp.decode(stream)) != srs_success) {
return enter_recover_mode(stream, handler, pos, err = srs_error_new(ERROR_GB_PS_HEADER, "decode rtp"));
return enter_recover_mode(stream, handler, pos, srs_error_wrap(err, "decode rtp"));
}
SrsRtpRawPayload* rtp_raw = dynamic_cast<SrsRtpRawPayload*>(rtp.payload());