Skip to content

Commit ed84227

Browse files
committed
add wasm build test action
use noderawfs for github workflow test
1 parent 91b8324 commit ed84227

File tree

10 files changed

+27823
-35
lines changed

10 files changed

+27823
-35
lines changed

.github/workflows/build.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
name: CI
22

3-
on:
4-
push:
5-
pull_request:
3+
on: workflow_dispatch
4+
# push:
5+
# pull_request:
66

77
jobs:
88
build:

.github/workflows/wasm-test.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: wasm-test
2+
3+
on: workflow_dispatch
4+
5+
jobs:
6+
7+
wasm-test:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v3
11+
- uses: mymindstorm/setup-emsdk@v11
12+
with:
13+
version: 3.1.16
14+
- uses: actions/setup-node@v3
15+
with:
16+
node-version: 16
17+
- run: node -v
18+
- run: emcc -v
19+
- run: sudo apt-get update -qq
20+
- run: sudo apt-get install -qq nasm g++-multilib gcc-multilib libc6-dev-i386
21+
- run: make gmp-bootstrap
22+
- run: make gtest-bootstrap
23+
- run: bash ./build/mktargets.sh
24+
- run: emmake make all OS=wasm ARCH= EMFS=noderawfs
25+
- run: node h264enc.js testbin/welsenc_vd_1d_wasm_nodefs.cfg
26+
- run: node h264enc.js testbin/welsenc_vd_rc_wasm_nodefs.cfg
27+
- run: node h264enc.js testbin/welsenc_arbitrary_res_wasm_nodefs.cfg
28+
- run: node h264dec.js res/test_vd_1d.264 testbin/test_vd_1d.yuv
29+
- run: node h264dec.js res/test_vd_rc.264 testbin/test_vd_rc.yuv
30+
- run: node h264dec.js res/Static.264 testbin/Static.yuv
31+
- run: ( cd test/encoder_binary_comparison ; ./run_PrepareAllTestData.sh 64 wasm )
32+
- run: ./run_Test.sh BinaryCompareWasm BA_MW_D.264
33+
- run: ./run_Test.sh BinaryCompareWasm Adobe_PDF_sample_a_1024x768_50Frms.264
34+
- run: ./run_Test.sh BinaryCompareWasm Zhling_1280x720.264

build/mktargets.sh

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
#!/bin/sh
22
cd "$(git rev-parse --show-toplevel 2>/dev/null)" >/dev/null 2>&1
3-
python build/mktargets.py --directory codec/decoder --library decoder
4-
python build/mktargets.py --directory codec/encoder --library encoder --exclude DllEntry.cpp
5-
python build/mktargets.py --directory codec/common --library common --exclude asm_inc.asm --exclude arm_arch_common_macro.S --exclude arm_arch64_common_macro.S
6-
python build/mktargets.py --directory codec/processing --library processing
3+
python2 build/mktargets.py --directory codec/decoder --library decoder
4+
python2 build/mktargets.py --directory codec/encoder --library encoder --exclude DllEntry.cpp
5+
python2 build/mktargets.py --directory codec/common --library common --exclude asm_inc.asm --exclude arm_arch_common_macro.S --exclude arm_arch64_common_macro.S
6+
python2 build/mktargets.py --directory codec/processing --library processing
77

8-
python build/mktargets.py --directory codec/console/dec --binary h264dec
9-
python build/mktargets.py --directory codec/console/enc --binary h264enc
10-
python build/mktargets.py --directory codec/console/common --library console_common
11-
python build/mktargets.py --directory test/encoder --prefix encoder_unittest
12-
python build/mktargets.py --directory test/decoder --prefix decoder_unittest
13-
python build/mktargets.py --directory test/processing --prefix processing_unittest
14-
python build/mktargets.py --directory test/api --prefix api_test
15-
python build/mktargets.py --directory test/common --prefix common_unittest
16-
python build/mktargets.py --directory module --prefix module
17-
python build/mktargets.py --directory gtest/googletest --library gtest --out build/gtest-targets.mk --cpp-suffix .cc --include gtest-all.cc
8+
python2 build/mktargets.py --directory codec/console/dec --binary h264dec
9+
python2 build/mktargets.py --directory codec/console/enc --binary h264enc
10+
python2 build/mktargets.py --directory codec/console/common --library console_common
11+
python2 build/mktargets.py --directory test/encoder --prefix encoder_unittest
12+
python2 build/mktargets.py --directory test/decoder --prefix decoder_unittest
13+
python2 build/mktargets.py --directory test/processing --prefix processing_unittest
14+
python2 build/mktargets.py --directory test/api --prefix api_test
15+
python2 build/mktargets.py --directory test/common --prefix common_unittest
16+
python2 build/mktargets.py --directory module --prefix module
17+
python2 build/mktargets.py --directory gtest/googletest --library gtest --out build/gtest-targets.mk --cpp-suffix .cc --include gtest-all.cc

build/platform-wasm.mk

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ CFLAGS += -DNODEFS
1414
CXXFLAGS += -DNODEFS
1515
LDFLAGS += -lnodefs.js
1616
endif
17+
ifeq ($(EMFS), noderawfs)
18+
CFLAGS += -DNODERAWFS
19+
CXXFLAGS += -DNODERAWFS
20+
LDFLAGS += -s NODERAWFS=1
21+
endif
1722
ifeq ($(EMFS), memfs)
1823
CFLAGS += -DMEMFS
1924
CXXFLAGS += -DMEMFS

commandTest.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node ./h264enc.js welsenc.cfg -bf TempData/BA_MW_D.264_x.yuv_codec_target.264 -org /home/test/workspace/openh264/test/encoder_binary_comparison/AllTestData/BA_MW_D.264/BA_MW_D.264_x.yuv
2+
node ./h264enc.js welsenc.cfg -bf workload/test/encoder_binary_comparison/AllTestData/BA_MW_D.264/TempData/BA_MW_D.264_x.yuv_codec_target.264 -org /home/test/workspace/openh264/test/encoder_binary_comparison/AllTestData/BA_MW_D.264/BA_MW_D.264_x.yuv

run_Test.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ runInputParamCheck()
2525
then
2626
let "ParameterFlag=0"
2727
elif [ $# -eq 2 -a "$1" = "BinaryCompare" ]
28+
then
29+
let "ParameterFlag=0"
30+
elif [ $# -eq 2 -a "$1" = "BinaryCompareWasm" ]
2831
then
2932
let "ParameterFlag=0"
3033
else
@@ -65,6 +68,7 @@ runMain()
6568
{
6669
local TestType=$1
6770
local TestBitStream=$2
71+
export TestWasm=0
6872
runInputParamCheck ${TestType} ${TestBitStream}
6973
if [ ! $? -eq 0 ]
7074
then
@@ -84,6 +88,14 @@ runMain()
8488
runBinaryTest ${TestBitStream} TravisTest
8589
return $?
8690
fi
91+
if [ "${TestType}" = "BinaryCompareWasm" ]
92+
then
93+
set -e
94+
let "TestWasm=1"
95+
TestType="BinaryCompare"
96+
runBinaryTest ${TestBitStream} TravisTest
97+
return $?
98+
fi
8799
}
88100
TestType=$1
89101
TestBitStream=$2

test/encoder_binary_comparison/Scripts/run_BinarySHA1Comparison.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,14 @@ runEncodeOneCase()
171171
do
172172
EncoderCommand="${EncoderCommand} ${aEncoderCommandSet[$i]} ${aEncoderCommandValue[$i]} "
173173
done
174-
175-
EncoderCommand="./h264enc welsenc.cfg -lconfig 0 layer0.cfg -lconfig 1 layer1.cfg -lconfig 2 layer2.cfg -lconfig 3 layer3.cfg \
174+
if [ "$TestWasm" = "0" ]
175+
then
176+
EncoderCommand="./h264enc welsenc.cfg -lconfig 0 layer0.cfg -lconfig 1 layer1.cfg -lconfig 2 layer2.cfg -lconfig 3 layer3.cfg \
176177
-bf ${BitStreamFile} -org ${TestSequencePath}/${TestYUVName} ${RecParam} ${EncoderCommand}"
178+
else
179+
EncoderCommand="node ./h264enc.js welsenc.cfg -lconfig 0 layer0.cfg -lconfig 1 layer1.cfg -lconfig 2 layer2.cfg -lconfig 3 layer3.cfg \
180+
-bf ${BitStreamFile} -org ${TestSequencePath}/${TestYUVName} ${RecParam} ${EncoderCommand}"
181+
fi
177182
echo -e "\n---------------Encode One Case-------------------------------------------"
178183
echo -e "case encode command is : \n ${EncoderCommand} "
179184

test/encoder_binary_comparison/Scripts/run_BitStreamToYUV.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,14 @@ run_BitStream2YUV()
6464
return 1
6565
fi
6666
#decode bitstream
67-
./h264dec ${BitStreamName} ${OutputYUVName} 2> ${LogFile}
67+
echo "running decode test, printing pwd..."
68+
echo $(pwd)
69+
if [ "$TestWasm" = "0" ]
70+
then
71+
./h264dec ${BitStreamName} ${OutputYUVName} 2> ${LogFile}
72+
else
73+
node ./h264dec.js ${BitStreamName} ${OutputYUVName} 2> ${LogFile}
74+
fi
6875
return 0
6976
}
7077

test/encoder_binary_comparison/run_PrepareAllTestData.sh

Lines changed: 54 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,24 @@ runBuildCodec()
3737
cd ${MakeFileDir}
3838
if [ "${BitType}" -eq 64 ]
3939
then
40-
make clean
41-
make -B ENABLE64BIT=Yes h264dec h264enc
40+
if [ "${TestWasm}" -eq 1 ]
41+
then
42+
make clean
43+
emmake make binaries -B ENABLE64BIT=Yes OS=wasm ARCH= EMFS=noderawfs
44+
else
45+
make clean
46+
make -B ENABLE64BIT=Yes h264dec h264enc
47+
fi
4248
elif [ "${BitType}" -eq 32 ]
4349
then
44-
make clean
45-
make -B ENABLE64BIT=No h264dec h264enc
50+
if [ "${TestWasm}" -eq 1 ]
51+
then
52+
make clean
53+
emmake make binaries -B ENABLE64BIT=No OS=wasm ARCH= EMFS=noderawfs
54+
else
55+
make clean
56+
make -B ENABLE64BIT=No h264dec h264enc
57+
fi
4658
else
4759
echo "usage: runBuildCodec \64/32 #bits"
4860
exit 1
@@ -51,14 +63,20 @@ runBuildCodec()
5163
cd ${CurrentDir}
5264

5365
echo ""
54-
if [ ! -e ${MakeFileDir}/h264enc ]
66+
if [ ! -e ${MakeFileDir}/h264enc ]
5567
then
56-
echo "h264 Encoder build failed"
57-
return 1
58-
elif [ ! -e ${MakeFileDir}/h264dec ]
68+
if [! -e $${MakeFileDir}/h264enc.js ]
69+
then
70+
echo "h264 Encoder build failed"
71+
return 1
72+
fi
73+
elif [ ! -e ${MakeFileDir}/h264dec ]
5974
then
60-
echo "h264 Decoder build failed"
61-
return 1
75+
if [! -e $${MakeFileDir}/h264dec.js ]
76+
then
77+
echo "h264 Decoder build failed"
78+
return 1
79+
fi
6280
else
6381
echo "codec build succeed!"
6482
return 0
@@ -74,8 +92,18 @@ runCopyFiles()
7492
local ConfigureFileDir="../../testbin"
7593

7694
#copy codec and configure files
77-
cp -p ${MakeFileDir}/h264enc ${CodecFolder}/
78-
cp -p ${MakeFileDir}/h264dec ${CodecFolder}/
95+
if [ "${TestWasm}" -eq 1 ]
96+
then
97+
cp -p ${MakeFileDir}/h264enc.js ${CodecFolder}/
98+
cp -p ${MakeFileDir}/h264dec.js ${CodecFolder}/
99+
cp -p ${MakeFileDir}/h264enc.worker.js ${CodecFolder}/
100+
cp -p ${MakeFileDir}/h264dec.worker.js ${CodecFolder}/
101+
cp -p ${MakeFileDir}/h264enc.wasm ${CodecFolder}/
102+
cp -p ${MakeFileDir}/h264dec.wasm ${CodecFolder}/
103+
else
104+
cp -p ${MakeFileDir}/h264enc ${CodecFolder}/
105+
cp -p ${MakeFileDir}/h264dec ${CodecFolder}/
106+
fi
79107
cp -p ${ConfigureFileDir}/layer2.cfg ${CodecFolder}/layer0.cfg
80108
cp -p ${ConfigureFileDir}/layer2.cfg ${CodecFolder}/layer1.cfg
81109
cp -p ${ConfigureFileDir}/layer2.cfg ${CodecFolder}/layer2.cfg
@@ -125,13 +153,18 @@ runPrepareAllFolder()
125153
runMain()
126154
{
127155
#parameter check!
128-
if [ ! $# -eq 1 ]
156+
if [ ! $# -eq 2 ]
129157
then
130158
echo "usage: run_PrepareAllTestFolder.sh \${BitType}"
131159
exit 1
132160
fi
133161

134162
BitType=$1
163+
export TestWasm=0
164+
if [ "${WasmTest}" = "wasm" ]
165+
then
166+
let "TestWasm=1"
167+
fi
135168
AllTestDataFolder="./AllTestData"
136169
CodecFolder="./Codec"
137170
ScriptFolder="./Scripts"
@@ -150,7 +183,12 @@ runMain()
150183
mkdir FinalResult
151184

152185
echo ""
153-
echo "building codec.........."
186+
if [ "${TestWasm}" -eq 1 ]
187+
then
188+
echo "building wasm codec.........."
189+
else
190+
echo "building codec.........."
191+
fi
154192
runBuildCodec ${BitType}
155193
if [ ! $? -eq 0 ]
156194
then
@@ -170,5 +208,6 @@ runMain()
170208
}
171209

172210
BitType=$1
173-
runMain ${BitType}
211+
WasmTest=${2:-"normal"}
212+
runMain ${BitType} ${WasmTest}
174213

0 commit comments

Comments
 (0)