From 8d779639e798af6dd5756f8cfaf34116c3c74a4e Mon Sep 17 00:00:00 2001 From: sdhzhs Date: Sun, 14 Jul 2024 10:41:44 +0800 Subject: [PATCH] 1. Improve echo function in regression script 2. Add return values in compare golden python script --- comgolden.py | 8 ++--- regtestfoil.sh | 88 +++++++++++++++++++++++++++++++++++++++----------- 2 files changed, 73 insertions(+), 23 deletions(-) diff --git a/comgolden.py b/comgolden.py index ee67b47..0bde9d2 100644 --- a/comgolden.py +++ b/comgolden.py @@ -35,11 +35,8 @@ def buildtoken(tokenlist): aeroparagolden=[] tokenlist=[] buildtoken(tokenlist) -#filename='cases/Aeroreport.dat' filename=sys.argv[1]+'/Aeroreport.dat' readaeropara(filename,tokenlist,aeropara) -#filename='../2.2.10/ransfoil22-win64-binary/cases/Aeroreport.dat' -#filename='D:\\CaseFiles\\ransfoil\\relaxfactor\\Aeroreport_simple_ra0.7.dat' filename=sys.argv[2]+'/Aeroreport.dat' readaeropara(filename,tokenlist,aeroparagolden) #for a in aeropara: @@ -59,5 +56,8 @@ def buildtoken(tokenlist): print("The relative error of",tokenlist[i],"with golden is",res) else: print("The relative error of",tokenlist[i-1],"with golden is",res) -if(flag): +if(flag): print("The relative errors of all the aeropara with golden are smaller than",tol) + sys.exit(0) +else: + sys.exit(1) diff --git a/regtestfoil.sh b/regtestfoil.sh index b87d07e..df0aa0f 100755 --- a/regtestfoil.sh +++ b/regtestfoil.sh @@ -1,33 +1,83 @@ #!/bin/sh mkdir naca0012_xyz -ransfoil --script test/ransfoil.config.0012.xyz -python comgolden.py naca0012_xyz golden/naca0012_xyz +ransfoil --script test/ransfoil.config.0012.xyz > naca0012_xyz/output.txt +python comgolden.py naca0012_xyz golden/naca0012_xyz >> naca0012_xyz/output.txt +if [ $? -eq 0 ]; then + echo "naca0012_xyz case: Pass" +else + echo "naca0012_xyz case: Fail" +fi mkdir naca001264_cpt -ransfoil --script test/ransfoil.config.001264.cpt -python comgolden.py naca001264_cpt golden/naca001264_cpt +ransfoil --script test/ransfoil.config.001264.cpt > naca001264_cpt/output.txt +python comgolden.py naca001264_cpt golden/naca001264_cpt >> naca001264_cpt/output.txt +if [ $? -eq 0 ]; then + echo "naca001264_cpt case: Pass" +else + echo "naca001264_cpt case: Fail" +fi mkdir GA_W-1_xyz -ransfoil --script test/ransfoil.config.GA_W-1.xyz -python comgolden.py GA_W-1_xyz golden/GA_W-1_xyz +ransfoil --script test/ransfoil.config.GA_W-1.xyz > GA_W-1_xyz/output.txt +python comgolden.py GA_W-1_xyz golden/GA_W-1_xyz >> GA_W-1_xyz/output.txt +if [ $? -eq 0 ]; then + echo "GA_W-1_xyz case: Pass" +else + echo "GA_W-1_xyz case: Fail" +fi mkdir GA_W-1_cpt -ransfoil --script test/ransfoil.config.GA_W-1.cpt -python comgolden.py GA_W-1_cpt golden/GA_W-1_cpt +ransfoil --script test/ransfoil.config.GA_W-1.cpt > GA_W-1_cpt/output.txt +python comgolden.py GA_W-1_cpt golden/GA_W-1_cpt >> GA_W-1_cpt/output.txt +if [ $? -eq 0 ]; then + echo "GA_W-1_cpt case: Pass" +else + echo "GA_W-1_cpt case: Fail" +fi mkdir whitcomb_xyz -ransfoil --script test/ransfoil.config.whitcomb.xyz.1 -ransfoil --script test/ransfoil.config.whitcomb.xyz.2 -python comgolden.py whitcomb_xyz golden/whitcomb_xyz +ransfoil --script test/ransfoil.config.whitcomb.xyz.1 > whitcomb_xyz/output.txt +ransfoil --script test/ransfoil.config.whitcomb.xyz.2 >> whitcomb_xyz/output.txt +python comgolden.py whitcomb_xyz golden/whitcomb_xyz >> whitcomb_xyz/output.txt +if [ $? -eq 0 ]; then + echo "whitcomb_xyz case: Pass" +else + echo "whitcomb_xyz case: Fail" +fi mkdir whitcomb_cpt -ransfoil --script test/ransfoil.config.whitcomb.cpt.1 -ransfoil --script test/ransfoil.config.whitcomb.cpt.2 -python comgolden.py whitcomb_cpt golden/whitcomb_cpt +ransfoil --script test/ransfoil.config.whitcomb.cpt.1 > whitcomb_cpt/output.txt +ransfoil --script test/ransfoil.config.whitcomb.cpt.2 >> whitcomb_cpt/output.txt +python comgolden.py whitcomb_cpt golden/whitcomb_cpt >> whitcomb_cpt/output.txt +if [ $? -eq 0 ]; then + echo "whitcomb_cpt case: Pass" +else + echo "whitcomb_cpt case: Fail" +fi mkdir goe495_cpt -ransfoil --script test/ransfoil.config.goe495.cpt -python comgolden.py goe495_cpt golden/goe495_cpt +ransfoil --script test/ransfoil.config.goe495.cpt > goe495_cpt/output.txt +python comgolden.py goe495_cpt golden/goe495_cpt >> goe495_cpt/output.txt +if [ $? -eq 0 ]; then + echo "goe495_cpt case: Pass" +else + echo "goe495_cpt case: Fail" +fi cd scripts ./runwhitcomb.bat -python ../comgolden.py whitcomb1 ../golden/whitcomb_xyz_super +python ../comgolden.py whitcomb1 ../golden/whitcomb_xyz_super > 3.txt +if [ $? -eq 0 ]; then + echo "whitcomb_xyz_super case: Pass" +else + echo "whitcomb_xyz_super case: Fail" +fi cd ../src gfcompile.sh -./caller.exe +./caller.exe > output.txt +if [ $? -eq 0 ]; then + echo "fortran call lib case: Pass" +else + echo "fortran call lib case: Fail" +fi gccompile.sh -./caller.exe +./caller.exe >> output.txt +if [ $? -eq 0 ]; then + echo "c call lib case: Pass" +else + echo "c call lib case: Fail" +fi cd ..