#!/usr/bin/python # # bg_test: tests the bg command # # Test the stop command for stopping a process by its pid. # Requires the following commands to be implemented # or otherwise usable: # # bg, sleep, stop # import sys, imp, atexit sys.path.append("/home/courses/cs3214/software/pexpect-dpty/"); import pexpect, shellio, signal, time, os, re, proc_check #Ensure the shell process is terminated def force_shell_termination(shell_process): c.close(force=True) #spawn an instance of the shell c = pexpect.spawn('./esh -p plugin\n') atexit.register(force_shell_termination, shell_process=c) # set timeout for all following 'expect*' calls to 2 seconds c.timeout = 2 # ensure that the testGlob.c placed in /tmp is found c.sendline('ls /tmp/test*') assert c.expect('test*') == 0, "Shell did not expand glob as expected" shellio.success()