Skip to content

Commit

Permalink
add wasm build test action
Browse files Browse the repository at this point in the history
use noderawfs for github workflow test
  • Loading branch information
Yuhengwe1 committed Nov 1, 2022
1 parent 91b8324 commit 79db3de
Show file tree
Hide file tree
Showing 8 changed files with 137 additions and 35 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: CI

on:
push:
pull_request:
on: workflow_dispatch
# push:
# pull_request:

jobs:
build:
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/wasm-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: wasm-test

on: workflow_dispatch

jobs:

wasm-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: mymindstorm/setup-emsdk@v11
with:
version: 3.1.16
- uses: actions/setup-node@v3
with:
node-version: 16
- run: node -v
- run: emcc -v
- run: sudo apt-get update -qq
- run: sudo apt-get install -qq nasm g++-multilib gcc-multilib libc6-dev-i386
- run: make gmp-bootstrap
- run: make gtest-bootstrap
- run: bash ./build/mktargets.sh
- run: emmake make all OS=wasm ARCH= EMFS=noderawfs
- run: node h264enc.js testbin/welsenc_vd_1d_wasm_nodefs.cfg
- run: node h264enc.js testbin/welsenc_vd_rc_wasm_nodefs.cfg
- run: node h264enc.js testbin/welsenc_arbitrary_res_wasm_nodefs.cfg
- run: node h264dec.js res/test_vd_1d.264 testbin/test_vd_1d.yuv
- run: node h264dec.js res/test_vd_rc.264 testbin/test_vd_rc.yuv
- run: node h264dec.js res/Static.264 testbin/Static.yuv
- run: ( cd test/encoder_binary_comparison ; ./run_PrepareAllTestData.sh 64 wasm )
- run: ./run_Test.sh BinaryCompareWasm BA_MW_D.264
- run: ./run_Test.sh BinaryCompareWasm Adobe_PDF_sample_a_1024x768_50Frms.264
- run: ./run_Test.sh BinaryCompareWasm Zhling_1280x720.264
28 changes: 14 additions & 14 deletions build/mktargets.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
#!/bin/sh
cd "$(git rev-parse --show-toplevel 2>/dev/null)" >/dev/null 2>&1
python build/mktargets.py --directory codec/decoder --library decoder
python build/mktargets.py --directory codec/encoder --library encoder --exclude DllEntry.cpp
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
python build/mktargets.py --directory codec/processing --library processing
python2 build/mktargets.py --directory codec/decoder --library decoder
python2 build/mktargets.py --directory codec/encoder --library encoder --exclude DllEntry.cpp
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
python2 build/mktargets.py --directory codec/processing --library processing

python build/mktargets.py --directory codec/console/dec --binary h264dec
python build/mktargets.py --directory codec/console/enc --binary h264enc
python build/mktargets.py --directory codec/console/common --library console_common
python build/mktargets.py --directory test/encoder --prefix encoder_unittest
python build/mktargets.py --directory test/decoder --prefix decoder_unittest
python build/mktargets.py --directory test/processing --prefix processing_unittest
python build/mktargets.py --directory test/api --prefix api_test
python build/mktargets.py --directory test/common --prefix common_unittest
python build/mktargets.py --directory module --prefix module
python build/mktargets.py --directory gtest/googletest --library gtest --out build/gtest-targets.mk --cpp-suffix .cc --include gtest-all.cc
python2 build/mktargets.py --directory codec/console/dec --binary h264dec
python2 build/mktargets.py --directory codec/console/enc --binary h264enc
python2 build/mktargets.py --directory codec/console/common --library console_common
python2 build/mktargets.py --directory test/encoder --prefix encoder_unittest
python2 build/mktargets.py --directory test/decoder --prefix decoder_unittest
python2 build/mktargets.py --directory test/processing --prefix processing_unittest
python2 build/mktargets.py --directory test/api --prefix api_test
python2 build/mktargets.py --directory test/common --prefix common_unittest
python2 build/mktargets.py --directory module --prefix module
python2 build/mktargets.py --directory gtest/googletest --library gtest --out build/gtest-targets.mk --cpp-suffix .cc --include gtest-all.cc
5 changes: 5 additions & 0 deletions build/platform-wasm.mk
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ CFLAGS += -DNODEFS
CXXFLAGS += -DNODEFS
LDFLAGS += -lnodefs.js
endif
ifeq ($(EMFS), noderawfs)
CFLAGS += -DNODERAWFS
CXXFLAGS += -DNODERAWFS
LDFLAGS += -s NODERAWFS=1
endif
ifeq ($(EMFS), memfs)
CFLAGS += -DMEMFS
CXXFLAGS += -DMEMFS
Expand Down
12 changes: 12 additions & 0 deletions run_Test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ runInputParamCheck()
then
let "ParameterFlag=0"
elif [ $# -eq 2 -a "$1" = "BinaryCompare" ]
then
let "ParameterFlag=0"
elif [ $# -eq 2 -a "$1" = "BinaryCompareWasm" ]
then
let "ParameterFlag=0"
else
Expand Down Expand Up @@ -65,6 +68,7 @@ runMain()
{
local TestType=$1
local TestBitStream=$2
export TestWasm=0
runInputParamCheck ${TestType} ${TestBitStream}
if [ ! $? -eq 0 ]
then
Expand All @@ -84,6 +88,14 @@ runMain()
runBinaryTest ${TestBitStream} TravisTest
return $?
fi
if [ "${TestType}" = "BinaryCompareWasm" ]
then
set -e
let "TestWasm=1"
TestType="BinaryCompare"
runBinaryTest ${TestBitStream} TravisTest
return $?
fi
}
TestType=$1
TestBitStream=$2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,14 @@ runEncodeOneCase()
do
EncoderCommand="${EncoderCommand} ${aEncoderCommandSet[$i]} ${aEncoderCommandValue[$i]} "
done

EncoderCommand="./h264enc welsenc.cfg -lconfig 0 layer0.cfg -lconfig 1 layer1.cfg -lconfig 2 layer2.cfg -lconfig 3 layer3.cfg \
if [ "$TestWasm" = "0" ]
then
EncoderCommand="./h264enc welsenc.cfg -lconfig 0 layer0.cfg -lconfig 1 layer1.cfg -lconfig 2 layer2.cfg -lconfig 3 layer3.cfg \
-bf ${BitStreamFile} -org ${TestSequencePath}/${TestYUVName} ${RecParam} ${EncoderCommand}"
else
EncoderCommand="node ./h264enc.js welsenc.cfg -lconfig 0 layer0.cfg -lconfig 1 layer1.cfg -lconfig 2 layer2.cfg -lconfig 3 layer3.cfg \
-bf ${BitStreamFile} -org ${TestSequencePath}/${TestYUVName} ${RecParam} ${EncoderCommand}"
fi
echo -e "\n---------------Encode One Case-------------------------------------------"
echo -e "case encode command is : \n ${EncoderCommand} "

Expand Down
9 changes: 8 additions & 1 deletion test/encoder_binary_comparison/Scripts/run_BitStreamToYUV.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,14 @@ run_BitStream2YUV()
return 1
fi
#decode bitstream
./h264dec ${BitStreamName} ${OutputYUVName} 2> ${LogFile}
echo "running decode test, printing pwd..."
echo $(pwd)
if [ "$TestWasm" = "0" ]
then
./h264dec ${BitStreamName} ${OutputYUVName} 2> ${LogFile}
else
node ./h264dec.js ${BitStreamName} ${OutputYUVName} 2> ${LogFile}
fi
return 0
}

Expand Down
69 changes: 54 additions & 15 deletions test/encoder_binary_comparison/run_PrepareAllTestData.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,24 @@ runBuildCodec()
cd ${MakeFileDir}
if [ "${BitType}" -eq 64 ]
then
make clean
make -B ENABLE64BIT=Yes h264dec h264enc
if [ "${TestWasm}" -eq 1 ]
then
make clean
emmake make binaries -B ENABLE64BIT=Yes OS=wasm ARCH= EMFS=noderawfs
else
make clean
make -B ENABLE64BIT=Yes h264dec h264enc
fi
elif [ "${BitType}" -eq 32 ]
then
make clean
make -B ENABLE64BIT=No h264dec h264enc
if [ "${TestWasm}" -eq 1 ]
then
make clean
emmake make binaries -B ENABLE64BIT=No OS=wasm ARCH= EMFS=noderawfs
else
make clean
make -B ENABLE64BIT=No h264dec h264enc
fi
else
echo "usage: runBuildCodec \64/32 #bits"
exit 1
Expand All @@ -51,14 +63,20 @@ runBuildCodec()
cd ${CurrentDir}

echo ""
if [ ! -e ${MakeFileDir}/h264enc ]
if [ ! -e ${MakeFileDir}/h264enc ]
then
echo "h264 Encoder build failed"
return 1
elif [ ! -e ${MakeFileDir}/h264dec ]
if [! -e $${MakeFileDir}/h264enc.js ]
then
echo "h264 Encoder build failed"
return 1
fi
elif [ ! -e ${MakeFileDir}/h264dec ]
then
echo "h264 Decoder build failed"
return 1
if [! -e $${MakeFileDir}/h264dec.js ]
then
echo "h264 Decoder build failed"
return 1
fi
else
echo "codec build succeed!"
return 0
Expand All @@ -74,8 +92,18 @@ runCopyFiles()
local ConfigureFileDir="../../testbin"

#copy codec and configure files
cp -p ${MakeFileDir}/h264enc ${CodecFolder}/
cp -p ${MakeFileDir}/h264dec ${CodecFolder}/
if [ "${TestWasm}" -eq 1 ]
then
cp -p ${MakeFileDir}/h264enc.js ${CodecFolder}/
cp -p ${MakeFileDir}/h264dec.js ${CodecFolder}/
cp -p ${MakeFileDir}/h264enc.worker.js ${CodecFolder}/
cp -p ${MakeFileDir}/h264dec.worker.js ${CodecFolder}/
cp -p ${MakeFileDir}/h264enc.wasm ${CodecFolder}/
cp -p ${MakeFileDir}/h264dec.wasm ${CodecFolder}/
else
cp -p ${MakeFileDir}/h264enc ${CodecFolder}/
cp -p ${MakeFileDir}/h264dec ${CodecFolder}/
fi
cp -p ${ConfigureFileDir}/layer2.cfg ${CodecFolder}/layer0.cfg
cp -p ${ConfigureFileDir}/layer2.cfg ${CodecFolder}/layer1.cfg
cp -p ${ConfigureFileDir}/layer2.cfg ${CodecFolder}/layer2.cfg
Expand Down Expand Up @@ -125,13 +153,18 @@ runPrepareAllFolder()
runMain()
{
#parameter check!
if [ ! $# -eq 1 ]
if [ ! $# -eq 2 ]
then
echo "usage: run_PrepareAllTestFolder.sh \${BitType}"
exit 1
fi

BitType=$1
export TestWasm=0
if [ "${WasmTest}" = "wasm" ]
then
let "TestWasm=1"
fi
AllTestDataFolder="./AllTestData"
CodecFolder="./Codec"
ScriptFolder="./Scripts"
Expand All @@ -150,7 +183,12 @@ runMain()
mkdir FinalResult

echo ""
echo "building codec.........."
if [ "${TestWasm}" -eq 1 ]
then
echo "building wasm codec.........."
else
echo "building codec.........."
fi
runBuildCodec ${BitType}
if [ ! $? -eq 0 ]
then
Expand All @@ -170,5 +208,6 @@ runMain()
}

BitType=$1
runMain ${BitType}
WasmTest=${2:-"normal"}
runMain ${BitType} ${WasmTest}

0 comments on commit 79db3de

Please sign in to comment.