mirror of https://github.com/axmolengine/axmol.git
Merge branch 'develop' of https://github.com/cocos2d/cocos2d-x into develop_fix
This commit is contained in:
commit
6b34239d75
|
@ -591,6 +591,11 @@ void RawStencilBufferTest::setup()
|
||||||
sprite->setAnchorPoint( Point(0.5, 0) );
|
sprite->setAnchorPoint( Point(0.5, 0) );
|
||||||
sprite->setScale( 2.5f );
|
sprite->setScale( 2.5f );
|
||||||
_sprites.pushBack(sprite);
|
_sprites.pushBack(sprite);
|
||||||
|
|
||||||
|
Sprite* sprite2 = Sprite::create(s_pathGrossini);
|
||||||
|
sprite2->setAnchorPoint( Point(0.5, 0) );
|
||||||
|
sprite2->setScale( 2.5f );
|
||||||
|
_spritesStencil.pushBack(sprite2);
|
||||||
}
|
}
|
||||||
|
|
||||||
Director::getInstance()->setAlphaBlending(true);
|
Director::getInstance()->setAlphaBlending(true);
|
||||||
|
@ -624,6 +629,7 @@ void RawStencilBufferTest::draw(Renderer *renderer, const kmMat4 &transform, boo
|
||||||
spritePoint.x += planeSize.x / 2;
|
spritePoint.x += planeSize.x / 2;
|
||||||
spritePoint.y = 0;
|
spritePoint.y = 0;
|
||||||
_sprites.at(i)->setPosition( spritePoint );
|
_sprites.at(i)->setPosition( spritePoint );
|
||||||
|
_spritesStencil.at(i)->setPosition( spritePoint );
|
||||||
|
|
||||||
iter->init(_globalZOrder);
|
iter->init(_globalZOrder);
|
||||||
iter->func = CC_CALLBACK_0(RawStencilBufferTest::onBeforeDrawClip, this, i, stencilPoint);
|
iter->func = CC_CALLBACK_0(RawStencilBufferTest::onBeforeDrawClip, this, i, stencilPoint);
|
||||||
|
@ -632,7 +638,7 @@ void RawStencilBufferTest::draw(Renderer *renderer, const kmMat4 &transform, boo
|
||||||
|
|
||||||
kmGLPushMatrix();
|
kmGLPushMatrix();
|
||||||
_modelViewTransform = this->transform(transform);
|
_modelViewTransform = this->transform(transform);
|
||||||
_sprites.at(i)->visit(renderer, _modelViewTransform, transformUpdated);
|
_spritesStencil.at(i)->visit(renderer, _modelViewTransform, transformUpdated);
|
||||||
kmGLPopMatrix();
|
kmGLPopMatrix();
|
||||||
|
|
||||||
iter->init(_globalZOrder);
|
iter->init(_globalZOrder);
|
||||||
|
@ -736,6 +742,15 @@ void RawStencilBufferTest3::setupStencilForDrawingOnPlane(GLint plane)
|
||||||
RawStencilBufferTest::setupStencilForDrawingOnPlane(plane);
|
RawStencilBufferTest::setupStencilForDrawingOnPlane(plane);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RawStencilBufferTestAlphaTest::setup()
|
||||||
|
{
|
||||||
|
RawStencilBufferTest::setup();
|
||||||
|
auto program = ShaderCache::getInstance()->getProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_ALPHA_TEST_NO_MV);
|
||||||
|
for(int i = 0; i < _planeCount; ++i)
|
||||||
|
{
|
||||||
|
_spritesStencil.at(i)->setShaderProgram(program );
|
||||||
|
}
|
||||||
|
}
|
||||||
//@implementation RawStencilBufferTest4
|
//@implementation RawStencilBufferTest4
|
||||||
|
|
||||||
std::string RawStencilBufferTest4::subtitle() const
|
std::string RawStencilBufferTest4::subtitle() const
|
||||||
|
@ -752,14 +767,10 @@ void RawStencilBufferTest4::setupStencilForClippingOnPlane(GLint plane)
|
||||||
glEnable(GL_ALPHA_TEST);
|
glEnable(GL_ALPHA_TEST);
|
||||||
glAlphaFunc(GL_GREATER, _alphaThreshold);
|
glAlphaFunc(GL_GREATER, _alphaThreshold);
|
||||||
#else
|
#else
|
||||||
auto program = ShaderCache::getInstance()->getProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_ALPHA_TEST);
|
auto program = ShaderCache::getInstance()->getProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_ALPHA_TEST_NO_MV);
|
||||||
GLint alphaValueLocation = glGetUniformLocation(program->getProgram(), GLProgram::UNIFORM_NAME_ALPHA_TEST_VALUE);
|
GLint alphaValueLocation = glGetUniformLocation(program->getProgram(), GLProgram::UNIFORM_NAME_ALPHA_TEST_VALUE);
|
||||||
|
program->use();
|
||||||
program->setUniformLocationWith1f(alphaValueLocation, _alphaThreshold);
|
program->setUniformLocationWith1f(alphaValueLocation, _alphaThreshold);
|
||||||
for(int i = 0; i < _planeCount; ++i)
|
|
||||||
{
|
|
||||||
_sprites.at(i)->setShaderProgram(program );
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -789,13 +800,10 @@ void RawStencilBufferTest5::setupStencilForClippingOnPlane(GLint plane)
|
||||||
glEnable(GL_ALPHA_TEST);
|
glEnable(GL_ALPHA_TEST);
|
||||||
glAlphaFunc(GL_GREATER, _alphaThreshold);
|
glAlphaFunc(GL_GREATER, _alphaThreshold);
|
||||||
#else
|
#else
|
||||||
auto program = ShaderCache::getInstance()->getProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_ALPHA_TEST);
|
auto program = ShaderCache::getInstance()->getProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_ALPHA_TEST_NO_MV);
|
||||||
GLint alphaValueLocation = glGetUniformLocation(program->getProgram(), GLProgram::UNIFORM_NAME_ALPHA_TEST_VALUE);
|
GLint alphaValueLocation = glGetUniformLocation(program->getProgram(), GLProgram::UNIFORM_NAME_ALPHA_TEST_VALUE);
|
||||||
|
program->use();
|
||||||
program->setUniformLocationWith1f(alphaValueLocation, _alphaThreshold);
|
program->setUniformLocationWith1f(alphaValueLocation, _alphaThreshold);
|
||||||
for(int i = 0; i < _planeCount; ++i)
|
|
||||||
{
|
|
||||||
_sprites.at(i)->setShaderProgram(program );
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -818,6 +826,7 @@ std::string RawStencilBufferTest6::subtitle() const
|
||||||
|
|
||||||
void RawStencilBufferTest6::setup()
|
void RawStencilBufferTest6::setup()
|
||||||
{
|
{
|
||||||
|
RawStencilBufferTestAlphaTest::setup();
|
||||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_LINUX) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_LINUX) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
|
||||||
auto winPoint = Point(Director::getInstance()->getWinSize());
|
auto winPoint = Point(Director::getInstance()->getWinSize());
|
||||||
//by default, glReadPixels will pack data with 4 bytes allignment
|
//by default, glReadPixels will pack data with 4 bytes allignment
|
||||||
|
@ -840,7 +849,6 @@ void RawStencilBufferTest6::setup()
|
||||||
this->addChild(clearToMaskLabel);
|
this->addChild(clearToMaskLabel);
|
||||||
#endif
|
#endif
|
||||||
glStencilMask(~0);
|
glStencilMask(~0);
|
||||||
RawStencilBufferTest::setup();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RawStencilBufferTest6::setupStencilForClippingOnPlane(GLint plane)
|
void RawStencilBufferTest6::setupStencilForClippingOnPlane(GLint plane)
|
||||||
|
@ -858,13 +866,10 @@ void RawStencilBufferTest6::setupStencilForClippingOnPlane(GLint plane)
|
||||||
glEnable(GL_ALPHA_TEST);
|
glEnable(GL_ALPHA_TEST);
|
||||||
glAlphaFunc(GL_GREATER, _alphaThreshold);
|
glAlphaFunc(GL_GREATER, _alphaThreshold);
|
||||||
#else
|
#else
|
||||||
auto program = ShaderCache::getInstance()->getProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_ALPHA_TEST);
|
auto program = ShaderCache::getInstance()->getProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_ALPHA_TEST_NO_MV);
|
||||||
GLint alphaValueLocation = glGetUniformLocation(program->getProgram(), GLProgram::UNIFORM_NAME_ALPHA_TEST_VALUE);
|
GLint alphaValueLocation = glGetUniformLocation(program->getProgram(), GLProgram::UNIFORM_NAME_ALPHA_TEST_VALUE);
|
||||||
|
program->use();
|
||||||
program->setUniformLocationWith1f(alphaValueLocation, _alphaThreshold);
|
program->setUniformLocationWith1f(alphaValueLocation, _alphaThreshold);
|
||||||
for(int i = 0; i < _planeCount; ++i)
|
|
||||||
{
|
|
||||||
_sprites.at(i)->setShaderProgram(program );
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
glFlush();
|
glFlush();
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,6 +166,7 @@ protected:
|
||||||
void onBeforeDrawSprite(int planeIndex, const Point& pt);
|
void onBeforeDrawSprite(int planeIndex, const Point& pt);
|
||||||
protected:
|
protected:
|
||||||
Vector<Sprite*> _sprites;
|
Vector<Sprite*> _sprites;
|
||||||
|
Vector<Sprite*> _spritesStencil;
|
||||||
};
|
};
|
||||||
|
|
||||||
class RawStencilBufferTest2 : public RawStencilBufferTest
|
class RawStencilBufferTest2 : public RawStencilBufferTest
|
||||||
|
@ -188,7 +189,13 @@ public:
|
||||||
virtual void setupStencilForDrawingOnPlane(GLint plane);
|
virtual void setupStencilForDrawingOnPlane(GLint plane);
|
||||||
};
|
};
|
||||||
|
|
||||||
class RawStencilBufferTest4 : public RawStencilBufferTest
|
class RawStencilBufferTestAlphaTest : public RawStencilBufferTest
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void setup() override;
|
||||||
|
};
|
||||||
|
|
||||||
|
class RawStencilBufferTest4 : public RawStencilBufferTestAlphaTest
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CREATE_FUNC(RawStencilBufferTest4);
|
CREATE_FUNC(RawStencilBufferTest4);
|
||||||
|
@ -198,7 +205,7 @@ public:
|
||||||
virtual void setupStencilForDrawingOnPlane(GLint plane);
|
virtual void setupStencilForDrawingOnPlane(GLint plane);
|
||||||
};
|
};
|
||||||
|
|
||||||
class RawStencilBufferTest5 : public RawStencilBufferTest
|
class RawStencilBufferTest5 : public RawStencilBufferTestAlphaTest
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CREATE_FUNC(RawStencilBufferTest5);
|
CREATE_FUNC(RawStencilBufferTest5);
|
||||||
|
@ -208,13 +215,12 @@ public:
|
||||||
virtual void setupStencilForDrawingOnPlane(GLint plane);
|
virtual void setupStencilForDrawingOnPlane(GLint plane);
|
||||||
};
|
};
|
||||||
|
|
||||||
class RawStencilBufferTest6 : public RawStencilBufferTest
|
class RawStencilBufferTest6 : public RawStencilBufferTestAlphaTest
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CREATE_FUNC(RawStencilBufferTest6);
|
CREATE_FUNC(RawStencilBufferTest6);
|
||||||
|
virtual void setup() override;
|
||||||
virtual std::string subtitle() const override;
|
virtual std::string subtitle() const override;
|
||||||
virtual void setup();
|
|
||||||
virtual void setupStencilForClippingOnPlane(GLint plane);
|
virtual void setupStencilForClippingOnPlane(GLint plane);
|
||||||
virtual void setupStencilForDrawingOnPlane(GLint plane);
|
virtual void setupStencilForDrawingOnPlane(GLint plane);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit ad62fda3d74918f81df56c95ab91c05cc6a44814
|
Subproject commit 33c75427e370e35bb61598aaf3d88435361d71ab
|
|
@ -6,44 +6,51 @@
|
||||||
# will add: window-android,linux-android
|
# will add: window-android,linux-android
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import subprocess
|
|
||||||
import sys
|
import sys
|
||||||
import json
|
import json
|
||||||
import time
|
import time
|
||||||
import socket
|
import socket
|
||||||
|
import platform
|
||||||
|
|
||||||
payload = {}
|
payload = {}
|
||||||
#get payload from os env
|
#get payload from os env
|
||||||
if os.environ.has_key('payload'):
|
if os.environ.has_key('payload'):
|
||||||
payload_str = os.environ['payload']
|
payload_str = os.environ['payload']
|
||||||
#parse to json obj
|
#parse to json obj
|
||||||
global payload
|
|
||||||
payload = json.loads(payload_str)
|
payload = json.loads(payload_str)
|
||||||
print 'payload:',payload
|
print 'payload:',payload
|
||||||
pr_num = 1
|
pr_num = 6326
|
||||||
#get pull number
|
#get pull number
|
||||||
if payload.has_key('issue'):
|
if payload.has_key('number'):
|
||||||
issue = payload['issue']
|
pr_num = payload['number']
|
||||||
if issue.has_key('number'):
|
|
||||||
pr_num = issue['number']
|
|
||||||
print 'pr_num:' + str(pr_num)
|
print 'pr_num:' + str(pr_num)
|
||||||
|
run_app_time = 5
|
||||||
|
if os.environ.has_key('RUN_APP_TIME'):
|
||||||
|
global run_app_time
|
||||||
|
run_app_time = os.environ['RUN_APP_TIME']
|
||||||
|
print 'run_app_time:', run_app_time
|
||||||
|
|
||||||
test_name = ['cpp_empty_test']
|
test_name = ['cpp_empty_test']
|
||||||
if os.environ.has_key('TESTS_NAME'):
|
if os.environ.has_key('TESTS_NAME'):
|
||||||
temp_var = os.environ('TESTS_NAME')
|
temp_var = os.environ['TESTS_NAME']
|
||||||
test_name = temp_var.split(', ')
|
test_name = temp_var.split(', ')
|
||||||
package_name = ['org.cocos2dx.hellocpp']
|
package_name = ['org.cocos2dx.cpp_empty_test']
|
||||||
if os.environ.has_key('PACKAGE_NAME'):
|
if os.environ.has_key('PACKAGE_NAME'):
|
||||||
temp_var = os.environ('PACKAGE_NAME')
|
temp_var = os.environ['PACKAGE_NAME']
|
||||||
package_name = temp_var.split(', ')
|
package_name = temp_var.split(', ')
|
||||||
activity_name = ['org.cocos2dx.cpp.AppActivity']
|
activity_name = ['org.cocos2dx.cpp_empty_test.AppActivity']
|
||||||
if os.environ.has_key('ACTIVITY_NAME'):
|
if os.environ.has_key('ACTIVITY_NAME'):
|
||||||
temp_var = os.environ('ACTIVITY_NAME')
|
temp_var = os.environ['ACTIVITY_NAME']
|
||||||
activity_name = temp_var.split(', ')
|
activity_name = temp_var.split(', ')
|
||||||
gIdx = 0
|
gIdx = 0
|
||||||
if os.environ.has_key('TEST_INDEX'):
|
if os.environ.has_key('TEST_INDEX'):
|
||||||
gIdx = os.environ('TEST_INDEX')
|
gIdx = os.environ('TEST_INDEX')
|
||||||
|
|
||||||
|
current_platform = platform.system()
|
||||||
|
print 'current platform is:', current_platform
|
||||||
|
|
||||||
|
empty_test_result = True
|
||||||
|
empty_test_result_info = ''
|
||||||
arrDevices = []
|
arrDevices = []
|
||||||
def getDevices():
|
def getDevices():
|
||||||
cmd = 'adb devices'
|
cmd = 'adb devices'
|
||||||
|
@ -65,6 +72,7 @@ def getDevices():
|
||||||
def getADBDeviceIP(device_name):
|
def getADBDeviceIP(device_name):
|
||||||
output = os.popen("adb -s "+device_name+" shell netcfg")
|
output = os.popen("adb -s "+device_name+" shell netcfg")
|
||||||
configs = output.read().split('\r\n')
|
configs = output.read().split('\r\n')
|
||||||
|
output.close()
|
||||||
for l in configs:
|
for l in configs:
|
||||||
items = l.split()
|
items = l.split()
|
||||||
if len(items)>1 and items[1] == 'UP':
|
if len(items)>1 and items[1] == 'UP':
|
||||||
|
@ -74,18 +82,55 @@ def getADBDeviceIP(device_name):
|
||||||
def mapIP():
|
def mapIP():
|
||||||
for device in arrDevices:
|
for device in arrDevices:
|
||||||
ip_d = getADBDeviceIP(device['name'])
|
ip_d = getADBDeviceIP(device['name'])
|
||||||
if ip_d:
|
|
||||||
ip_d = ip_d.replace('.30.', '.40.')
|
|
||||||
device['ip'] = ip_d
|
device['ip'] = ip_d
|
||||||
|
|
||||||
|
device_info = {}
|
||||||
|
info_list = '{"product":["model","brand","name","cpu.abi","cpu.abi2","manufacturer","locale.language","locale.region"],"build":["id","version.sdk","version.release"]}'
|
||||||
|
if os.environ.has_key('DEVICE_INFO_LIST'):
|
||||||
|
info_list = os.environ['DEVICE_INFO_LIST']
|
||||||
|
info_list = eval(info_list)
|
||||||
|
def getDeviceInfoByName(name):
|
||||||
|
cmd = ''
|
||||||
|
if len(name) > 0:
|
||||||
|
cmd = 'adb -s '+name+' shell cat /system/build.prop'
|
||||||
|
else:
|
||||||
|
cmd = 'adb shell cat /system/build.prop'
|
||||||
|
pip_cat = os.popen(cmd)
|
||||||
|
read_info = pip_cat.read()
|
||||||
|
read_info_list = read_info.split('\r\n')
|
||||||
|
def checkProperty(item_str):
|
||||||
|
for argv in info_list:
|
||||||
|
for item in info_list[argv]:
|
||||||
|
prop = argv+'.'+item
|
||||||
|
if item_str.find(prop) > -1:
|
||||||
|
arr_item = item_str.split('=')
|
||||||
|
device_info[prop] = arr_item[1]
|
||||||
|
break
|
||||||
|
for item in read_info_list:
|
||||||
|
checkProperty(item)
|
||||||
|
|
||||||
|
#getDeviceInfoByName('')
|
||||||
|
#print 'device_info:',device_info
|
||||||
|
def logDeviceInfomation():
|
||||||
|
getDeviceInfoByName('')
|
||||||
|
for key in device_info:
|
||||||
|
print '\t'+key+':'+device_info[key]
|
||||||
|
|
||||||
info_empty_test = {}
|
info_empty_test = {}
|
||||||
apk_name = 'apk/'+test_name[gIdx]+'/'+test_name[gIdx]+'_'+str(pr_num)+'.apk'
|
apk_name = 'apks/'+test_name[gIdx]+'/'+test_name[gIdx]+'_'+str(pr_num)+'.apk'
|
||||||
def install_apk():
|
def install_apk():
|
||||||
print 'will install apk:', apk_name
|
print 'will install apk:', apk_name
|
||||||
|
global empty_test_result
|
||||||
if len(arrDevices) == 0:
|
if len(arrDevices) == 0:
|
||||||
print 'no android device.'
|
empty_test_result = False
|
||||||
|
empty_test_result_info = 'no android device.'
|
||||||
|
print empty_test_result_info
|
||||||
return False
|
return False
|
||||||
info_of_install = []
|
info_of_install = []
|
||||||
|
if not os.path.isfile(apk_name):
|
||||||
|
print apk_name, 'is not exist!'
|
||||||
|
empty_test_result = False
|
||||||
|
return False
|
||||||
for device in arrDevices:
|
for device in arrDevices:
|
||||||
name = device['name']
|
name = device['name']
|
||||||
cmd = 'adb -s '+name+' install '+apk_name
|
cmd = 'adb -s '+name+' install '+apk_name
|
||||||
|
@ -107,40 +152,64 @@ def open_apk(type_of_apk):
|
||||||
for info in info_start:
|
for info in info_start:
|
||||||
if info.find('Error:') > -1:
|
if info.find('Error:') > -1:
|
||||||
print 'infomation of open activity:',info
|
print 'infomation of open activity:',info
|
||||||
|
global empty_test_result
|
||||||
|
empty_test_result = False
|
||||||
|
empty_test_result_info = 'open :'+info
|
||||||
return info
|
return info
|
||||||
|
if len(arrDevices):
|
||||||
print 'activity is opened.'
|
print 'activity is opened.'
|
||||||
|
else:
|
||||||
|
print 'no device.'
|
||||||
return True
|
return True
|
||||||
|
|
||||||
PORT = 5678
|
PORT = 5678
|
||||||
def socket_status(device_name):
|
def socket_status(device_name):
|
||||||
soc = socket.socket( socket.AF_INET, socket.SOCK_STREAM )
|
soc = socket.socket( socket.AF_INET, socket.SOCK_STREAM )
|
||||||
|
status_socket = False
|
||||||
|
global empty_test_result
|
||||||
try:
|
try:
|
||||||
print 'will check status of app:', device_name
|
print 'telnet ', device_name['ip'], PORT
|
||||||
soc.connect((device_name['ip'], PORT))
|
soc.connect((device_name['ip'], PORT))
|
||||||
cmd = 'resolution\r\n'
|
cmd = 'resolution\r\n'
|
||||||
# print 'socket cmd :', cmd
|
# print 'socket cmd :', cmd
|
||||||
|
print 'connected successfully.'
|
||||||
|
print 'send console command: resolution'
|
||||||
soc.send(cmd)
|
soc.send(cmd)
|
||||||
while True:
|
while True:
|
||||||
data = soc.recv(1024)
|
data = soc.recv(1024)
|
||||||
if len(data):
|
if len(data):
|
||||||
print data
|
print data
|
||||||
if data.find('size:') > -1:
|
if data.find('size:') > -1:
|
||||||
print test_name[gIdx]+' is successful!'
|
print 'OK'
|
||||||
return True
|
print 'close', test_name[gIdx]
|
||||||
|
soc.send('director end')
|
||||||
|
print 'OK'
|
||||||
|
status_socket = True
|
||||||
|
break
|
||||||
if not data:
|
if not data:
|
||||||
print test_name[gIdx]+' is crashed!'
|
empty_test_result = False
|
||||||
|
empty_test_result_info = test_name[gIdx]+' is crashed!'
|
||||||
|
print empty_test_result_info
|
||||||
break
|
break
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
print test_name[gIdx]+' is crashed!'
|
empty_test_result = False
|
||||||
return False
|
empty_test_result_info = test_name[gIdx]+' is crashed!'
|
||||||
|
print empty_test_result_info
|
||||||
|
time.sleep(2)
|
||||||
|
soc.close()
|
||||||
|
return status_socket
|
||||||
|
|
||||||
def uninstall_apk(idx):
|
def uninstall_apk(idx):
|
||||||
# adb shell pm uninstall -n org.cocos2dx.hellolua
|
# adb shell pm uninstall -n org.cocos2dx.hellolua
|
||||||
print 'will uninstall apk:', package_name[idx]
|
print 'uninstall ', test_name[idx]
|
||||||
for device in arrDevices:
|
for device in arrDevices:
|
||||||
cmd = 'adb -s '+device['name']+' shell pm uninstall -n '+package_name[idx]
|
cmd = 'adb -s '+device['name']+' shell pm uninstall -n '+package_name[idx]
|
||||||
info_uninstall = os.popen(cmd).read()
|
info_uninstall = os.popen(cmd).read()
|
||||||
print 'uninstall apk:', info_uninstall
|
if info_uninstall.find('Success') > -1:
|
||||||
|
print 'OK'
|
||||||
|
else:
|
||||||
|
empty_test_result_info = 'uninstall Failed!'
|
||||||
|
print empty_test_result_info
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
@ -149,7 +218,17 @@ def main():
|
||||||
if len(arrDevices):
|
if len(arrDevices):
|
||||||
mapIP()
|
mapIP()
|
||||||
print 'arrDevices:',arrDevices
|
print 'arrDevices:',arrDevices
|
||||||
|
uninstall_apk(gIdx)
|
||||||
|
time.sleep(1)
|
||||||
|
else:
|
||||||
|
print 'there is no device for emptytest, please check devices!'
|
||||||
|
return 1
|
||||||
print 'empty test start:'
|
print 'empty test start:'
|
||||||
|
print 'device infomation:'
|
||||||
|
if len(arrDevices):
|
||||||
|
logDeviceInfomation()
|
||||||
|
else:
|
||||||
|
print '\tno android device.'
|
||||||
install_info = install_apk()
|
install_info = install_apk()
|
||||||
open_info = open_apk(test_name[gIdx])
|
open_info = open_apk(test_name[gIdx])
|
||||||
info_empty_test['open_info'] = open_info
|
info_empty_test['open_info'] = open_info
|
||||||
|
@ -158,10 +237,15 @@ def main():
|
||||||
socket_info = socket_status(arrDevices[0])
|
socket_info = socket_status(arrDevices[0])
|
||||||
info_empty_test['socket_info'] = socket_info
|
info_empty_test['socket_info'] = socket_info
|
||||||
if install_info:
|
if install_info:
|
||||||
time.sleep(5)
|
time.sleep(run_app_time)
|
||||||
info_uninstall = uninstall_apk(gIdx)
|
info_uninstall = uninstall_apk(gIdx)
|
||||||
print 'info_empty_test:', info_empty_test
|
print 'info_empty_test:', info_empty_test
|
||||||
print 'empty test end'
|
print 'empty test end', empty_test_result
|
||||||
|
if empty_test_result:
|
||||||
|
return 0
|
||||||
|
else:
|
||||||
|
print 'empty_test_result_info:', empty_test_result_info
|
||||||
|
return 1
|
||||||
|
|
||||||
# -------------- main --------------
|
# -------------- main --------------
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
Loading…
Reference in New Issue