tests.sh 1.1 KB
Newer Older
S
update  
superjom 已提交
1 2 3
#!/bin/bash
set -ex

S
init  
superjom 已提交
4
mode=$1
S
superjom 已提交
5 6 7 8 9
readonly cur=$(pwd)
readonly core_path=$cur/build/visualdl/logic
readonly python_path=$cur/visualdl/python

export PYTHONPATH="${core_path}:${python_path}"
S
init  
superjom 已提交
10 11

backend_test() {
S
superjom 已提交
12
    cd $cur
S
init  
superjom 已提交
13
    sudo pip install numpy
S
superjom 已提交
14
    sudo pip install Pillow
S
init  
superjom 已提交
15 16 17 18 19 20 21 22
    mkdir -p build
    cd build
    cmake ..
    make
    make test
}

frontend_test() {
S
superjom 已提交
23
    cd $cur
S
init  
superjom 已提交
24 25 26 27 28
    cd frontend
    npm install
    npm run build
}

S
superjom 已提交
29
server_test() {
D
daminglu 已提交
30 31 32
    sudo pip install google
    sudo pip install protobuf==3.1.0

S
superjom 已提交
33
    cd $cur/server
D
daminglu 已提交
34 35 36 37 38 39
    curl -OL https://github.com/google/protobuf/releases/download/v3.1.0/protoc-3.1.0-linux-x86_64.zip
    unzip protoc-3.1.0-linux-x86_64.zip -d protoc3
    export PATH=$PATH:protoc3/bin
    sudo chmod +x protoc3/bin/protoc
    sudo chown `whoami` protoc3/bin/protoc

S
superjom 已提交
40
    bash build.sh
D
daminglu 已提交
41 42 43 44

    cd visualdl
    bash graph_test.sh

S
superjom 已提交
45 46 47 48
    cd $cur/server/visualdl
    python lib_test.py
}

S
init  
superjom 已提交
49 50 51 52
echo "mode" $mode

if [ $mode = "backend" ]; then
    backend_test
S
superjom 已提交
53 54 55
elif [ $mode = "all" ]; then
    frontend_test
    backend_test
S
superjom 已提交
56
    server_test
S
init  
superjom 已提交
57 58 59
else
    frontend_test
fi