CMPSC 311, Spring 2013, Project 4, Grading info

The grades are based on 25 points, calculated as follows:
Testing was done on Linux, compiled by
    gcc -std=c99 -D_XOPEN_SOURCE=700 -Wall -Wextra -o hake hake.c $extras
where the shell variable extras expands to as many of cmpsc311.c names.c target.c as were submitted.

We repaired a few of the source files, when there was some minor error, but then points were deducted.

The test cases were without and then with the -v option,

Test 1 - help
hake -v -h

Test 2 - read hakefile (hakefile and Hakefile both exist)
hake -v

Test 3 - read Hakefile (Hakefile exists but hakefile does not)
hake -v

Test 4 - no input (neither of hakefile and Hakefile exist)
hake -v

Test 5 - missing file on command line
hake -v -f

Test 6 - read grading-file-1
hake -v -f grading-file-1

Test 7 - read grading-file-2
hake -v -f grading-file-2

Test 8 - read grading-file-3, recursion
hake -v -f grading-file-3

with the files

hakefile - primary default file
# hakefile
abcd : efgh
        echo abcd

Hakefile - secondary default file
# Hakefile
ABCD : EFGH
        echo ABCD

grading-file-1
# grading-file-1 - simple tests only

Macro = Body

Target1 : Source1 Source2
        Recipe 1

# include grading-file-0
include grading-file-4
include grading-file-5 # comment

grading-file-2 - derived from testfile-2 in the project description
# grading-file-2
include              # no file, but don't complain
include foo          # proper
include "foo bar"    # proper
include 'foo bar'    # proper

grading-file-3 - recursion, to be avoided
include grading-file-3

grading-file-4
# grading-file-4
abc : def
        echo abc def

grading-file-5
# grading-file-5
pqr : stu
        echo pqr stu

In the "recipe" line of grading-file-5, there are 8 spaces instead of a single tab.  Each of the files ends with a blank line, since some programs failed to detect end-of-file without that.

Here is an example of correct behavior, first without -v and then with -v.  Note that some of the lines were written to stderr, and some to stdout, so they are not always "in order".  That's one reason why the grading criterion is "looks good", and not "is right".

--------------------------------------------------------------------------------
Test 1 - help - Solution

usage: hake [-h] [-v] [-f file]
  -h           print help
  -v           verbose mode; enable extra printing; can be repeated
  -f file      input filename; default is hakefile or Hakefile

--------------------------------------------------------------------------------
Test 2 - read hakefile - Solution

--------------------------------------------------------------------------------
Test 3 - read Hakefile - Solution

--------------------------------------------------------------------------------
Test 4 - no input - Solution

hake: no input
hake: Try 'hake -h' for usage information.

Exit Status 1

--------------------------------------------------------------------------------
Test 5 - missing file - Solution

hake: invalid option 'f' (missing argument)
hake: Try 'hake -h' for usage information.

Exit Status 1

--------------------------------------------------------------------------------
Test 6 - grading-file-1 - Solution

hake: grading-file-5: line 3: not recognized:         echo pqr stu

--------------------------------------------------------------------------------
Test 7 - grading-file-2 - Solution

hake: could not open input file foo: No such file or directory
hake: could not open input file foo bar: No such file or directory

--------------------------------------------------------------------------------
Test 8 - grading-file-3, recursion - Solution

--------------------------------------------------------------------------------



--------------------------------------------------------------------------------
Test 1 -v - help - Solution

usage: hake [-h] [-v] [-f file]
  -h           print help
  -v           verbose mode; enable extra printing; can be repeated
  -f file      input filename; default is hakefile or Hakefile

--------------------------------------------------------------------------------
Test 2 -v - read hakefile - Solution

hake: read_file(hakefile)
hake: read_lines(hakefile)
list of names: filenames
  hakefile
hake: hakefile: line 1: # hakefile
hake: hakefile: line 2: abcd : efgh
  diagnosis: target-prerequisite
hake: hakefile: line 3:     echo abcd
  diagnosis: recipe line 1
hake: hakefile: line 4:

--------------------------------------------------------------------------------
Test 3 -v - read Hakefile - Solution

hake: read_file(hakefile)
hake: read_file(Hakefile)
hake: read_lines(Hakefile)
list of names: filenames
  hakefile
list of names: filenames
  hakefile
  Hakefile
hake: Hakefile: line 1: # Hakefile
hake: Hakefile: line 2: ABCD : EFGH
  diagnosis: target-prerequisite
hake: Hakefile: line 3:     echo ABCD
  diagnosis: recipe line 1
hake: Hakefile: line 4:

--------------------------------------------------------------------------------
Test 4 -v - no input - Solution

hake: read_file(hakefile)
hake: read_file(Hakefile)
hake: no input
hake: Try 'hake -h' for usage information.
list of names: filenames
  hakefile
list of names: filenames
  hakefile
  Hakefile

Exit Status 1

--------------------------------------------------------------------------------
Test 5 -v - missing file - Solution

hake: invalid option 'f' (missing argument)
hake: Try 'hake -h' for usage information.

Exit Status 1

--------------------------------------------------------------------------------
Test 6 -v - grading-file-1 - Solution

hake: read_file(grading-file-1)
hake: read_lines(grading-file-1)
hake: read_file(grading-file-4)
hake: read_lines(grading-file-4)
hake: read_file(grading-file-5)
hake: read_lines(grading-file-5)
hake: grading-file-5: line 3: not recognized:         echo pqr stu
list of names: filenames
  grading-file-1
hake: grading-file-1: line 1: # grading-file-1 - simple tests only
hake: grading-file-1: line 2:
hake: grading-file-1: line 3: Macro = Body
  diagnosis: macro definition
hake: grading-file-1: line 4:
hake: grading-file-1: line 5: Target1 : Source1 Source2
  diagnosis: target-prerequisite
hake: grading-file-1: line 6:     Recipe 1
  diagnosis: recipe line 1
hake: grading-file-1: line 7:
hake: grading-file-1: line 8: # include grading-file-0
hake: grading-file-1: line 9: include grading-file-4
  diagnosis: include
list of names: filenames
  grading-file-1
  grading-file-4
hake: grading-file-4: line 1: # grading-file-4
hake: grading-file-4: line 2: abc : def
  diagnosis: target-prerequisite
hake: grading-file-4: line 3:     echo abc def
  diagnosis: recipe line 1
hake: grading-file-4: line 4:
hake: grading-file-1: line 10: include grading-file-5 # comment
  diagnosis: include
list of names: filenames
  grading-file-1
  grading-file-4
  grading-file-5
hake: grading-file-5: line 1: # grading-file-5
hake: grading-file-5: line 2: pqr : stu
  diagnosis: target-prerequisite
hake: grading-file-5: line 3:         echo pqr stu
  diagnosis: something else
hake: grading-file-5: line 4:
hake: grading-file-1: line 11:

--------------------------------------------------------------------------------
Test 7 -v - grading-file-2 - Solution

hake: read_file(grading-file-2)
hake: read_lines(grading-file-2)
hake: grading-file-2: line 2: include but no filename
hake: read_file(foo)
hake: could not open input file foo: No such file or directory
hake: read_file(foo bar)
hake: could not open input file foo bar: No such file or directory
hake: read_file(foo bar)
list of names: filenames
  grading-file-2
hake: grading-file-2: line 1: # grading-file-2
hake: grading-file-2: line 2: include              # no file, but don't complain
  diagnosis: include
hake: grading-file-2: line 3: include foo          # proper
  diagnosis: include
list of names: filenames
  grading-file-2
  foo
hake: grading-file-2: line 4: include "foo bar"    # proper
  diagnosis: include
list of names: filenames
  grading-file-2
  foo
  foo bar
hake: grading-file-2: line 5: include 'foo bar'    # proper
  diagnosis: include
hake: grading-file-2: line 6:

--------------------------------------------------------------------------------
Test 8 -v - grading-file-3, recursion - Solution

hake: read_file(grading-file-3)
hake: read_lines(grading-file-3)
hake: read_file(grading-file-3)
list of names: filenames
  grading-file-3
hake: grading-file-3: line 1: include grading-file-3
  diagnosis: include
hake: grading-file-3: line 2:

--------------------------------------------------------------------------------


A few of the errors that were noted: