PoplarYang
3/10/2017 - 5:54 AM

python测试代码,用来测试重载

python测试代码,用来测试重载

#!/usr/bin/env python
# coding: utf-8

import subprocess

def test(size=1024*64):
    """ pip默认为 64k"""
    print 'start'
    cmd = 'dd if=/dev/urandom bs=1 count=%d 2>/dev/null' % size
    p = subprocess.Popen(args=cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, close_fds=True)
    #p.communicate()
    p.wait()
    print 'end'