示例#1
0
文件: store_01.py 项目: cerbo/scidb
def main(argv=None):
    if argv is None:
        argv = sys.argv

    global _args
    parser = argparse.ArgumentParser(
        description='The store_01 test script.')
    parser.add_argument('-c', '--host', default='localhost',
                        help="The SciDB host address.")
    parser.add_argument('-p', '--port', type=int, default=1239,
                        help="The TCP port for connecting to SciDB.")
    parser.add_argument('-r', '--run-id', default="", help="""
        Uniquifier (such as $HPID) to use in naming files etc.""")
    parser.add_argument('-t', '--use-temp-array', default=False,
                        action='store_true', help="""
        Use a temporary array as the bounded target.""")
    parser.add_argument('-v', '--verbose', default=False, action='store_true',
                        help="""Print timings and full error descriptions.""")
    _args = parser.parse_args(argv[1:])

    t_other_utils.IQUERY_HOST = _args.host
    t_other_utils.IQUERY_PORT = _args.port

    BOUNDED_SCHEMA = "<value:int64>[row=0:499,100,0,col=0:99,100,0]"
    BOUNDED_ARRAY = "bounded_%s" % _args.run_id
    STORE_QUERY = 'store(%s, {0})'.format(BOUNDED_ARRAY)
    # Temp arrays take a different code path where, for historical
    # reasons I guess, the short error code is different.
    # Storing SG takes yet another path. So, we will just ignore the short error.
    # The semantic menaing is in the long error ayway.
    # In verbose mode the entire error string can be examined.
    LONG_ERROR = "SCIDB_LE_CHUNK_OUT_OF_BOUNDARIES"

    print 'Create%s bounded array.' % (
        ' temporary' if _args.use_temp_array else '')
    print iquery(['-aq', 'create%s array %s %s' % (
                ' temp' if _args.use_temp_array else '',
                BOUNDED_ARRAY,
                BOUNDED_SCHEMA)])

    fails = 0
    quiet = not _args.verbose
    if quiet:
        ElapsedTimer.enabled = False

    print '\nEasy store...'
    with ElapsedTimer():
        fails += ok(iquery(['-naq', STORE_QUERY % make_grid(10, 10, 60, 30)]))

    print '\nRight up against the row limit...'
    with ElapsedTimer():
        fails += ok(iquery(['-naq', STORE_QUERY % make_grid(450, 10, 499, 20)]))

    print '\nOne step over the line...'
    with ElapsedTimer():
        fails += fail(iquery(['-naq', STORE_QUERY % make_grid(450, 10, 500, 20)]),
                      LONG_ERROR,
                      quiet)

    print '\nWay over the line...'
    with ElapsedTimer():
        fails += fail(iquery(['-naq', STORE_QUERY % make_grid(480, 10, 520, 20)]),
                      LONG_ERROR,
                      quiet)

    print '\nRight up against the column limit...'
    with ElapsedTimer():
        fails += ok(iquery(['-naq', STORE_QUERY % make_grid(10, 80, 50, 99)]))

    print '\nOne step over the column limit...'
    with ElapsedTimer():
        fails += fail(iquery(['-naq', STORE_QUERY % make_grid(10, 80, 50, 100)]),
                      LONG_ERROR,
                      quiet)

    print '\nPartially over both limits...'
    with ElapsedTimer():
        fails += fail(iquery(['-naq', STORE_QUERY % make_grid(480, 95, 500, 100)]),
                      LONG_ERROR,
                      quiet)

    print '\nWay over both limits...'
    with ElapsedTimer():
        fails += fail(iquery(['-naq', STORE_QUERY % make_grid(510, 120, 530, 140)]),
                      LONG_ERROR,
                      quiet)

    print "\nCleanup."
    with ElapsedTimer():
        iquery(['-naq', 'remove(%s)' % BOUNDED_ARRAY])

    if fails:
        print fails, "test case failures"
    else:
        print "All test cases passed."

    # By returning 0 even for failure, we prefer a FILES_DIFFER error
    # to an EXECUTOR_FAILED error.  Seems slightly more accurate.
    return 0
示例#2
0
def main(argv=None):
    if argv is None:
        argv = sys.argv

    global _args
    parser = argparse.ArgumentParser(description='The insert_09 test script.')
    parser.add_argument('-c',
                        '--host',
                        default='localhost',
                        help="The SciDB host address.")
    parser.add_argument('-p',
                        '--port',
                        type=int,
                        default=1239,
                        help="The TCP port for connecting to SciDB.")
    parser.add_argument('-r',
                        '--run-id',
                        default="",
                        help="""
        Uniquifier (such as $HPID) to use in naming files etc.""")
    _args = parser.parse_args(argv[1:])

    t_other_utils.IQUERY_HOST = _args.host
    t_other_utils.IQUERY_PORT = _args.port

    BOUNDED_SCHEMA = "<value:int64>[row=0:499,100,0,col=0:99,100,0]"
    BOUNDED_ARRAY = "bounded_%s" % _args.run_id

    print 'Create bounded array.'
    print iquery(
        ['-aq', 'create array %s %s' % (BOUNDED_ARRAY, BOUNDED_SCHEMA)])
    INSERT_QUERY = 'insert(%s, {0})'.format(BOUNDED_ARRAY)

    fails = 0

    print '\nEasy insert...'
    fails += ok(iquery(['-naq', INSERT_QUERY % make_grid(10, 10, 60, 30)]))

    print '\nRight up against the row limit...'
    fails += ok(iquery(['-naq', INSERT_QUERY % make_grid(450, 10, 499, 20)]))

    print '\nOne step over the line...'
    fails += fail(iquery(['-naq', INSERT_QUERY % make_grid(450, 10, 500, 20)]),
                  "SCIDB_SE_OPERATOR::SCIDB_LE_CHUNK_OUT_OF_BOUNDARIES")

    print '\nWay over the line...'
    fails += fail(iquery(['-naq', INSERT_QUERY % make_grid(480, 10, 520, 20)]),
                  "SCIDB_SE_OPERATOR::SCIDB_LE_CHUNK_OUT_OF_BOUNDARIES")

    print '\nRight up against the column limit...'
    fails += ok(iquery(['-naq', INSERT_QUERY % make_grid(10, 80, 50, 99)]))

    print '\nOne step over the column limit...'
    fails += fail(iquery(['-naq', INSERT_QUERY % make_grid(10, 80, 50, 100)]),
                  "SCIDB_SE_OPERATOR::SCIDB_LE_CHUNK_OUT_OF_BOUNDARIES")

    print '\nPartially over both limits...'
    fails += fail(
        iquery(['-naq', INSERT_QUERY % make_grid(480, 95, 500, 100)]),
        "SCIDB_SE_OPERATOR::SCIDB_LE_CHUNK_OUT_OF_BOUNDARIES")

    print '\nWay over both limits...'
    fails += fail(
        iquery(['-naq', INSERT_QUERY % make_grid(510, 120, 530, 140)]),
        "SCIDB_SE_OPERATOR::SCIDB_LE_CHUNK_OUT_OF_BOUNDARIES")

    print '\nCleanup.'
    iquery(['-naq', 'remove(%s)' % BOUNDED_ARRAY])

    if fails:
        print fails, "test case failures"
    else:
        print "All test cases passed."

    # By returning 0 even for failure, we prefer a FILES_DIFFER error
    # to an EXECUTOR_FAILED error.  Seems slightly more accurate.
    return 0
示例#3
0
文件: insert_09.py 项目: cerbo/scidb
def main(argv=None):
    if argv is None:
        argv = sys.argv

    global _args
    parser = argparse.ArgumentParser(
        description='The insert_09 test script.')
    parser.add_argument('-c', '--host', default='localhost',
                        help="The SciDB host address.")
    parser.add_argument('-p', '--port', type=int, default=1239,
                        help="The TCP port for connecting to SciDB.")
    parser.add_argument('-r', '--run-id', default="", help="""
        Uniquifier (such as $HPID) to use in naming files etc.""")
    _args = parser.parse_args(argv[1:])

    t_other_utils.IQUERY_HOST = _args.host
    t_other_utils.IQUERY_PORT = _args.port

    BOUNDED_SCHEMA = "<value:int64>[row=0:499,100,0,col=0:99,100,0]"
    BOUNDED_ARRAY = "bounded_%s" % _args.run_id

    print 'Create bounded array.'
    print iquery(['-aq', 'create array %s %s' % (BOUNDED_ARRAY,BOUNDED_SCHEMA)])
    INSERT_QUERY = 'insert(%s, {0})'.format(BOUNDED_ARRAY)

    fails = 0

    print '\nEasy insert...'
    fails += ok(iquery(['-naq', INSERT_QUERY % make_grid(10, 10, 60, 30)]))

    print '\nRight up against the row limit...'
    fails += ok(iquery(['-naq', INSERT_QUERY % make_grid(450, 10, 499, 20)]))

    print '\nOne step over the line...'
    fails += fail(iquery(['-naq', INSERT_QUERY % make_grid(450, 10, 500, 20)]),
                  "SCIDB_SE_OPERATOR::SCIDB_LE_CHUNK_OUT_OF_BOUNDARIES")

    print '\nWay over the line...'
    fails += fail(iquery(['-naq', INSERT_QUERY % make_grid(480, 10, 520, 20)]),
                  "SCIDB_SE_OPERATOR::SCIDB_LE_CHUNK_OUT_OF_BOUNDARIES")

    print '\nRight up against the column limit...'
    fails += ok(iquery(['-naq', INSERT_QUERY % make_grid(10, 80, 50, 99)]))

    print '\nOne step over the column limit...'
    fails += fail(iquery(['-naq', INSERT_QUERY % make_grid(10, 80, 50, 100)]),
                  "SCIDB_SE_OPERATOR::SCIDB_LE_CHUNK_OUT_OF_BOUNDARIES")

    print '\nPartially over both limits...'
    fails += fail(iquery(['-naq', INSERT_QUERY % make_grid(480, 95, 500, 100)]),
                  "SCIDB_SE_OPERATOR::SCIDB_LE_CHUNK_OUT_OF_BOUNDARIES")

    print '\nWay over both limits...'
    fails += fail(iquery(['-naq', INSERT_QUERY % make_grid(510, 120, 530, 140)]),
                  "SCIDB_SE_OPERATOR::SCIDB_LE_CHUNK_OUT_OF_BOUNDARIES")

    print '\nCleanup.'
    iquery(['-naq', 'remove(%s)' % BOUNDED_ARRAY])

    if fails:
        print fails, "test case failures"
    else:
        print "All test cases passed."

    # By returning 0 even for failure, we prefer a FILES_DIFFER error
    # to an EXECUTOR_FAILED error.  Seems slightly more accurate.
    return 0
示例#4
0
def main(argv=None):
    if argv is None:
        argv = sys.argv

    global _args
    parser = argparse.ArgumentParser(description='The store_01 test script.')
    parser.add_argument('-c',
                        '--host',
                        default='localhost',
                        help="The SciDB host address.")
    parser.add_argument('-p',
                        '--port',
                        type=int,
                        default=1239,
                        help="The TCP port for connecting to SciDB.")
    parser.add_argument('-r',
                        '--run-id',
                        default="",
                        help="""
        Uniquifier (such as $HPID) to use in naming files etc.""")
    parser.add_argument('-t',
                        '--use-temp-array',
                        default=False,
                        action='store_true',
                        help="""
        Use a temporary array as the bounded target.""")
    parser.add_argument('-v',
                        '--verbose',
                        default=False,
                        action='store_true',
                        help="""Print timings and full error descriptions.""")
    _args = parser.parse_args(argv[1:])

    t_other_utils.IQUERY_HOST = _args.host
    t_other_utils.IQUERY_PORT = _args.port

    BOUNDED_SCHEMA = "<value:int64>[row=0:499,100,0,col=0:99,100,0]"
    BOUNDED_ARRAY = "bounded_%s" % _args.run_id
    STORE_QUERY = 'store(%s, {0})'.format(BOUNDED_ARRAY)
    # Temp arrays take a different code path where, for historical
    # reasons I guess, the short error code is different.
    # Storing SG takes yet another path. So, we will just ignore the short error.
    # The semantic menaing is in the long error ayway.
    # In verbose mode the entire error string can be examined.
    LONG_ERROR = "SCIDB_LE_CHUNK_OUT_OF_BOUNDARIES"

    print 'Create%s bounded array.' % (' temporary'
                                       if _args.use_temp_array else '')
    print iquery([
        '-aq',
        'create%s array %s %s' % (' temp' if _args.use_temp_array else '',
                                  BOUNDED_ARRAY, BOUNDED_SCHEMA)
    ])

    fails = 0
    quiet = not _args.verbose
    if quiet:
        ElapsedTimer.enabled = False

    print '\nEasy store...'
    with ElapsedTimer():
        fails += ok(iquery(['-naq', STORE_QUERY % make_grid(10, 10, 60, 30)]))

    print '\nRight up against the row limit...'
    with ElapsedTimer():
        fails += ok(iquery(['-naq',
                            STORE_QUERY % make_grid(450, 10, 499, 20)]))

    print '\nOne step over the line...'
    with ElapsedTimer():
        fails += fail(
            iquery(['-naq', STORE_QUERY % make_grid(450, 10, 500, 20)]),
            LONG_ERROR, quiet)

    print '\nWay over the line...'
    with ElapsedTimer():
        fails += fail(
            iquery(['-naq', STORE_QUERY % make_grid(480, 10, 520, 20)]),
            LONG_ERROR, quiet)

    print '\nRight up against the column limit...'
    with ElapsedTimer():
        fails += ok(iquery(['-naq', STORE_QUERY % make_grid(10, 80, 50, 99)]))

    print '\nOne step over the column limit...'
    with ElapsedTimer():
        fails += fail(
            iquery(['-naq', STORE_QUERY % make_grid(10, 80, 50, 100)]),
            LONG_ERROR, quiet)

    print '\nPartially over both limits...'
    with ElapsedTimer():
        fails += fail(
            iquery(['-naq', STORE_QUERY % make_grid(480, 95, 500, 100)]),
            LONG_ERROR, quiet)

    print '\nWay over both limits...'
    with ElapsedTimer():
        fails += fail(
            iquery(['-naq', STORE_QUERY % make_grid(510, 120, 530, 140)]),
            LONG_ERROR, quiet)

    print "\nCleanup."
    with ElapsedTimer():
        iquery(['-naq', 'remove(%s)' % BOUNDED_ARRAY])

    if fails:
        print fails, "test case failures"
    else:
        print "All test cases passed."

    # By returning 0 even for failure, we prefer a FILES_DIFFER error
    # to an EXECUTOR_FAILED error.  Seems slightly more accurate.
    return 0