CS318 - Pintos
Pintos source browser for JHU CS318 course
Data Structures | Functions | Variables
tests.c File Reference
#include "tests/threads/tests.h"
#include <debug.h>
#include <string.h>
#include <stdio.h>
Include dependency graph for tests.c:

Go to the source code of this file.

Data Structures

struct  test
 

Functions

void run_test (const char *name)
 Runs the test named NAME. More...
 
void msg (const char *format,...)
 Prints FORMAT as if with printf(), prefixing the output by the name of the test and following it with a new-line character. More...
 
void fail (const char *format,...)
 Prints failure message FORMAT as if with printf(), prefixing the output by the name of the test and FAIL: and following it with a new-line character, and then panics the kernel. More...
 
void pass (void)
 Prints a message indicating the current test passed. More...
 

Variables

static const struct test tests []
 
static const char * test_name
 

Function Documentation

◆ fail()

void fail ( const char *  format,
  ... 
)

Prints failure message FORMAT as if with printf(), prefixing the output by the name of the test and FAIL: and following it with a new-line character, and then panics the kernel.

Definition at line 83 of file tests.c.

References exit(), PANIC, printf(), putchar(), test_name, va_end, va_start, vmsg(), and vprintf().

Here is the call graph for this function:

◆ msg()

void msg ( const char *  format,
  ... 
)

Prints FORMAT as if with printf(), prefixing the output by the name of the test and following it with a new-line character.

Definition at line 67 of file tests.c.

References printf(), putchar(), quiet, test_name, va_end, va_start, vmsg(), and vprintf().

Referenced by run_test().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pass()

void pass ( void  )

Prints a message indicating the current test passed.

tests/threads/tests.h

Definition at line 98 of file tests.c.

References printf(), and test_name.

Referenced by test_alarm_negative(), test_alarm_zero(), and test_mlfqs_load_1().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ run_test()

void run_test ( const char *  name)

Runs the test named NAME.

Definition at line 47 of file tests.c.

References test::function, msg(), test::name, name, PANIC, strcmp(), test_name, and tests.

Referenced by run_task().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ test_name

const char* test_name
static

Definition at line 43 of file tests.c.

Referenced by fail(), msg(), pass(), and run_test().

◆ tests

const struct test tests[]
static
Initial value:
=
{
{"alarm-single", test_alarm_single},
{"alarm-multiple", test_alarm_multiple},
{"alarm-simultaneous", test_alarm_simultaneous},
{"alarm-priority", test_alarm_priority},
{"alarm-zero", test_alarm_zero},
{"alarm-negative", test_alarm_negative},
{"priority-change", test_priority_change},
{"priority-donate-one", test_priority_donate_one},
{"priority-donate-multiple", test_priority_donate_multiple},
{"priority-donate-multiple2", test_priority_donate_multiple2},
{"priority-donate-nest", test_priority_donate_nest},
{"priority-donate-sema", test_priority_donate_sema},
{"priority-donate-lower", test_priority_donate_lower},
{"priority-donate-chain", test_priority_donate_chain},
{"priority-fifo", test_priority_fifo},
{"priority-preempt", test_priority_preempt},
{"priority-sema", test_priority_sema},
{"priority-condvar", test_priority_condvar},
{"mlfqs-load-1", test_mlfqs_load_1},
{"mlfqs-load-60", test_mlfqs_load_60},
{"mlfqs-load-avg", test_mlfqs_load_avg},
{"mlfqs-recent-1", test_mlfqs_recent_1},
{"mlfqs-fair-2", test_mlfqs_fair_2},
{"mlfqs-fair-20", test_mlfqs_fair_20},
{"mlfqs-nice-2", test_mlfqs_nice_2},
{"mlfqs-nice-10", test_mlfqs_nice_10},
{"mlfqs-block", test_mlfqs_block},
}

Definition at line 12 of file tests.c.

Referenced by run_test().

test_mlfqs_load_1
test_func test_mlfqs_load_1
test_mlfqs_fair_2
test_func test_mlfqs_fair_2
test_priority_donate_chain
test_func test_priority_donate_chain
test_priority_donate_sema
test_func test_priority_donate_sema
test_priority_change
test_func test_priority_change
test_alarm_single
test_func test_alarm_single
test_priority_donate_lower
test_func test_priority_donate_lower
test_alarm_negative
test_func test_alarm_negative
test_mlfqs_nice_10
test_func test_mlfqs_nice_10
test_alarm_zero
test_func test_alarm_zero
test_mlfqs_load_avg
test_func test_mlfqs_load_avg
test_priority_donate_nest
test_func test_priority_donate_nest
test_priority_condvar
test_func test_priority_condvar
test_priority_donate_multiple2
test_func test_priority_donate_multiple2
test_alarm_simultaneous
test_func test_alarm_simultaneous
test_mlfqs_block
test_func test_mlfqs_block
test_mlfqs_load_60
test_func test_mlfqs_load_60
test_priority_fifo
test_func test_priority_fifo
test_mlfqs_fair_20
test_func test_mlfqs_fair_20
test_mlfqs_recent_1
test_func test_mlfqs_recent_1
test_priority_preempt
test_func test_priority_preempt
test_alarm_priority
test_func test_alarm_priority
test_priority_donate_multiple
test_func test_priority_donate_multiple
test_priority_sema
test_func test_priority_sema
test_priority_donate_one
test_func test_priority_donate_one
test_alarm_multiple
test_func test_alarm_multiple
test_mlfqs_nice_2
test_func test_mlfqs_nice_2