Ejemplo n.º 1
0
# The simplified rename model from the SOSP '13 paper

import simsym
import symtypes
import model
import errno

SymByte = simsym.tuninterpreted('SymByte')
SymInode = simsym.tstruct(data=symtypes.tlist(SymByte), nlink=simsym.SInt)
SymIMap = simsym.tmap(simsym.SInt, SymInode)
SymFilename = simsym.tuninterpreted('Filename')
SymDir = symtypes.tdict(SymFilename, simsym.SInt)


class Rename(simsym.tstruct(fname_to_inum=SymDir, inodes=SymIMap)):
    @model.methodwrap(src=SymFilename, dst=SymFilename)
    def rename(self, src, dst):
        if simsym.symnot(self.fname_to_inum.contains(src)):
            #return (-1, errno.ENOENT)
            return -1
        if src == dst:
            return 0
        if self.fname_to_inum.contains(dst):
            self.inodes[self.fname_to_inum[dst]].nlink -= 1
        self.fname_to_inum[dst] = self.fname_to_inum[src]
        del self.fname_to_inum[src]
        return 0


model_class = Rename
Ejemplo n.º 2
0
# The simplified rename model from the SOSP '13 paper

import simsym
import symtypes
import model
import errno

SymByte     = simsym.tuninterpreted('SymByte')
SymInode    = simsym.tstruct(data  = symtypes.tlist(SymByte),
                             nlink = simsym.SInt)
SymIMap     = simsym.tmap(simsym.SInt, SymInode)
SymFilename = simsym.tuninterpreted('Filename')
SymDir      = symtypes.tdict(SymFilename, simsym.SInt)

class Rename(simsym.tstruct(
        fname_to_inum=SymDir,
        inodes=SymIMap)):

    @model.methodwrap(src=SymFilename, dst=SymFilename)
    def rename(self, src, dst):
        if simsym.symnot(self.fname_to_inum.contains(src)):
            #return (-1, errno.ENOENT)
            return -1
        if src == dst:
            return 0
        if self.fname_to_inum.contains(dst):
            self.inodes[self.fname_to_inum[dst]].nlink -= 1
        self.fname_to_inum[dst] = self.fname_to_inum[src]
        del self.fname_to_inum[src]
        return 0
Ejemplo n.º 3
0
import os
import simsym
import symtypes
import errno
import model
import signal
import fs_testgen

SFn = simsym.tuninterpreted("SFn")
SInum = simsym.tuninterpreted("SInum")
SDataVal = simsym.tuninterpreted("SDataVal")
SVa = simsym.tuninterpreted("SVa")
SPipeId = simsym.tuninterpreted("SPipeId")

DATAVAL_BYTES = 4096
PAGE_BYTES = 4096
PAGE_DATAVALS = PAGE_BYTES / DATAVAL_BYTES
assert PAGE_BYTES % DATAVAL_BYTES == 0
DATA_MAX_LEN = 8

SPid = simsym.SBool
SOffset = simsym.tsynonym("SOffset", simsym.SInt)
SData = symtypes.tsmalllist(DATA_MAX_LEN, SDataVal, lenType=SOffset)
SPipe = simsym.tstruct(data = SData)
SPipeMap = symtypes.tmap(SPipeId, SPipe)
class SFd(simsym.tstruct(ispipe = simsym.SBool,
                         pipeid = SPipeId,
                         pipewriter = simsym.SBool,
                         inum = SInum,
                         # This offset is in datavals
                         off = SOffset)):
Ejemplo n.º 4
0
import os
import simsym
import symtypes
import errno
import model
import signal
import fs_testgen

SFn = simsym.tuninterpreted("SFn")
SInum = simsym.tuninterpreted("SInum")
SDataVal = simsym.tuninterpreted("SDataVal")
SVa = simsym.tuninterpreted("SVa")
SPipeId = simsym.tuninterpreted("SPipeId")

DATAVAL_BYTES = 4096
PAGE_BYTES = 4096
PAGE_DATAVALS = PAGE_BYTES / DATAVAL_BYTES
assert PAGE_BYTES % DATAVAL_BYTES == 0
DATA_MAX_LEN = 8

SPid = simsym.SBool
SOffset = simsym.tsynonym("SOffset", simsym.SInt)
SData = symtypes.tsmalllist(DATA_MAX_LEN, SDataVal, lenType=SOffset)
SPipe = simsym.tstruct(data=SData)
SPipeMap = symtypes.tmap(SPipeId, SPipe)


class SFd(
        simsym.tstruct(
            ispipe=simsym.SBool,
            pipeid=SPipeId,
Ejemplo n.º 5
0
# process states
PSTNEW = 1
PSTRUNNING = 2
PSTREADY = 3
PSTWAITING = 4
PSTTERM = 5

class ProcStatus(simsym.SInt):
    def _declare_assumptions(self, assume):
        super(ProcStatus, self)._declare_assumptions(assume)
        assume(self >= PSTNEW)
        assume(self <= PSTTERM)
    

# types about process
PStack = simsym.tuninterpreted("PStack")
PCode = simsym.tuninterpreted("PCode")
PData = simsym.tuninterpreted("PData")


Prio = simsym.tsynonym("Prio", simsym.SInt)     # pocess priority

# types and consts about HardwareRegister
GenRegSet = simsym.tuninterpreted("GenRegSet")
StatusWd = simsym.tuninterpreted("StatusWd")

INTOFF = 0
INTON = 1

# types about memory
class MemDesc(symtypes.tstruct(left = simsym.SInt, right = simsym.SInt)):
Ejemplo n.º 6
0
import os
import simsym
import symtypes
import errno
import model
import signal
#import fs_testgen

AF_INET = 2
AF_INET6 = 10
SOCK_DGRAM = 2
SHUT_RD = 0
SHUT_WR = 1
SHUT_RDWR = 2

SDataVal = simsym.tuninterpreted("SDataVal")

DATAVAL_BYTES = 4096
PAGE_BYTES = 4096
PAGE_DATAVALS = PAGE_BYTES / DATAVAL_BYTES
assert PAGE_BYTES % DATAVAL_BYTES == 0
DATA_MAX_LEN = 8

SPid = simsym.SBool  # TODO: bool ???
SOffset = simsym.tsynonym("SOffset", simsym.SInt)
SAddr = simsym.tsynonym("SAddr", simsym.SInt)
SPort = simsym.tsynonym("SPort", simsym.SInt)
SData = symtypes.tsmalllist(DATA_MAX_LEN, SDataVal, lenType=SOffset)
SBuffer = simsym.tstruct(data=SData)
SBindRecord = symtypes.tdict(SPort, symtypes.tdict(SPid, simsym.SBool))