当前位置: 首页>>代码示例>>Python>>正文


Python testutils.run_cmd函数代码示例

本文整理汇总了Python中testutils.run_cmd函数的典型用法代码示例。如果您正苦于以下问题:Python run_cmd函数的具体用法?Python run_cmd怎么用?Python run_cmd使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了run_cmd函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_schedctl_combo_1

def test_schedctl_combo_1():
    """
    schedctl test run: combo_1

        Command Output:
        
        Command Error/Debug:Option combinations not allowed with: start option(s)
        
        
    """

    args      = """--start --stop"""
    exp_rs    = 256

    user    = pwd.getpwuid(os.getuid())[0] 
    _args   = args.replace('<USER>',user)

    results = testutils.run_cmd('schedctl.py',_args,None) 
    rs      = results[0]
    cmd_out = results[1]
    cmd_err = results[3]

    # Test Pass Criterias
    no_rs_err     = (rs == exp_rs)
    no_fatal_exc  = (cmd_out.find("FATAL EXCEPTION") == -1)

    result = no_rs_err and no_fatal_exc

    errmsg  = "\n\nFailed Data:\n\n" \
        "Return Status %s, Expected Return Status %s\n\n" \
        "Command Output:\n%s\n\n" \
        "Command Error:\n%s\n\n" \
        "Arguments: %s" % (str(rs), str(exp_rs), str(cmd_out), str(cmd_err), _args)

    assert result, errmsg
开发者ID:benmcclelland,项目名称:cobalt-orcm,代码行数:35,代码来源:schedctl_sanity_test.py

示例2: test_releaseres_version

def test_releaseres_version():
    """
    releaseres test run: version

    """

    args      = """--version"""

    cmdout    = \
"""version: "releaseres.py " + $Id: releaseres.py 2146 2011-04-29 16:19:22Z richp $ + , Cobalt  + $Version$
"""

    cmderr    = ''

    stubout   = ''

    stubout_file = "stub.out"

    expected_results = ( 
                       0, # Expected return status 
                       cmdout, # Expected command output
                       stubout, # Expected stub functions output
                       cmderr, # Expected command error output 
                       ) 

    testutils.save_testhook("")

    results = testutils.run_cmd('releaseres.py',args,stubout_file) 
    result  = testutils.validate_results(results,expected_results)

    testutils.remove_testhook()

    correct = 1
    assert result == correct, "Result:\n%s" % result
开发者ID:benmcclelland,项目名称:cobalt-orcm,代码行数:34,代码来源:releaseres_test.py

示例3: test_qdel_jobid_1

def test_qdel_jobid_1():
    """
    qdel test run: jobid_1

        Command Output:
        
        Command Error/Debug:jobid must be an integer: myq
        
        
    """

    args      = """myq 1 2 3 4"""
    exp_rs    = 256

    user    = pwd.getpwuid(os.getuid())[0] 
    _args   = args.replace('<USER>',user)

    results = testutils.run_cmd('qdel.py',_args,None) 
    rs      = results[0]
    cmd_out = results[1]
    cmd_err = results[3]

    # Test Pass Criterias
    no_rs_err     = (rs == exp_rs)
    no_fatal_exc  = (cmd_out.find("FATAL EXCEPTION") == -1)

    result = no_rs_err and no_fatal_exc

    errmsg  = "\n\nFailed Data:\n\n" \
        "Return Status %s, Expected Return Status %s\n\n" \
        "Command Output:\n%s\n\n" \
        "Command Error:\n%s\n\n" \
        "Arguments: %s" % (str(rs), str(exp_rs), str(cmd_out), str(cmd_err), _args)

    assert result, errmsg
开发者ID:benmcclelland,项目名称:cobalt-orcm,代码行数:35,代码来源:qdel_sanity_test.py

示例4: test_partlist_argument_1

def test_partlist_argument_1():
    """
    partlist test run: argument_1

    """

    args      = """arg"""

    cmdout    = ''

    cmderr    = \
"""No arguments required
"""

    stubout   = ''

    stubout_file = "stub.out"

    expected_results = ( 
                       256, # Expected return status 
                       cmdout, # Expected command output
                       stubout, # Expected stub functions output
                       cmderr, # Expected command error output 
                       ) 

    testutils.save_testhook("")

    results = testutils.run_cmd('partlist.py',args,stubout_file) 
    result  = testutils.validate_results(results,expected_results)

    testutils.remove_testhook()

    correct = 1
    assert result == correct, "Result:\n%s" % result
开发者ID:benmcclelland,项目名称:cobalt-orcm,代码行数:34,代码来源:partlist_test.py

示例5: test_qmove_queue_1

def test_qmove_queue_1():
    """
    qmove test run: queue_1

        Command Output:
        
        Command Error/Debug:Failed to match any jobs or queues
        
        
    """

    args      = """myq 1 2 3"""
    exp_rs    = 0

    user    = pwd.getpwuid(os.getuid())[0] 
    _args   = args.replace('<USER>',user)

    results = testutils.run_cmd('qmove.py',_args,None) 
    rs      = results[0]
    cmd_out = results[1]
    cmd_err = results[3]

    # Test Pass Criterias
    no_rs_err     = (rs == exp_rs)
    no_fatal_exc  = (cmd_out.find("FATAL EXCEPTION") == -1)

    result = no_rs_err and no_fatal_exc

    errmsg  = "\n\nFailed Data:\n\n" \
        "Return Status %s, Expected Return Status %s\n\n" \
        "Command Output:\n%s\n\n" \
        "Command Error:\n%s\n\n" \
        "Arguments: %s" % (str(rs), str(exp_rs), str(cmd_out), str(cmd_err), _args)

    assert result, errmsg
开发者ID:benmcclelland,项目名称:cobalt-orcm,代码行数:35,代码来源:qmove_sanity_test.py

示例6: test_qsub_invalid_geometry_6

def test_qsub_invalid_geometry_6():
    """
    qsub test run: invalid_geometry_6

        Command Output:
        23
        
        Command Error/Debug:
        
    """

    args      = """--mode script -t50 -n10 --geometry 128x64x32x4    /bin/ls"""
    exp_rs    = 0

    user    = pwd.getpwuid(os.getuid())[0] 
    _args   = args.replace('<USER>',user)

    results = testutils.run_cmd('qsub.py',_args,None) 
    rs      = results[0]
    cmd_out = results[1]
    cmd_err = results[3]

    # Test Pass Criterias
    no_rs_err     = (rs == exp_rs)
    no_fatal_exc  = (cmd_out.find("FATAL EXCEPTION") == -1)

    result = no_rs_err and no_fatal_exc

    errmsg  = "\n\nFailed Data:\n\n" \
        "Return Status %s, Expected Return Status %s\n\n" \
        "Command Output:\n%s\n\n" \
        "Command Error:\n%s\n\n" \
        "Arguments: %s" % (str(rs), str(exp_rs), str(cmd_out), str(cmd_err), _args)

    assert result, errmsg
开发者ID:benmcclelland,项目名称:cobalt-orcm,代码行数:35,代码来源:qsub_sanity_test.py

示例7: test_qsub_cwd_option_5

def test_qsub_cwd_option_5():
    """
    qsub test run: cwd_option_5

        Command Output:
        32
        
        Command Error/Debug:
        
    """

    args      = """--cwd /tmp -t10 -n 10 -e p -o x /bin/ls"""
    exp_rs    = 0

    user    = pwd.getpwuid(os.getuid())[0] 
    _args   = args.replace('<USER>',user)

    results = testutils.run_cmd('qsub.py',_args,None) 
    rs      = results[0]
    cmd_out = results[1]
    cmd_err = results[3]

    # Test Pass Criterias
    no_rs_err     = (rs == exp_rs)
    no_fatal_exc  = (cmd_out.find("FATAL EXCEPTION") == -1)

    result = no_rs_err and no_fatal_exc

    errmsg  = "\n\nFailed Data:\n\n" \
        "Return Status %s, Expected Return Status %s\n\n" \
        "Command Output:\n%s\n\n" \
        "Command Error:\n%s\n\n" \
        "Arguments: %s" % (str(rs), str(exp_rs), str(cmd_out), str(cmd_err), _args)

    assert result, errmsg
开发者ID:benmcclelland,项目名称:cobalt-orcm,代码行数:35,代码来源:qsub_sanity_test.py

示例8: test_get_bootable_blocks_version

def test_get_bootable_blocks_version():
    """
    get-bootable-blocks test run: version

    """

    args      = """--version"""

    cmdout    = \
"""version: "get-bootable-blocks.py " + TBD + , Cobalt  + TBD
"""

    cmderr    = ''

    stubout   = ''

    stubout_file = "stub.out"

    expected_results = ( 
                       0, # Expected return status 
                       cmdout, # Expected command output
                       stubout, # Expected stub functions output
                       cmderr, # Expected command error output 
                       ) 

    testutils.save_testhook("")

    results = testutils.run_cmd('get-bootable-blocks.py',args,stubout_file) 
    result  = testutils.validate_results(results,expected_results)

    testutils.remove_testhook()

    correct = 1
    assert result == correct, "Result:\n%s" % result
开发者ID:benmcclelland,项目名称:cobalt-orcm,代码行数:34,代码来源:get-bootable-blocks_test.py

示例9: test_setres_add_res_2

def test_setres_add_res_2():
    """
    setres test run: add_res_2

        Command Output:
        
        Command Error/Debug:Must supply a start time for the reservation with -s
        
        
    """

    args      = """-n resname -D ANL-R00-R01-2048 ANL-R00-1024 ANL-R01-1024"""
    exp_rs    = 256

    user    = pwd.getpwuid(os.getuid())[0] 
    _args   = args.replace('<USER>',user)

    results = testutils.run_cmd('setres.py',_args,None) 
    rs      = results[0]
    cmd_out = results[1]
    cmd_err = results[3]

    # Test Pass Criterias
    no_rs_err     = (rs == exp_rs)
    no_fatal_exc  = (cmd_out.find("FATAL EXCEPTION") == -1)

    result = no_rs_err and no_fatal_exc

    errmsg  = "\n\nFailed Data:\n\n" \
        "Return Status %s, Expected Return Status %s\n\n" \
        "Command Output:\n%s\n\n" \
        "Command Error:\n%s\n\n" \
        "Arguments: %s" % (str(rs), str(exp_rs), str(cmd_out), str(cmd_err), _args)

    assert result, errmsg
开发者ID:benmcclelland,项目名称:cobalt-orcm,代码行数:35,代码来源:setres_sanity_test.py

示例10: test_showres_combo

def test_showres_combo():
    """
    showres test run: combo

    """

    args      = """-l -x"""

    cmdout    = ''

    cmderr    = \
"""Only use -l or -x not both
"""

    stubout   = ''

    stubout_file = "stub.out"

    expected_results = ( 
                       256, # Expected return status 
                       cmdout, # Expected command output
                       stubout, # Expected stub functions output
                       cmderr, # Expected command error output 
                       ) 

    testutils.save_testhook("")

    results = testutils.run_cmd('showres.py',args,stubout_file) 
    result  = testutils.validate_results(results,expected_results)

    testutils.remove_testhook()

    correct = 1
    assert result == correct, "Result:\n%s" % result
开发者ID:ido,项目名称:cobalt,代码行数:34,代码来源:showres_test.py

示例11: test_get_bootable_blocks_geometry_10

def test_get_bootable_blocks_geometry_10():
    """
    get-bootable-blocks test run: geometry_10

    """

    args      = """--geometry 90x90x90x90x11 arg"""

    cmdout    = ''

    cmderr    = \
"""Invalid Geometry. Geometry must be in the form of AxBxCxDxE
"""

    stubout   = ''

    stubout_file = "stub.out"

    expected_results = ( 
                       256, # Expected return status 
                       cmdout, # Expected command output
                       stubout, # Expected stub functions output
                       cmderr, # Expected command error output 
                       ) 

    testutils.save_testhook("")

    results = testutils.run_cmd('get-bootable-blocks.py',args,stubout_file) 
    result  = testutils.validate_results(results,expected_results)

    testutils.remove_testhook()

    correct = 1
    assert result == correct, "Result:\n%s" % result
开发者ID:benmcclelland,项目名称:cobalt-orcm,代码行数:34,代码来源:get-bootable-blocks_test.py

示例12: test_schedctl_combo_1

def test_schedctl_combo_1():
    """
    schedctl test run: combo_1

    """

    args      = """--start --stop"""

    cmdout    = ''

    cmderr    = \
"""Option combinations not allowed with: start option(s)
"""

    stubout   = ''

    stubout_file = "stub.out"

    expected_results = ( 
                       256, # Expected return status 
                       cmdout, # Expected command output
                       stubout, # Expected stub functions output
                       cmderr, # Expected command error output 
                       ) 

    testutils.save_testhook("")

    results = testutils.run_cmd('schedctl.py',args,stubout_file) 
    result  = testutils.validate_results(results,expected_results)

    testutils.remove_testhook()

    correct = 1
    assert result == correct, "Result:\n%s" % result
开发者ID:benmcclelland,项目名称:cobalt-orcm,代码行数:34,代码来源:schedctl_test.py

示例13: test_schedctl_save_2

def test_schedctl_save_2():
    """
    schedctl test run: save_2

    """

    args      = """--savestate s"""

    cmdout    = ''

    cmderr    = \
"""directory s does not exist
"""

    stubout   = ''

    stubout_file = "stub.out"

    expected_results = ( 
                       256, # Expected return status 
                       cmdout, # Expected command output
                       stubout, # Expected stub functions output
                       cmderr, # Expected command error output 
                       ) 

    testutils.save_testhook("")

    results = testutils.run_cmd('schedctl.py',args,stubout_file) 
    result  = testutils.validate_results(results,expected_results)

    testutils.remove_testhook()

    correct = 1
    assert result == correct, "Result:\n%s" % result
开发者ID:benmcclelland,项目名称:cobalt-orcm,代码行数:34,代码来源:schedctl_test.py

示例14: test_schedctl_inherit_3

def test_schedctl_inherit_3():
    """
    schedctl test run: inherit_3

        Command Output:
        no jobs matched
        
        Command Error/Debug:
        
    """

    args      = """--inherit 1.0 1 2 3"""
    exp_rs    = 0

    user    = pwd.getpwuid(os.getuid())[0] 
    _args   = args.replace('<USER>',user)

    results = testutils.run_cmd('schedctl.py',_args,None) 
    rs      = results[0]
    cmd_out = results[1]
    cmd_err = results[3]

    # Test Pass Criterias
    no_rs_err     = (rs == exp_rs)
    no_fatal_exc  = (cmd_out.find("FATAL EXCEPTION") == -1)

    result = no_rs_err and no_fatal_exc

    errmsg  = "\n\nFailed Data:\n\n" \
        "Return Status %s, Expected Return Status %s\n\n" \
        "Command Output:\n%s\n\n" \
        "Command Error:\n%s\n\n" \
        "Arguments: %s" % (str(rs), str(exp_rs), str(cmd_out), str(cmd_err), _args)

    assert result, errmsg
开发者ID:benmcclelland,项目名称:cobalt-orcm,代码行数:35,代码来源:schedctl_sanity_test.py

示例15: test_qsub_mode_option_4

def test_qsub_mode_option_4():
    """
    qsub test run: mode_option_4

        Command Output:
        
        Command Error/Debug:node count out of realistic range
        
        
    """

    args      = """-A Acceptance -q testing -n 49152 -t 60 --mode script /bin/ls"""
    exp_rs    = 256

    user    = pwd.getpwuid(os.getuid())[0] 
    _args   = args.replace('<USER>',user)

    results = testutils.run_cmd('qsub.py',_args,None) 
    rs      = results[0]
    cmd_out = results[1]
    cmd_err = results[3]

    # Test Pass Criterias
    no_rs_err     = (rs == exp_rs)
    no_fatal_exc  = (cmd_out.find("FATAL EXCEPTION") == -1)

    result = no_rs_err and no_fatal_exc

    errmsg  = "\n\nFailed Data:\n\n" \
        "Return Status %s, Expected Return Status %s\n\n" \
        "Command Output:\n%s\n\n" \
        "Command Error:\n%s\n\n" \
        "Arguments: %s" % (str(rs), str(exp_rs), str(cmd_out), str(cmd_err), _args)

    assert result, errmsg
开发者ID:benmcclelland,项目名称:cobalt-orcm,代码行数:35,代码来源:qsub_sanity_test.py


注:本文中的testutils.run_cmd函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。