runtest.bat #1

  • //
  • guest/
  • robert_cowham/
  • perforce/
  • API/
  • P4.Net/
  • main/
  • test/
  • runtest.bat
  • View
  • Commits
  • Open Download .zip Download (3 KB)
@echo off
rem unit test script.  Usage
rem runtest.bat 1.1^|2.0 [compile]
rem
rem  The first argument is the .Net framework version
rem  Supply "compile" if you want the test harness to be compiled
rem
rem To build for the 1.1 framework, execute from a Visual Studio .Net 2003 command prompt.
rem To build for the 2.0 framework, execute from a Visual Studio .Net 2005 command prompt.
rem

set DotNetFWVersion=0
if "%~1"=="1.1" set DotNetFWVersion=1.1
if "%~1"=="2.0" set DotNetFWVersion=2.0

rem change the following line if you're really anal 
rem and want to validate the SN versions as well.
set SN=
rem set SN=SN_

if "%DotNetFWVersion%"=="0" (
	echo Must include the .Net Framework version!
	call :usage
	goto :eof
)

if "%DotNetFWVersion%"=="1.1" (
	set OutputPath=%CD%\bin\CLR_1.1
	set ReferencePath=..\bin\%SN%CLR_1.1
	set nunitPath=..\ext\nunit\1.1
)
if "%DotNetFWVersion%"=="2.0" (
	set OutputPath=%CD%\bin\CLR_2.0
	set ReferencePath=..\bin\%SN%CLR_2.0
	set nunitPath=..\ext\nunit\2.0
)

if not exist "%ReferencePath%\p4api.dll" (
	echo "Must compile p4api.dll and p4dn.dll before running test!"
	goto :eof
)

if not exist "%ReferencePath%\p4dn.dll" (
	echo "Must compile p4api.dll and p4dn.dll before running test!"
	goto :eof
)

set SrcPath=%CD%\src
set BasePath=%CD%\..

if "%~2" == "compile" call :Compile_TestHarness


call LaunchServer.bat %~3

if "%~3"=="unicode" (
    set P4CHARSET=utf8
    set P4COMMANDCHARSET=utf8
    set RUNNINGUNICODE=true
) else (
    set RUNNINGUNICODE=false
    set P4CHARSET=
    set P4COMMANDCHARSET=
)

call :RunTests

call StopServer.bat


set P4CHARSET=
set P4COMMANDCHARSET=

goto :eof


:usage
	echo.	
	echo   P4.Net Test Harness.  Usage:
	echo      runtest.bat 1.1^|2.0 [compile] [unicode]
	echo         1.1^|2.0   The .Net framework version
	echo         [compile]  Compile first (test harness only).
	echo         [unicode]  Run server in unicode mode.
	echo.
	echo      To build for the 1.1 framework, execute from a 
	echo      Visual Studio .Net 2003 command prompt.
	echo.
	echo      To build for the 2.0 framework, execute from a 
	echo      Visual Studio .Net 2005 command prompt.
	echo.
	echo      The test harness will launch a new instance of p4d 
	echo      and run tests against it.
	echo.
	echo      Your favorite version of p4d.exe and p4.exe needs 
	echo      to be added to the current directory.
	echo.
goto :eof

:Compile_TestHarness

	if exist "%OutputPath%" rd /s /q "%OutputPath%"
	mkdir "%OutputPath%"

	rem make sure we have the references
	copy /y "%ReferencePath%\p4dn.dll" "%OutputPath%\p4dn.dll" >nul
	copy /y "%ReferencePath%\p4api.dll" "%OutputPath%\p4api.dll" >nul
	copy /y "%nunitPath%\nunit.framework.dll" "%OutputPath%\nunit.framework.dll" >nul
	
	set FLAGS=/target:library 
	rem set FLAGS=%FLAGS% /reference:"%OutputPath%\p4dn.dll" 
	set FLAGS=%FLAGS% /reference:"%OutputPath%\p4api.dll" 
	set FLAGS=%FLAGS% /reference:"%OutputPath%\nunit.framework.dll" 
	set FLAGS=%FLAGS% /w:0 /o
	set FLAGS=%FLAGS% "/out:%OutputPath%\P4.Net.TestDriver.dll"
	set FLAGS=%FLAGS% /nologo 
	
	set SOURCES="%SrcPath%\P4.NetTestDriver\*.cs"
	
	echo Compiling P4.Net.TestDriver.dll...
	csc %FLAGS% %SOURCES%

goto :eof


:RunTests
	
	
	echo Running Tests...

	"%nunitPath%\nunit-console.exe" "%OutputPath%\P4.Net.TestDriver.dll" /nologo /labels /fixture=P4.Net.TestDriver.StandardTest

	if "%RUNNINGUNICODE%"=="true" (
		"%nunitPath%\nunit-console.exe" "%OutputPath%\P4.Net.TestDriver.dll" /nologo /labels /fixture=P4.Net.TestDriver.UnicodeTest
	)
goto :eof
# Change User Description Committed
#1 6414 Robert Cowham Initial branch
//guest/shawn_hladky/P4.Net/main/test/runtest.bat
#6 5918 Shawn Hladky P4.Net unit test changes for fx1.1
#5 5915 Shawn Hladky p4.net
Fixed diff2 bug.
Re-worked array field logic
More unit tests
Organized P4Connection w/ #region blocks, and moved methods around
#4 5878 Shawn Hladky P4.Net:  1.0, support for raw spec processing.
 Update copyright.  Fix build script.  Bugs found along the way.
#3 5874 Shawn Hladky P4.Net:  v1.0 WIP.
 Upgrade API to 2006.2.  Fixes/tests for print and unicode servers.  Changed ConvertDate to use client's timezone... old logic trying to use server's timezone didn't account for daylight savings time.
#2 5842 Shawn Hladky P4.Net Update test harness for unicode server.
 Add methods to support p4 print.
#1 5830 Shawn Hladky P4.Net: reorg to support release branches
//guest/shawn_hladky/P4.Net/test/runtest.bat
#4 5678 Shawn Hladky WIP...
more tests.  OnPrompt event to recieve input from prompts.
#3 5636 Shawn Hladky 1.
 Added test harness framework, and some initial tests
2.  Fixed many bugs (oddly enough identified by the unit tests)
3.  Fixes so will build 1.1 Framework (and build batch files actually work)
4.  Pathetic attempt at documentation
#2 5411 Shawn Hladky WIP -- forms are working now.
#1 5373 Shawn Hladky P4.Net: Still WIP, but some things starting to work