Reviewed-by: Jaben Carsey <[email protected]> > -----Original Message----- > From: Ni, Ruiyu > Sent: Monday, September 14, 2015 8:48 PM > To: [email protected] > Cc: Ni, Ruiyu <[email protected]>; Carsey, Jaben <[email protected]> > Subject: [Patch V2] * ShellPkg: Add a simple case to test shell parameter > parsing logic > Importance: High > > TestArgv.nsh is a very simple shell script to test how the interpreter parses > the parameters. It uses ShellCTestApp.efi to dump the parameters passed > from the > interpreter. > > TestArgv.log is the desired output created using "TestArgv.nsh > > TestArgv.log". > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Ruiyu Ni <[email protected]> > Cc: Jaben Carsey <[email protected]> > --- > ShellPkg/Application/ShellCTestApp/README.txt | 5 ++ > ShellPkg/Application/ShellCTestApp/ShellCTestApp.c | 11 ++-- > ShellPkg/Application/ShellCTestApp/TestArgv.log | Bin 0 -> 3320 bytes > ShellPkg/Application/ShellCTestApp/TestArgv.nsh | 64 > +++++++++++++++++++++ > 4 files changed, 75 insertions(+), 5 deletions(-) > create mode 100644 ShellPkg/Application/ShellCTestApp/README.txt > create mode 100644 ShellPkg/Application/ShellCTestApp/TestArgv.log > create mode 100644 ShellPkg/Application/ShellCTestApp/TestArgv.nsh > > diff --git a/ShellPkg/Application/ShellCTestApp/README.txt > b/ShellPkg/Application/ShellCTestApp/README.txt > new file mode 100644 > index 0000000..7814bb8 > --- /dev/null > +++ b/ShellPkg/Application/ShellCTestApp/README.txt > @@ -0,0 +1,5 @@ > +TestArgv.nsh is a very simple shell script to test how the interpreter parses > +the parameters. It uses ShellCTestApp.efi to dump the parameters passed > from the > +intepreter. > + > +TestArgv.log is the desired output created using "TestArgv.nsh > > TestArgv.log". > \ No newline at end of file > diff --git a/ShellPkg/Application/ShellCTestApp/ShellCTestApp.c > b/ShellPkg/Application/ShellCTestApp/ShellCTestApp.c > index 8d3fa4c..08c830c 100644 > --- a/ShellPkg/Application/ShellCTestApp/ShellCTestApp.c > +++ b/ShellPkg/Application/ShellCTestApp/ShellCTestApp.c > @@ -2,7 +2,7 @@ > This is a test application that demonstrates how to use the C-style entry > point > for a shell application. > > - Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR> > + Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR> > This program and the accompanying materials > are licensed and made available under the terms and conditions of the BSD > License > which accompanies this distribution. The full text of the license may be > found at > @@ -40,10 +40,11 @@ ShellAppMain ( > ) > { > UINTN Index; > - > - Print(L"ShellCTestApp.c:ShellAppMain called with %d parameters\n", > Argc); > - for (Index = 0; Index < Argc; Index++) { > - Print(L"Argv[%d]: %s\n", Index, Argv[Index]); > + if (Argc == 1) { > + Print (L"Argv[1] = NULL\n"); > + } > + for (Index = 1; Index < Argc; Index++) { > + Print(L"Argv[%d]: \"%s\"\n", Index, Argv[Index]); > } > > return 0; > diff --git a/ShellPkg/Application/ShellCTestApp/TestArgv.log > b/ShellPkg/Application/ShellCTestApp/TestArgv.log > new file mode 100644 > index > 0000000000000000000000000000000000000000..e76781ea0e4387cf97ad42d5cc > bb8a72f99c8d61 > GIT binary patch > literal 3320 > zcmcha-EPxB5QWcmCEmeumCH&=6Q>ChNOt0IgFvXzn?fx_- > 5;r<5dp;01K+G=wZUFT > z4t8bPp6txdIXgS!+5Gvv(y4}eu8(@DK)Jr?M)ycZJiqFh4zz8t!R9;qGkw-KWlGU6 > zxW|e#<(=u6YsOfniB5PQBgI;RVq;?^SS}e^XwK6tSG<Eqm- > )Wa50KvKO0SS^b=kn> > z6wbzGjsFynkz<g8KXuqcuxCgU$8Cf(gF(t@#ybK%ak>~r3x3bglzc99*ns>FZui6 > ^ > z$5YB|TUqKjByMDk?- > *&K5xNLzj@B?UxXl@z5|O#n4|!TFACSWa<TC!Y_MB+lG4nmr > z1~xH~C}NS~- > y)KrwOE{h7&~bKTI_fvj?ozH63Z2AhFFbwM$EGH1msBnDAioEEVyN7 > zH&4W%h`fKTRfc}sKo?v#BPKJi^;74>^b?g9C`41Yx6R&)JgoC}xQDkv=M_BguC > @=X > z_VFub)Wt8{BYpw9>Dyh?wdWUj{k8Yy=e7?s%VdA_OxK=ax7AVIi9j!?v^V;o* > Iex? > zci_HvU3V0JeYCINP<_- > ?Kz|&lkDlgVdws7rCUrUWuxkIe(mHWBeXox7|KwFjS1x)? > zS%r09qknC-&tLv^TVGjo`)hx_$9HL)bB_OC+- > 1c#^Us}awf4$0<PoR3?oX1t@GOE| > n*Y+;VK5A+g=2M;!t6UzR-HLtoXKr^DTjjC+kLHU16K3-lP8Y@4 > > literal 0 > HcmV?d00001 > > diff --git a/ShellPkg/Application/ShellCTestApp/TestArgv.nsh > b/ShellPkg/Application/ShellCTestApp/TestArgv.nsh > new file mode 100644 > index 0000000..013ac12 > --- /dev/null > +++ b/ShellPkg/Application/ShellCTestApp/TestArgv.nsh > @@ -0,0 +1,64 @@ > +#/** @file > +# This is a very simple shell script to test how the interpreter parses the > parameters. > +# > +# Copyright (c) 2015, Intel Corporation. All rights reserved.<BR> > +# This program and the accompanying materials > +# are licensed and made available under the terms and conditions of the > BSD License > +# which accompanies this distribution. The full text of the license may be > found at > +# http://opensource.org/licenses/bsd-license.php > +# > +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" > BASIS, > +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER > EXPRESS OR IMPLIED. > +# > +#**/ > +echo -on > +set Var_EFCF356F_228C_47C2_AD0C_3B5DAC9A8CFA ValueOfGuid > +set Sharp_E8528E46_A008_4221_8DE0_D5AB42A9C580 ^# > +set Quote_E95DEE8B_E3AA_4155_9ED5_6916394104FC ^" > +set Var_ShellCTestApp_EE6E8BC6_71A6_44A5_BED3_D8F901105CDE > ShellCTestApp_EE6E8BC6_71A6_44A5_BED3_D8F901105CDE > +alias ShellCTestApp_EE6E8BC6_71A6_44A5_BED3_D8F901105CDE > ShellCTestApp > + > +# > +# '^' should escape all special characters (including space) > +# but has no impact to non-special characters > +# > +ShellCTestApp ^^ > +ShellCTestApp ^# > +ShellCTestApp ^%Var_EFCF356F_228C_47C2_AD0C_3B5DAC9A8CFA% > +ShellCTestApp ^" > +ShellCTestApp ^ 1 > +ShellCTestApp ^ > +ShellCTestApp ^1 > +ShellCTestApp ^^^" > +ShellCTestApp ^^^ > + > +# > +# '#' should be processed before %% replacement, and inside '"' > +# > +ShellCTestApp #%Var_EFCF356F_228C_47C2_AD0C_3B5DAC9A8CFA% > +#ShellCTestApp "#" > +ShellCTestApp %Sharp_E8528E46_A008_4221_8DE0_D5AB42A9C580% > + > +# > +# '%' should be processed before grouping parameters > +# > +ShellCTestApp "%Var_EFCF356F_228C_47C2_AD0C_3B5DAC9A8CFA% > 2%Quote_E95DEE8B_E3AA_4155_9ED5_6916394104FC% > + > +# > +# alias should be processed after %% replacement > +# > +%Var_ShellCTestApp_EE6E8BC6_71A6_44A5_BED3_D8F901105CDE% > + > +# > +# '"' should be stripped, space inside '"' should be kept, > +# > +ShellCTestApp "p 1" > +ShellCTestApp "p"1 > +ShellCTestApp "p 1"e"x""" > + > +set -d Var_EFCF356F_228C_47C2_AD0C_3B5DAC9A8CFA > +set -d Sharp_E8528E46_A008_4221_8DE0_D5AB42A9C580 > +set -d Quote_E95DEE8B_E3AA_4155_9ED5_6916394104FC > +set -d Var_ShellCTestApp_EE6E8BC6_71A6_44A5_BED3_D8F901105CDE > +alias -d ShellCTestApp_EE6E8BC6_71A6_44A5_BED3_D8F901105CDE > +echo -off > \ No newline at end of file > -- > 1.9.5.msysgit.1
_______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel

