Skip to content

Latest commit

 

History

12 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MakefileTest

Originally a Bash Script that would just run all the targets in a Makefile to see if any failed, this project has evolved into a Go program that will allow for a more modular approach to testing a Makefile.

Features

  • A program that can take a Makefile, and runs all the targets.
  • Takes a json file containing the targets to be run and the desired output/file for each one
  • JSON Params:
    • Name (string)
    • targetToRun (string)
    • filesCreated (string)
    • filesDeleted (string)
    • searchForFailureInOutput (bool)

Note: More features will probably be added later, this is going to be the basic functionality though.

Flags

Flag Description
-h Print the help message
-m The path to the Makefile to be tested
-f The JSON File containing information regarding the test
-g Generate a JSON from the Makefile

Automatic JSON Generation (-g)

This feature is still undergoing testing.

The program will parse the Makefile and attempt to create a JSON file as a starting basis for a test file. It will create a test for each target within the Makefile with the following features:

  • If a Makefile path is specified with the "-m" flag, that Makefile will be parsed (otherwise it will default to parsing ./Makefile)
  • If a JSON file path is specified with the "-f" flag, the generated JSON file will use that path (otherwise it will default to test.json)
  • Name will just be " Test"
  • If the test has a phony, the fileCreated test will be left empty
  • If "rm" or some version of that is found, it will try to add a deleted file
  • searchForFailureInOutput will be set to true by default

Note: This will be a method that is run up front and will cause the application to return so no testing is actually run

Future Features

  • Change the output failure parsing to just look for any stderr instead of just parsing for "fail" keyword

JSON Format - Example

{
   "testTargets": [
       {
           "name": "Test Target 1",
           "target": "target1",
           "filesCreated": "target1test,target2test",
           "filesDeleted": "",
           "ignoreFailure": true
       },
       {
           "name": "Test Target 2",
           "target": "target1Clean",
           "filesCreated": "",
           "filesDeleted": "target1test,target2test",
           "ignoreFailure": false
       },
       {
           "name": "Test Fail",
           "target": "failTarget",
           "filesCreated": "",
           "filesDeleted": "",
           "ignoreFailure": false
       }
   ]
}

About

A script to run some preliminary tests on a Makefile to make sure it is functioning correctly. It will start as a way to run every target in the Makefile and check for any errors, but I would like to make it extendable by adding support for writing files to check for specific outcomes to specific targets.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages