Coder Social home page Coder Social logo

grubby's Introduction

grubby is a command line tool for updating and displaying information about the configuration files for the grub, lilo, elilo (ia64), yaboot (powerpc) and zipl (s390) boot loaders. It is primarily designed to be used from scripts which install new kernels and need to find information about the current boot environment.

Testing grubby

To execute the integrated test suite from inside the source directory run the command:

make test

Test Suite Architecture

grubby's test suite is written in Bash. The file test.sh contains several helper functions and a list of different test scenarios which are exercised upon execution. Important functions are:

  • oneTest() - test if the configuration generated by the supplied grubby parameters matches a well known configuration file;
  • oneDisplayTest() - test grubby features that display some information, checking grubby's output against well known values;
  • commandTest() - test if the output of some commands matches the provided text. This function is only used for grub2 testing in a few places.

Note: the test suite creates aliases for oneTest() and oneDisplayTest(), which are prefixed with the corresponding boot loader name. For example: grubTest(). eliloTest(), etc.

The invocation syntax is:

testFunction config_file results_file --grubby --options

For example the line:

grubTest grub.1 updargs/g1.1 --update-kernel=DEFAULT --args="root=/dev/hda1"

means execute the command:

./grubby --grub --config-file tests/grub.1 --update-kernel=DEFAULT \
--args="root=/dev/hda1"

and compare the resulting configuration with the file tests/results/updargs/g1.1.

The line:

grubDisplayTest grub.1 defaultindex/0 --default-index

means execute:

./grubby --grub --config-file tests/grub.1 --default-index

and compare the output with the file tests/results/defaultindex/0.

Writing New Test Cases

To write a new test case for grubby you need a config file which matches the initial test conditions (either existing one or a new one), provide a results file (likely a new one) which contains the expected configuration or output and finally add a call to the test function(s) using the desired grubby parameters in an appropriate section of test.sh.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.