示例#1
0
文件: fdso.c 项目: AshishPrasad/BTP
#include "tests.h"

#include "litmus.h"


TESTCASE(fmlp_not_active, C_EDF | PFAIR | LINUX,
	 "don't open FMLP semaphores if FMLP is not supported")
{
	int fd;

	SYSCALL( fd = open(".fmlp_locks", O_RDONLY | O_CREAT) );

	ASSERT(fd != -1);

	SYSCALL_FAILS(EBUSY, open_fmlp_sem(fd, 0) );

	SYSCALL( close(fd) );

	SYSCALL( remove(".fmlp_locks") );
}


TESTCASE(invalid_od, ALL,
	 "reject invalid object descriptors")
{
	SYSCALL_FAILS( EINVAL, fmlp_down(3) );

	SYSCALL_FAILS( EINVAL, fmlp_up(3) );

	SYSCALL_FAILS( EINVAL, od_close(3) );
示例#2
0
#include <stdio.h>

#include "tests.h"
#include "litmus.h"

TESTCASE(lock_fmlp_nesting, PSN_EDF | GSN_EDF | P_FP,
	 "FMLP no nesting allowed")
{
	int fd, od, od2;

	SYSCALL( fd = open(".fmlp_locks", O_RDONLY | O_CREAT, S_IRUSR) );

	SYSCALL( sporadic_partitioned(10, 100, 0) );
	SYSCALL( task_mode(LITMUS_RT_TASK) );

	SYSCALL( od = open_fmlp_sem(fd, 0) );
	SYSCALL( od2 = open_fmlp_sem(fd, 1) );

	SYSCALL( litmus_lock(od) );
	SYSCALL( litmus_unlock(od) );

	SYSCALL( litmus_lock(od2) );
	SYSCALL( litmus_unlock(od2) );

	SYSCALL( litmus_lock(od) );
	SYSCALL_FAILS(EBUSY, litmus_lock(od2));
	SYSCALL( litmus_unlock(od) );

	SYSCALL( litmus_lock(od2) );
	SYSCALL_FAILS(EBUSY, litmus_lock(od));
	SYSCALL( litmus_unlock(od2) );
示例#3
0
#include <unistd.h>
#include <stdio.h>
#include <sys/wait.h> /* for waitpid() */

#include "tests.h"
#include "litmus.h"


TESTCASE(not_lock_fmlp_be, GSN_EDF | PSN_EDF | P_FP,
	 "don't let best-effort tasks lock FMLP semaphores")
{
	int fd, od;

	SYSCALL( fd = open(".fmlp_locks", O_RDONLY | O_CREAT, S_IRUSR) );

	SYSCALL( od = open_fmlp_sem(fd, 0) );

	/* BE tasks may not lock FMLP semaphores */
	SYSCALL_FAILS(EPERM, litmus_lock(od) );

	/* tasks may not unlock resources they don't own */
	SYSCALL_FAILS(EINVAL, litmus_unlock(od) );

	SYSCALL( od_close(od) );

	SYSCALL( close(fd) );

	SYSCALL( remove(".fmlp_locks") );

}