expose more info if case failed.
This commit is contained in:
parent
46a7c3c912
commit
c4eed9ec69
|
@ -64,7 +64,7 @@ matrix:
|
||||||
memError=`grep -m 1 'ERROR SUMMARY' mem-error-out.txt | awk '{print $4}'`
|
memError=`grep -m 1 'ERROR SUMMARY' mem-error-out.txt | awk '{print $4}'`
|
||||||
|
|
||||||
if [ -n "$memError" ]; then
|
if [ -n "$memError" ]; then
|
||||||
if [ "$memError" -gt 16 ] && [ "$defiMemError" -gt 0 ]; then
|
if [ "$memError" -gt 16 ] || [ "$defiMemError" -gt 0 ]; then
|
||||||
echo -e "${RED} ## Memory errors number valgrind reports is $memError.\
|
echo -e "${RED} ## Memory errors number valgrind reports is $memError.\
|
||||||
Definitely lost is $defiMemError. More than our threshold! ## ${NC}"
|
Definitely lost is $defiMemError. More than our threshold! ## ${NC}"
|
||||||
travis_terminate $memError
|
travis_terminate $memError
|
||||||
|
|
|
@ -0,0 +1,147 @@
|
||||||
|
###################################################################
|
||||||
|
# Copyright (c) 2016 by TAOS Technologies, Inc.
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# This file is proprietary and confidential to TAOS Technologies.
|
||||||
|
# No part of this file may be reproduced, stored, transmitted,
|
||||||
|
# disclosed or used in any form or by any means other than as
|
||||||
|
# expressly provided by the written permission from Jianhui Tao
|
||||||
|
#
|
||||||
|
###################################################################
|
||||||
|
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
import taos
|
||||||
|
|
||||||
|
from util.log import *
|
||||||
|
from util.cases import *
|
||||||
|
from util.sql import *
|
||||||
|
|
||||||
|
|
||||||
|
class TDTestCase:
|
||||||
|
def init(self, conn):
|
||||||
|
tdLog.debug("start to execute %s" % __file__)
|
||||||
|
tdSql.init(conn.cursor())
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
tdSql.prepare()
|
||||||
|
|
||||||
|
tdLog.info("=============== step1")
|
||||||
|
cmd = 'create table tb (ts timestamp, speed float)'
|
||||||
|
tdLog.info(cmd)
|
||||||
|
tdSql.execute(cmd)
|
||||||
|
cmd = 'insert into tb values (now, -3.40E+38)'
|
||||||
|
tdLog.info(cmd)
|
||||||
|
tdSql.execute(cmd)
|
||||||
|
|
||||||
|
tdLog.info("=============== step2")
|
||||||
|
cmd = 'insert into tb values (now+1a, 3.40E+308)'
|
||||||
|
tdLog.info(cmd)
|
||||||
|
try:
|
||||||
|
tdSql.execute(cmd)
|
||||||
|
tdLog.exit(
|
||||||
|
"This test failed: insert wrong data error _not_ catched")
|
||||||
|
except Exception as e:
|
||||||
|
tdLog.info(repr(e))
|
||||||
|
tdLog.notice("insert wrong data error catched")
|
||||||
|
|
||||||
|
cmd = 'select * from tb order by ts desc'
|
||||||
|
tdLog.info(cmd)
|
||||||
|
tdSql.query(cmd)
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
|
||||||
|
tdLog.info("=============== step3")
|
||||||
|
cmd = "insert into tb values (now+2a, 2.85)"
|
||||||
|
tdLog.info(cmd)
|
||||||
|
tdSql.execute(cmd)
|
||||||
|
cmd = "select * from tb order by ts desc"
|
||||||
|
tdLog.info(cmd)
|
||||||
|
ret = tdSql.query(cmd)
|
||||||
|
tdSql.checkRows(2)
|
||||||
|
|
||||||
|
if ((abs(tdSql.getData(0, 1) - 2.850000)) > 1.0e-7):
|
||||||
|
tdLog.exit("data is not 2.850000")
|
||||||
|
|
||||||
|
tdLog.info("=============== step4")
|
||||||
|
cmd = "insert into tb values (now+3a, 3.4)"
|
||||||
|
tdLog.info(cmd)
|
||||||
|
tdSql.execute(cmd)
|
||||||
|
cmd = "select * from tb order by ts desc"
|
||||||
|
tdLog.info(cmd)
|
||||||
|
tdSql.query(cmd)
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
if (abs(tdSql.getData(0, 1) - 3.400000) > 1.0e-7):
|
||||||
|
tdLog.exit("data is not 3.400000")
|
||||||
|
|
||||||
|
tdLog.info("=============== step5")
|
||||||
|
cmd = "insert into tb values (now+4a, a2)"
|
||||||
|
tdLog.info(cmd)
|
||||||
|
try:
|
||||||
|
tdSql.execute(cmd)
|
||||||
|
tdLog.exit("This test failed: \
|
||||||
|
insert wrong data error _not_ catched")
|
||||||
|
except Exception as e:
|
||||||
|
tdLog.info(repr(e))
|
||||||
|
tdLog.notice("insert wrong data error catched")
|
||||||
|
|
||||||
|
cmd = "insert into tb values (now+4a, 0)"
|
||||||
|
tdLog.info(cmd)
|
||||||
|
tdSql.execute(cmd)
|
||||||
|
cmd = "select * from tb order by ts desc"
|
||||||
|
tdLog.info(cmd)
|
||||||
|
tdSql.query(cmd)
|
||||||
|
tdSql.checkRows(4)
|
||||||
|
if (abs(tdSql.getData(0, 1) - 0.000000) != 0):
|
||||||
|
tdLog.exit("data is not 0.000000")
|
||||||
|
|
||||||
|
tdLog.info("=============== step6")
|
||||||
|
cmd = "insert into tb values (now+5a, 2a)"
|
||||||
|
tdLog.info(cmd)
|
||||||
|
try:
|
||||||
|
tdSql.execute(cmd)
|
||||||
|
tdLog.exit(
|
||||||
|
"This test failed: insert wrong data error _not_ catched")
|
||||||
|
except Exception as e:
|
||||||
|
tdLog.info(repr(e))
|
||||||
|
tdLog.notice("insert wrong data error catched")
|
||||||
|
|
||||||
|
cmd = "insert into tb values (now+5a, 2)"
|
||||||
|
tdLog.info(cmd)
|
||||||
|
tdSql.execute(cmd)
|
||||||
|
cmd = "select * from tb order by ts desc"
|
||||||
|
tdLog.info(cmd)
|
||||||
|
ret = tdSql.query(cmd)
|
||||||
|
tdSql.checkRows(5)
|
||||||
|
if (abs(tdSql.getData(0, 1) - 2.000000) > 1.0e-7):
|
||||||
|
tdLog.info("data is not 2.000000")
|
||||||
|
|
||||||
|
tdLog.info("=============== step7")
|
||||||
|
cmd = "insert into tb values (now+6a, 2a'1)"
|
||||||
|
tdLog.info(cmd)
|
||||||
|
try:
|
||||||
|
tdSql.execute(cmd)
|
||||||
|
tdLog.exit(
|
||||||
|
"This test failed: insert wrong data error _not_ catched")
|
||||||
|
except Exception as e:
|
||||||
|
tdLog.info(repr(e))
|
||||||
|
tdLog.notice("insert wrong data error catched")
|
||||||
|
|
||||||
|
cmd = "insert into tb values (now+6a, 2)"
|
||||||
|
tdLog.info(cmd)
|
||||||
|
tdSql.execute(cmd)
|
||||||
|
cmd = "select * from tb order by ts desc"
|
||||||
|
tdLog.info(cmd)
|
||||||
|
tdSql.query(cmd)
|
||||||
|
if (abs(tdSql.getData(0, 1) - 2.000000) > 1.0e-7):
|
||||||
|
tdLog.exit("data is not 2.000000")
|
||||||
|
|
||||||
|
def stop(self):
|
||||||
|
tdSql.close()
|
||||||
|
tdLog.success("%s successfully executed" % __file__)
|
||||||
|
|
||||||
|
|
||||||
|
tdCases.addWindows(__file__, TDTestCase())
|
||||||
|
tdCases.addLinux(__file__, TDTestCase())
|
|
@ -0,0 +1,184 @@
|
||||||
|
###################################################################
|
||||||
|
# Copyright (c) 2016 by TAOS Technologies, Inc.
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# This file is proprietary and confidential to TAOS Technologies.
|
||||||
|
# No part of this file may be reproduced, stored, transmitted,
|
||||||
|
# disclosed or used in any form or by any means other than as
|
||||||
|
# expressly provided by the written permission from Jianhui Tao
|
||||||
|
#
|
||||||
|
###################################################################
|
||||||
|
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import taos
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
from util.log import *
|
||||||
|
from util.cases import *
|
||||||
|
from util.sql import *
|
||||||
|
|
||||||
|
|
||||||
|
class TDTestCase:
|
||||||
|
def init(self, conn):
|
||||||
|
tdLog.debug("start to execute %s" % __file__)
|
||||||
|
tdSql.init(conn.cursor())
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
tdSql.prepare()
|
||||||
|
|
||||||
|
tdLog.info("=============== step1")
|
||||||
|
tdSql.execute('create table tb (ts timestamp, speed int)')
|
||||||
|
|
||||||
|
cmd = 'insert into tb values (now, NULL)'
|
||||||
|
tdLog.info(cmd)
|
||||||
|
tdSql.execute(cmd)
|
||||||
|
tdSql.query('select * from tb order by ts desc')
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
if(tdSql.getData(0, 1) is not None):
|
||||||
|
tdLog.exit("data is not NULL")
|
||||||
|
|
||||||
|
tdLog.info("=============== step2")
|
||||||
|
cmd = 'insert into tb values (now+1m, -2147483648)'
|
||||||
|
tdLog.info(cmd)
|
||||||
|
try:
|
||||||
|
tdSql.execute(cmd)
|
||||||
|
tdLog.exit(
|
||||||
|
"This test failed: INT data overflow error _not_ catched")
|
||||||
|
except Exception as e:
|
||||||
|
tdLog.info(repr(e))
|
||||||
|
tdLog.notice("INT data overflow error catched")
|
||||||
|
|
||||||
|
cmd = 'insert into tb values (now+1m, NULL)'
|
||||||
|
tdLog.info(cmd)
|
||||||
|
tdSql.execute(cmd)
|
||||||
|
tdSql.query('select * from tb order by ts desc')
|
||||||
|
tdSql.checkRows(2)
|
||||||
|
|
||||||
|
if(tdSql.getData(0, 1) is not None):
|
||||||
|
tdLog.exit("data is not NULL")
|
||||||
|
|
||||||
|
tdLog.info("=============== step3")
|
||||||
|
cmd = 'insert into tb values (now+2m, 2147483647)'
|
||||||
|
tdLog.info(cmd)
|
||||||
|
tdSql.execute(cmd)
|
||||||
|
tdSql.query('select * from tb order by ts desc')
|
||||||
|
tdSql.checkRows(3)
|
||||||
|
if(tdSql.getData(0, 1) != 2147483647):
|
||||||
|
tdLog.exit("data is not 2147483647")
|
||||||
|
|
||||||
|
tdLog.info("=============== step4")
|
||||||
|
cmd = 'insert into tb values (now+3m, 2147483648)'
|
||||||
|
tdLog.info(cmd)
|
||||||
|
try:
|
||||||
|
tdSql.execute(cmd)
|
||||||
|
tdLog.exit(
|
||||||
|
"This test failed: INT data overflow error _not_ catched")
|
||||||
|
except Exception as e:
|
||||||
|
tdLog.info(repr(e))
|
||||||
|
tdLog.notice("INT data overflow error catched")
|
||||||
|
|
||||||
|
cmd = 'insert into tb values (now+3m, NULL)'
|
||||||
|
tdLog.info(cmd)
|
||||||
|
tdSql.execute(cmd)
|
||||||
|
tdSql.query('select * from tb order by ts desc')
|
||||||
|
tdSql.checkRows(4)
|
||||||
|
|
||||||
|
if(tdSql.getData(0, 1) is not None):
|
||||||
|
tdLog.exit("data is not NULL")
|
||||||
|
|
||||||
|
tdLog.info("=============== step5")
|
||||||
|
cmd = 'insert into tb values (now+4m, a2)'
|
||||||
|
tdLog.info(cmd)
|
||||||
|
try:
|
||||||
|
tdSql.execute(cmd)
|
||||||
|
tdLog.exit(
|
||||||
|
"This test failed: insert wrong data error _not_ catched")
|
||||||
|
except Exception as e:
|
||||||
|
tdLog.info(repr(e))
|
||||||
|
tdLog.notice("insert wrong data error catched")
|
||||||
|
|
||||||
|
cmd = 'insert into tb values (now+4m, 0)'
|
||||||
|
tdLog.info(cmd)
|
||||||
|
tdSql.execute(cmd)
|
||||||
|
tdSql.query('select * from tb order by ts desc')
|
||||||
|
tdSql.checkRows(5)
|
||||||
|
|
||||||
|
if(tdSql.getData(0, 1) != 0):
|
||||||
|
tdLog.exit("data is not 0")
|
||||||
|
|
||||||
|
tdLog.info("=============== step6")
|
||||||
|
cmd = 'insert into tb values (now+5m, 2a)'
|
||||||
|
tdLog.info(cmd)
|
||||||
|
try:
|
||||||
|
tdSql.execute(cmd)
|
||||||
|
tdLog.exit(
|
||||||
|
"This test failed: insert wrong data error _not_ catched")
|
||||||
|
except Exception as e:
|
||||||
|
tdLog.info(repr(e))
|
||||||
|
tdLog.notice("insert wrong data error catched")
|
||||||
|
|
||||||
|
cmd = 'insert into tb values (now+5m, 2)'
|
||||||
|
tdLog.info(cmd)
|
||||||
|
tdSql.execute(cmd)
|
||||||
|
tdSql.query('select * from tb order by ts desc')
|
||||||
|
tdSql.checkRows(6)
|
||||||
|
if (tdSql.getData(0, 1) != 2):
|
||||||
|
tdLog.exit("data is not 2")
|
||||||
|
|
||||||
|
tdLog.info("=============== step7")
|
||||||
|
cmd = "insert into tb values (now+6m, 2a'1)"
|
||||||
|
tdLog.info(cmd)
|
||||||
|
try:
|
||||||
|
tdSql.execute(cmd)
|
||||||
|
tdLog.exit(
|
||||||
|
"This test failed: insert wrong data error _not_ catched")
|
||||||
|
except Exception as e:
|
||||||
|
tdLog.info(repr(e))
|
||||||
|
tdLog.notice("insert wrong data error catched")
|
||||||
|
|
||||||
|
cmd = 'insert into tb values (now+6m, 2)'
|
||||||
|
tdLog.info(cmd)
|
||||||
|
tdSql.execute(cmd)
|
||||||
|
tdSql.query('select * from tb order by ts desc')
|
||||||
|
tdSql.checkRows(7)
|
||||||
|
if (tdSql.getData(0, 1) != 2):
|
||||||
|
tdLog.exit("data is not 2")
|
||||||
|
|
||||||
|
tdLog.info("=============== step8")
|
||||||
|
cmd = 'insert into tb values (now+8m, "null")'
|
||||||
|
tdLog.info(cmd)
|
||||||
|
tdSql.execute(cmd)
|
||||||
|
tdSql.query('select * from tb order by ts desc')
|
||||||
|
tdSql.checkRows(8)
|
||||||
|
|
||||||
|
if (tdSql.getData(0, 1) is not None):
|
||||||
|
tdLog.exit("data is not null")
|
||||||
|
|
||||||
|
tdLog.info("=============== step9")
|
||||||
|
cmd = "insert into tb values (now+9m, 'null')"
|
||||||
|
tdLog.info(cmd)
|
||||||
|
tdSql.execute(cmd)
|
||||||
|
tdSql.query('select * from tb order by ts desc')
|
||||||
|
tdSql.checkRows(9)
|
||||||
|
if (tdSql.getData(0, 1) is not None):
|
||||||
|
tdLog.exit("data is not null")
|
||||||
|
|
||||||
|
tdLog.info("=============== step10")
|
||||||
|
cmd = 'insert into tb values (now+10m, -123)'
|
||||||
|
tdLog.info(cmd)
|
||||||
|
tdSql.execute(cmd)
|
||||||
|
tdSql.query('select * from tb order by ts desc')
|
||||||
|
tdSql.checkRows(10)
|
||||||
|
|
||||||
|
if (tdSql.getData(0, 1) != -123):
|
||||||
|
tdLog.exit("data is not -123")
|
||||||
|
|
||||||
|
def stop(self):
|
||||||
|
tdSql.close()
|
||||||
|
tdLog.success("%s successfully executed" % __file__)
|
||||||
|
|
||||||
|
|
||||||
|
tdCases.addWindows(__file__, TDTestCase())
|
||||||
|
tdCases.addLinux(__file__, TDTestCase())
|
|
@ -105,10 +105,7 @@ if __name__ == "__main__":
|
||||||
if fileName == "all":
|
if fileName == "all":
|
||||||
tdCases.runAllLinux(conn)
|
tdCases.runAllLinux(conn)
|
||||||
else:
|
else:
|
||||||
try:
|
|
||||||
tdCases.runOneLinux(conn, fileName)
|
tdCases.runOneLinux(conn, fileName)
|
||||||
except Exception as e:
|
|
||||||
tdLog.exit("failed: %s" % fileName)
|
|
||||||
conn.close()
|
conn.close()
|
||||||
else:
|
else:
|
||||||
tdLog.notice("Procedures for tdengine deployed in %s" % (masterIp))
|
tdLog.notice("Procedures for tdengine deployed in %s" % (masterIp))
|
||||||
|
|
|
@ -71,7 +71,7 @@ class TDCases:
|
||||||
case.run()
|
case.run()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
tdLog.notice(repr(e))
|
tdLog.notice(repr(e))
|
||||||
tdLog.exit("failed: %s" % fileName)
|
tdLog.notice("%s failed: %s" % (__file__, fileName))
|
||||||
case.stop()
|
case.stop()
|
||||||
runNum += 1
|
runNum += 1
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -25,15 +25,17 @@ if [ "$totalFailed" -ne "0" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd ../pytest
|
cd ../pytest
|
||||||
./simpletest.sh 2>&1 | grep 'successfully executed\|failed' | tee pytest-out.txt
|
./simpletest.sh 2>&1 | tee pytest-out.txt
|
||||||
totalPySuccess=`grep 'successfully executed' pytest-out.txt | wc -l`
|
totalPySuccess=`grep 'successfully executed' pytest-out.txt | wc -l`
|
||||||
|
|
||||||
if [ "$totalPySuccess" -gt "0" ]; then
|
if [ "$totalPySuccess" -gt "0" ]; then
|
||||||
|
grep 'successfully executed' pytest-out.txt
|
||||||
echo -e "${GREEN} ### Total $totalPySuccess python case(s) succeed! ### ${NC}"
|
echo -e "${GREEN} ### Total $totalPySuccess python case(s) succeed! ### ${NC}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
totalPyFailed=`grep 'failed' pytest-out.txt | wc -l`
|
totalPyFailed=`grep 'failed\|fault' pytest-out.txt | wc -l`
|
||||||
if [ "$totalPyFailed" -ne "0" ]; then
|
if [ "$totalPyFailed" -ne "0" ]; then
|
||||||
|
cat pytest-out.txt
|
||||||
echo -e "${RED} ### Total $totalPyFailed python case(s) failed! ### ${NC}"
|
echo -e "${RED} ### Total $totalPyFailed python case(s) failed! ### ${NC}"
|
||||||
exit $totalPyFailed
|
exit $totalPyFailed
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue