Skip to content

Commit

Permalink
TESTS: print log when test error
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaozhihong committed Nov 6, 2023
1 parent 1143e3c commit 8973b32
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ jobs:
- name: Run SRS regression-test
run: |
docker run --rm srs:test bash -c './objs/srs -c conf/regression-test.conf && \
cd 3rdparty/srs-bench && (./objs/srs_test -test.v || (cat ../../objs/srs.log && exit -1)) && ./objs/srs_gb28181_test -test.v'
cd 3rdparty/srs-bench && (./objs/srs_test -test.v -srs-log || (cat ../../objs/srs.log && exit -1)) && ./objs/srs_gb28181_test -test.v'
runs-on: ubuntu-20.04

coverage:
Expand Down
23 changes: 12 additions & 11 deletions trunk/3rdparty/srs-bench/srs/rtmp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ import (
"bytes"
"context"
"fmt"
"github.com/pkg/errors"
"math/rand"
"os"
"sync"
"testing"
"time"

"github.com/pkg/errors"

"github.com/ossrs/go-oryx-lib/avc"
"github.com/ossrs/go-oryx-lib/flv"
"github.com/ossrs/go-oryx-lib/logger"
Expand Down Expand Up @@ -472,7 +473,7 @@ func TestRtmpPublish_HttpFlvPlay(t *testing.T) {
}
}

func TestRtmpPublish_HttpFlvPlayNoAudio(t *testing.T) {
func TestRtmpPublish_HttpFlvPlayNoVideo(t *testing.T) {
ctx := logger.WithContext(context.Background())
ctx, cancel := context.WithTimeout(ctx, time.Duration(*srsTimeout)*time.Millisecond)

Expand All @@ -481,8 +482,8 @@ func TestRtmpPublish_HttpFlvPlayNoAudio(t *testing.T) {
publisher := NewRTMPPublisher()
defer publisher.Close()

// Set publisher to drop audio.
publisher.hasAudio = false
// Set publisher to drop video.
publisher.hasVideo = false

player := NewFLVPlayer()
defer player.Close()
Expand Down Expand Up @@ -522,8 +523,8 @@ func TestRtmpPublish_HttpFlvPlayNoAudio(t *testing.T) {
return nil
}
player.onRecvTag = func(tp flv.TagType, size, ts uint32, tag []byte) error {
if tp == flv.TagTypeAudio {
return errors.New("should no audio")
if tp == flv.TagTypeVideo {
return errors.New("should no video")
}
logger.Tf(ctx, "got %v tag, %v %vms %vB", nnPackets, tp, ts, len(tag))
if nnPackets += 1; nnPackets > 50 {
Expand Down Expand Up @@ -555,7 +556,7 @@ func TestRtmpPublish_HttpFlvPlayNoAudio(t *testing.T) {
}
}

func TestRtmpPublish_HttpFlvPlayNoVideo(t *testing.T) {
func TestRtmpPublish_HttpFlvPlayNoAudio(t *testing.T) {
ctx := logger.WithContext(context.Background())
ctx, cancel := context.WithTimeout(ctx, time.Duration(*srsTimeout)*time.Millisecond)

Expand All @@ -564,8 +565,8 @@ func TestRtmpPublish_HttpFlvPlayNoVideo(t *testing.T) {
publisher := NewRTMPPublisher()
defer publisher.Close()

// Set publisher to drop video.
publisher.hasVideo = false
// Set publisher to drop audio.
publisher.hasAudio = false

player := NewFLVPlayer()
defer player.Close()
Expand Down Expand Up @@ -605,8 +606,8 @@ func TestRtmpPublish_HttpFlvPlayNoVideo(t *testing.T) {
return nil
}
player.onRecvTag = func(tp flv.TagType, size, ts uint32, tag []byte) error {
if tp == flv.TagTypeVideo {
return errors.New("should no video")
if tp == flv.TagTypeAudio {
return errors.New("should no audio")
}
logger.Tf(ctx, "got %v tag, %v %vms %vB", nnPackets, tp, ts, len(tag))
if nnPackets += 1; nnPackets > 50 {
Expand Down

0 comments on commit 8973b32

Please sign in to comment.