1 Star 0 Fork 1

毛雄斌/UA-.NETStandard

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
testclientserver.sh 2.28 KB
一键复制 编辑 原始数据 按行查看 历史
#!/bin/bash
echo Test the .Net Core server and complex client
workdir=$(pwd)
testresult=0
testresulthttps=0
serverresult=0
cd SampleApplications/Samples/NetCoreConsoleServer
echo build server
rm -r obj
dotnet build NetCoreConsoleServer.csproj
cd ../NetCoreConsoleClient
echo build client
rm -r obj
dotnet build NetCoreConsoleClient.csproj
cd "$workdir"
cd ../NetCoreComplexClient
echo build client
rm -r obj
dotnet build NetCoreComplexClient.csproj
cd "$workdir"
cd SampleApplications/Samples/NetCoreConsoleServer
echo start server
touch ./server.log
dotnet run --no-restore --no-build --project NetCoreConsoleServer.csproj -t 60 -a >./server.log &
serverpid="$!"
echo wait for server started
grep -m 1 "start" <(tail -f ./server.log --pid=$serverpid)
tail -f ./server.log --pid=$serverpid &
cd "$workdir"
cd SampleApplications/Samples/NetCoreComplexClient
echo start client for tcp connection
dotnet run --no-restore --no-build --project NetCoreComplexClient.csproj -t 10 -a -v &
clientpid="$!"
cd "$workdir"
cd SampleApplications/Samples/NetCoreConsoleClient
echo start client for https connection
dotnet run --no-restore --no-build --project NetCoreConsoleClient.csproj -t 20 -a https://localhost:51212 &
httpsclientpid="$!"
cd "$workdir"
echo wait for opc.tcp client
wait $clientpid
if [ $? -eq 0 ]; then
echo "SUCCESS - Client test passed"
else
testresult=$?
echo "FAILED - Client test failed with a status of $testresult"
fi
cd SampleApplications/Samples/NetCoreConsoleClient
cd "$workdir"
echo wait for https client
wait $httpsclientpid
if [ $? -eq 0 ]; then
echo "SUCCESS - Client test passed"
else
testresulthttps=$?
echo "FAILED - Client test failed with a status of $testresulthttps"
echo "FAILED - Client may require to use trusted TLS server cert to pass this test"
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
testresulthttps=0
echo "IGNORED - test requires trusted TLS cert on OSX"
fi
fi
echo send Ctrl-C to server
kill -s SIGINT $serverpid
echo wait for server
wait $serverpid
serverresult=$?
if [ $? -eq 0 ]; then
echo "SUCCESS - Server test passed"
else
serverresult=$?
echo "FAILED - Server test failed with a status of $serverresult"
fi
echo "Test results: Client:$testresult Server:$serverresult ClientHttps:$testresulthttps"
exit $((testresult + serverresult + testresulthttps))
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C#
1
https://gitee.com/mao_qin_bin/UA-.NETStandard.git
git@gitee.com:mao_qin_bin/UA-.NETStandard.git
mao_qin_bin
UA-.NETStandard
UA-.NETStandard
master

搜索帮助