#!/usr/bin/python # # cmd_hist_test: tests the functionality of the command hiistoy # # Test the ability to display the history and run previous commands from the history # # Requires the following commands to be implemented # or otherwise usable: # # N/A. One must also be able to handle porperly running jobs in the background # import sys, imp, atexit, signal, time, threading from testutils import * console = setup_tests() # ensure that shell prints expected prompt expect_prompt() # run a command sendline("sleep 60 &") #Used to get the jobid and pid of the sleep process (jobid, pid) = parse_bg_status() sendline("history") expect_exact("1: sleep 60 &") expect_exact("2: history") # ensure that shell prints expected prompt expect_prompt("Shell did not print expected prompt (2)") # run a command sendline("history 1") expect_exact("3: history 1") # ensure that shell prints expected prompt expect_prompt("Shell did not print expected prompt (2)") # # run a command sendline("sleep 60 &") # #Used to get the jobid and pid of the sleep process (jobid, pid) = parse_bg_status() # # run a command sendline("!!") # #Used to get the jobid and pid of the sleep process (jobid, pid) = parse_bg_status() # # ensure that shell prints expected prompt expect_prompt("Shell did not print expected prompt (2)") # # run a command sendline("!1") # #Used to get the jobid and pid of the sleep process (jobid, pid) = parse_bg_status() # # run a command sendline("!sleep") # #Used to get the jobid and pid of the sleep process (jobid, pid) = parse_bg_status() # ensure that shell prints expected prompt expect_prompt("Shell did not print expected prompt (2)") test_success()