*not part of the build*

fix for 80938
a = avm@sparc.spb.su
    ovk@sparc.spb.su
    sva@sparc.spb.su

Tests for blackConnect


git-svn-id: svn://10.0.0.236/trunk@95860 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
idk%eng.sun.com
2001-05-24 05:22:13 +00:00
parent d74ff774aa
commit 6e4a0fdecc
214 changed files with 17250 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
#!gmake
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
# Client QA Team, St. Petersburg, Russia
#
DEPTH=../../../../../../..
topsrcdir = $(DEPTH)
srcdir = .
VPATH = .
include $(DEPTH)/config/autoconf.mk
MODULE = X2JOUTClientTestComponent
LIBRARY_NAME = $(MODULE)
XPIDL_MODULE = $(MODULE)
IS_COMPONENT = 1
CPPSRCS = \
X2JOUTClientTestComponent.cpp \
X2JOUTClientTestComponentFactory.cpp \
$(NULL)
XPIDLSRCS = iX2JOUTClientTestComponent.idl
JAVAI = iX2JOUTClientTestComponent.class
DSO_LDOPTS += \
$(XPCOM_LIBS) \
$(NSPR_LIBS) \
$(NULL)
include $(topsrcdir)/config/rules.mk
$(JAVAI)::
$(JDKHOME)/bin/javac -classpath .:$(DIST)/classes -d $(DIST)/classes $<
install:: $(JAVAI)

View File

@@ -0,0 +1,483 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
The contents of this file are subject to the Mozilla Public
License Version 1.1 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of
the License at http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
implied. See the License for the specific language governing
rights and limitations under the License.
The Original Code is mozilla.org code.
The Initial Developer of the Original Code is Sun Microsystems,
Inc. Portions created by Sun are
Copyright (C) 1999 Sun Microsystems, Inc. All
Rights Reserved.
Contributor(s):
Client QA Team, St. Petersburg, Russia
*/
#include "plstr.h"
#include "prmem.h"
#include "prenv.h"
#include "stdio.h"
#include "nsIComponentManager.h"
#include "X2JOUTClientTestComponent.h"
#include "nsMemory.h"
#include "BCTest.h"
#include <sys/stat.h>
#include <stdlib.h>
#include "nsString.h"
#include "nsStringUtil.h"
iX2JOUTServerTestComponent *serverComponent;
char* testLocation=NULL;
char* logLocation=NULL;
char* val=NULL;
char** hash=NULL;
PRUint8 hashCount=0;
PseudoHash* exclusionHash;
X2JOUTClientTestComponentImpl::X2JOUTClientTestComponentImpl() {
NS_INIT_REFCNT();
testLocation=PR_GetEnv(BC_TEST_LOCATION_VAR_NAME);
logLocation=PR_GetEnv(BC_LOG_LOCATION_VAR_NAME);
printf("DEbug:avm:X2JOUTClientTestComponentImpl::X2JOUTClientTestComponentImp\n");
hash=(char**)PR_Malloc(sizeof(char*)*50);
exclusionHash=new PseudoHash();
}
X2JOUTClientTestComponentImpl::~X2JOUTClientTestComponentImpl() {
}
NS_IMPL_ISUPPORTS3(X2JOUTClientTestComponentImpl, iX2JOUTClientTestComponent,
iClientTestComponent, iExclusionSupport);
IMPL_PROCEED_RESULTS(X2JOUTClientTestComponentImpl);
IMPL_PSEUDOHASH(X2JOUTClientTestComponentImpl);
/**
* This method creates an instance of server test component and
* transfers test and log locations to that instance.
*/
NS_IMETHODIMP X2JOUTClientTestComponentImpl::Initialize(const char* serverProgID) {
nsresult rv;
rv = nsComponentManager::CreateInstance(serverProgID,
nsnull,
NS_GET_IID(iX2JOUTServerTestComponent),
(void**)&serverComponent);
if (NS_FAILED(rv)) {
printf("Create instance failed!!!");
return rv;
}
serverComponent->SetTestLocation(testLocation, logLocation);
return NS_OK;
}
NS_IMETHODIMP X2JOUTClientTestComponentImpl::Exclude(PRUint32 count, const char **exclusionList) {
printf("Debug:ovk:X2JOUTClientTestComponentImpl::exclude\n");
for(int i=0;i<count;i++) {
exclusionHash->put((char*)exclusionList[i]);
hashCount++;
}
return NS_OK;
}
/**
* This method executes all tests. See more comments below.
*/
NS_IMETHODIMP X2JOUTClientTestComponentImpl::Execute(){
if (!exclusionHash->containsKey("octet")) TestByte();
if (!exclusionHash->containsKey("short")) TestShort();
if (!exclusionHash->containsKey("long")) TestLong();
if (!exclusionHash->containsKey("longlong")) TestLonglong();
if (!exclusionHash->containsKey("ushort")) TestUShort();
if (!exclusionHash->containsKey("ulong")) TestULong();
if (!exclusionHash->containsKey("ulonglong")) TestULonglong();
if (!exclusionHash->containsKey("float")) TestFloat();
if (!exclusionHash->containsKey("double")) TestDouble();
if (!exclusionHash->containsKey("boolean")) TestBoolean();
if (!exclusionHash->containsKey("char")) TestChar();
if (!exclusionHash->containsKey("wchar")) TestWChar();
if (!exclusionHash->containsKey("string")) TestString();
if (!exclusionHash->containsKey("wstring")) TestWString();
if (!exclusionHash->containsKey("stringArray")) TestStringArray();
if (!exclusionHash->containsKey("longArray")) TestLongArray();
if (!exclusionHash->containsKey("charArray")) TestCharArray();
if (!exclusionHash->containsKey("mixed")) TestMixed();
if (!exclusionHash->containsKey("object")) TestObject();
// if (!exclusionHash->containsKey("iid")) TestIID();
// if (!exclusionHash->containsKey("cid")) TestCID();
return NS_OK;
}
/**
* This block gets different short values from java side and
* sets test results for C++ side.
*/
void X2JOUTClientTestComponentImpl::TestShort(){
val=NULL;
PRInt16 _short=0;
for(int i=0;i<3;i++) {
serverComponent->TestShort(&_short);
val=PR_sprintf_append(val,"%d\n",_short);
}
PrintResult("x2j.out.client.short",val);
}
/**
* This block gets different byte values from java side and
* sets test results for C++ side.
*/
void X2JOUTClientTestComponentImpl::TestByte(){
val=NULL;
PRUint8 _byte=0;
for(int i=0;i<3;i++) {
serverComponent->TestByte(&_byte);
val=PR_sprintf_append(val,"%d\n",_byte);
}
PrintResult("x2j.out.client.octet",val);
}
/**
* This block gets different int values from java side and
* sets test results for C++ side.
*/
void X2JOUTClientTestComponentImpl::TestLong(){
val=NULL;
PRInt32 _int=0;
for(int i=0;i<3;i++) {
serverComponent->TestLong(&_int);
val=PR_sprintf_append(val,"%d\n",_int);
}
PrintResult("x2j.out.client.long",val);
}
/**
* This block gets different long values from java side and
* sets test results for C++ side.
*/
void X2JOUTClientTestComponentImpl::TestLonglong(){
val=NULL;
PRInt64 _long=0;
for(int i=0;i<3;i++) {
serverComponent->TestLonglong(&_long);
val=PR_sprintf_append(val,"%lld\n",_long);
}
PrintResult("x2j.out.client.longlong",val);
}
/**
* This block gets different unsigned short values from java side and
* sets test results for C++ side.
*/
void X2JOUTClientTestComponentImpl::TestUShort(){
val=NULL;
PRUint16 _ushort=0;
for(int i=0;i<3;i++) {
serverComponent->TestUShort(&_ushort);
val=PR_sprintf_append(val,"%d\n",_ushort);
}
PrintResult("x2j.out.client.ushort",val);
}
/**
* This block gets different unsigned int values from java side and
* sets test results for C++ side.
*/
void X2JOUTClientTestComponentImpl::TestULong(){
val=NULL;
PRUint32 _uint=0;
for(int i=0;i<3;i++) {
serverComponent->TestULong(&_uint);
val=PR_sprintf_append(val,"%d\n",_uint);
}
PrintResult("x2j.out.client.ulong",val);
}
/**
* This block gets different unsigned long values from java side and
* sets test results for C++ side.
*/
void X2JOUTClientTestComponentImpl::TestULonglong(){
val=NULL;
PRUint64 _ulong=0;
for(int i=0;i<3;i++) {
serverComponent->TestULonglong(&_ulong);
val=PR_sprintf_append(val,"%lld\n",_ulong);
}
PrintResult("x2j.out.client.ulonglong",val);
}
/**
* This block gets different float values from java side and
* sets test results for C++ side.
*/
void X2JOUTClientTestComponentImpl::TestFloat(){
val=NULL;
float _float=0;
for(int i=0;i<3;i++) {
serverComponent->TestFloat(&_float);
val=PR_sprintf_append(val,"%.3e\n",_float);
}
PrintResult("x2j.out.client.float",val);
}
/**
* This block gets different double values from java side and
* sets test results for C++ side.
*/
void X2JOUTClientTestComponentImpl::TestDouble(){
val=NULL;
double _double=0;
for(int i=0;i<3;i++) {
serverComponent->TestDouble(&_double);
val=PR_sprintf_append(val,"%.3e\n",_double);
}
PrintResult("x2j.out.client.double",val);
}
/**
* This block gets different boolean values from java side and
* sets test results for C++ side.
*/
void X2JOUTClientTestComponentImpl::TestBoolean(){
val=NULL;
PRBool _bool=false;
for(int i=0;i<2;i++) {
serverComponent->TestBoolean(&_bool);
if (_bool==PR_TRUE) val=PR_sprintf_append(val,"%s\n","true");
else if (_bool==PR_FALSE) val=PR_sprintf_append(val,"%s\n","false");
else val=PR_sprintf_append(val,"%s\n","strange result");
}
PrintResult("x2j.out.client.boolean",val);
}
/**
* This block gets different char values from java side and
* sets test results for C++ side.
*/
void X2JOUTClientTestComponentImpl::TestChar(){
val=NULL;
char _char='f';
for(int i=0;i<2;i++) {
serverComponent->TestChar(&_char);
val=PR_sprintf_append(val,"%c\n",_char);
}
PrintResult("x2j.out.client.char",val);
}
/**
* This block gets different PRUnichar values from java side and
* sets test results for C++ side.
*/
void X2JOUTClientTestComponentImpl::TestWChar(){
val=NULL;
PRUnichar _wchar=0;
for(int i=0;i<2;i++) {
serverComponent->TestWChar(&_wchar);
val=PR_sprintf_append(val,"%c\n",_wchar);
}
PrintResult("x2j.out.client.wchar",val);
}
/**
* This block gets different char* values from java side and
* sets test results for C++ side.
*/
void X2JOUTClientTestComponentImpl::TestString(){
val=NULL;
char* _string="0";
for(int i=0;i<3;i++) {
serverComponent->TestString(&_string);
val=PR_sprintf_append(val,"%s\n",_string);
}
PrintResult("x2j.out.client.string",val);
}
/**
* This block gets different PRUnichar* values from java side and
* sets test results for C++ side.
*/
void X2JOUTClientTestComponentImpl::TestWString(){
val=NULL;
PRUnichar* _wstring=NULL;
{
serverComponent->TestWString(&_wstring);
nsString str = *(new nsString(_wstring));
NS_ALLOC_STR_BUF(aBuf1,str,100)
val=PR_sprintf_append(val,"%s\n",aBuf1);
NS_FREE_STR_BUF(aBuf1)
}
{
serverComponent->TestWString(&_wstring);
nsString str = *(new nsString(_wstring));
NS_ALLOC_STR_BUF(aBuf2,str,100)
val=PR_sprintf_append(val,"%s\n",aBuf2);
NS_FREE_STR_BUF(aBuf2)
}
{
serverComponent->TestWString(&_wstring);
nsString str = *(new nsString(_wstring));
NS_ALLOC_STR_BUF(aBuf3,str,100)
val=PR_sprintf_append(val,"%s\n",aBuf3);
NS_FREE_STR_BUF(aBuf3)
}
PrintResult("x2j.out.client.wstring",val);
}
/**
* This block gets char* array from java side and
* sets test results for C++ side.
*/
void X2JOUTClientTestComponentImpl::TestStringArray(){
PRUint32 count=3;
char** _stringArray=(char**)PR_Malloc(sizeof(char*)*count);
const char** sA=(const char**)PR_Malloc(sizeof(const char*)*count);
serverComponent->TestStringArray(count,&_stringArray);
sA=(const char**) _stringArray;
PrintResultArray("x2j.out.client.stringArray",count,sA);
}
/**
* This block gets PRInt32 array from java side and
* sets test results for C++ side.
*/
void X2JOUTClientTestComponentImpl::TestLongArray(){
PRUint32 count=3;
PRInt32* _intArray=(PRInt32*)PR_Malloc(sizeof(PRInt32)*count);
serverComponent->TestLongArray(count,&_intArray);
PrintResultArray("x2j.out.client.longArray",count,_intArray);
}
/**
* This block gets char array from java side and
* sets test results for C++ side.
*/
void X2JOUTClientTestComponentImpl::TestCharArray(){
PRUint32 count=3;
char* _charArray=(char*)PR_Malloc(sizeof(char)*count);
serverComponent->TestCharArray(count,&_charArray);
PrintResultArray("x2j.out.client.charArray",count,_charArray);
}
/**
* This block gets misc values from java side and
* sets test results for C++ side.
*/
void X2JOUTClientTestComponentImpl::TestMixed(){
PRBool _bool=false;
char _char='0';
PRUint8 _byte=0;
PRInt16 _short=0; PRUint16 _ushort=0;
PRInt32 _int=0; PRUint32 _uint=0;
PRInt64 _long=0; PRUint64 _ulong=0;
float _float=0;
double _double=0;
char* _string="000";
int count=3;
PRInt32* _intArray=(PRInt32*)PR_Malloc(sizeof(PRInt32)*count);
serverComponent->TestMixed(&_bool, &_char, &_byte, &_short, &_ushort,
&_int, &_uint, &_long, &_ulong, &_float,
&_double, &_string, count, &_intArray);
PrintResultMixed("x2j.out.client.mixed",_bool, _char, _byte, _short,
_ushort, _int, _uint, _long, _ulong, _float,
_double, _string, count, _intArray);
}
/**
* This block gets iX2JOUTServerTestComponent object from java side and
* try to invoke TestObj() method from java side, using this
* object.
*/
void X2JOUTClientTestComponentImpl::TestObject(){
iX2JOUTServerTestComponent* obj=NULL;
serverComponent->TestObject(&obj);
obj->TestObj();
PrintResult("x2j.out.client.object","!!!Right string!!!");
}
// void X2JOUTClientTestComponentImpl::TestIID() {
/* const nsIID& iid=NS_GET_IID(iX2JOUTServerTestComponent);
val=NULL;
val=iid.ToString();
val=PR_sprintf_append(val,"%s\n",val);
PrintResult("x2j.out.client.iid",val);
serverComponent->TestIID(&iid);
*/
// }
// void X2JOUTClientTestComponentImpl::TestCID() {
/*
NS_DEFINE_CID(cid,X2JOUTCLIENTTESTCOMPONENT_CID);
val=NULL;
val=cid.ToString();
val=PR_sprintf_append(val,"%s\n",val);
PrintResult("x2j.out.client.cid",val);
serverComponent->TestCID(&cid);
*/
// }

View File

@@ -0,0 +1,67 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
The contents of this file are subject to the Mozilla Public
License Version 1.1 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of
the License at http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
implied. See the License for the specific language governing
rights and limitations under the License.
The Original Code is mozilla.org code.
The Initial Developer of the Original Code is Sun Microsystems,
Inc. Portions created by Sun are
Copyright (C) 1999 Sun Microsystems, Inc. All
Rights Reserved.
Contributor(s):
Client QA Team, St. Petersburg, Russia
*/
#include "iX2JOUTClientTestComponent.h"
#include "iX2JOUTServerTestComponent.h"
#include "iClientTestComponent.h"
#include "iExclusionSupport.h"
#include "ProceedResults.h"
#include "PseudoHash.h"
class X2JOUTClientTestComponentImpl : public iX2JOUTClientTestComponent,
public iClientTestComponent,
public iExclusionSupport
{
public:
X2JOUTClientTestComponentImpl();
virtual ~X2JOUTClientTestComponentImpl();
void TestByte(void);
void TestShort(void);
void TestLong(void);
void TestLonglong(void);
void TestUShort(void);
void TestULong(void);
void TestULonglong(void);
void TestFloat(void);
void TestDouble(void);
void TestBoolean(void);
void TestChar(void);
void TestWChar(void);
void TestString(void);
void TestWString(void);
void TestStringArray(void);
void TestLongArray(void);
void TestCharArray(void);
void TestMixed(void);
void TestObject(void);
// void TestIID(void);
// void TestCID(void);
NS_DECL_ISUPPORTS
NS_DECL_ICLIENTTESTCOMPONENT
NS_DECL_IEXCLUSIONSUPPORT
DECL_PROCEED_RESULTS
};
DECL_PSEUDOHASH

View File

@@ -0,0 +1,42 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
The contents of this file are subject to the Mozilla Public
License Version 1.1 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of
the License at http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
implied. See the License for the specific language governing
rights and limitations under the License.
The Original Code is mozilla.org code.
The Initial Developer of the Original Code is Sun Microsystems,
Inc. Portions created by Sun are
Copyright (C) 1999 Sun Microsystems, Inc. All
Rights Reserved.
Contributor(s):
Client QA Team, St. Petersburg, Russia
*/
#include "nsIGenericFactory.h"
#include "X2JOUTClientTestComponent.h"
NS_GENERIC_FACTORY_CONSTRUCTOR(X2JOUTClientTestComponentImpl)
static nsModuleComponentInfo components[] =
{
{
"X2JOUT Client Test Component",
X2JOUTCLIENTTESTCOMPONENT_CID,
X2JOUTCLIENTTESTCOMPONENT_PROGID,
X2JOUTClientTestComponentImplConstructor,
NULL /* NULL if you dont need one */,
NULL /* NULL if you dont need one */
}
};
NS_IMPL_NSGETMODULE("X2JOUTClientTestComponentFactory", components)

View File

@@ -0,0 +1,47 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
The contents of this file are subject to the Mozilla Public
License Version 1.1 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of
the License at http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
implied. See the License for the specific language governing
rights and limitations under the License.
The Original Code is mozilla.org code.
The Initial Developer of the Original Code is Sun Microsystems,
Inc. Portions created by Sun are
Copyright (C) 1999 Sun Microsystems, Inc. All
Rights Reserved.
Contributor(s):
Client QA Team, St. Petersburg, Russia
*/
#include "nsISupports.idl"
#include "iClientTestComponent.idl"
[scriptable, uuid(6e765da0-9605-11d4-9d3a-00a024a8bb88)]
interface iX2JOUTClientTestComponent : nsISupports
{
};
%{ C++
#define X2JOUTCLIENTTESTCOMPONENT_CID \
{ /*847cf780-9605-11d4-9d3a-00a024a8bb88*/ \
0x847cf780, \
0x9605, \
0x11d4, \
{0x9d, 0x3a, 0x00, 0xa0, 0x24, 0xa8, 0xbb, 0x88} \
}
#define X2JOUTCLIENTTESTCOMPONENT_PROGID "@mozilla/blackwood/blackconnect/test/params/X2JOUTClient;1"
%}

View File

@@ -0,0 +1,51 @@
#!nmake
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Sun Microsystems,
# Inc. Portions created by Sun are
# Copyright (C) 1999 Sun Microsystems, Inc. All
# Rights Reserved.
#
# Contributor(s):
# Client QA Team, St. Petersburg, Russia
#
DEPTH=..\..\..\..\..\..\..
MAKE_OBJ_TYPE = DLL
DLLNAME = X2JOUTClientTestComponent
DLL=.\$(OBJDIR)\$(DLLNAME).dll
MODULE = X2JOUTClientTestComponent
COMPONENT = 1
XPIDLSRCS = \
.\iX2JOUTClientTestComponent.idl \
$(NULL)
CPP_OBJS= \
.\$(OBJDIR)\X2JOUTClientTestComponent.obj \
.\$(OBJDIR)\X2JOUTClientTestComponentFactory.obj \
$(NULL)
LLIBS= $(LLIBS) $(LIBNSPR) $(DIST)\lib\xpcom.lib
include <$(DEPTH)\config\rules.mak>
install:: $(DLL)
$(MAKE_INSTALL) $(DLL) $(DIST)\bin\components
clobber::
del /f $(DIST)\bin\components\$(DLLNAME).dll
del /f $(DIST)\bin\components\X2JOUT*.xpt