mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-10-15 09:17:44 -04:00
Prove buffer lemmas (#124)
* Prove buffer lemmas * Update queue proofs to latest kernel source All changes were syntactic due to uncrustify code-formatting * Strengthen prvCopyDataToQueue proof * Add extract script for diff comparison Co-authored-by: Yuhui Zheng <10982575+yuhui-zheng@users.noreply.github.com>
This commit is contained in:
parent
c720c18ada
commit
8e36bee30e
26 changed files with 2021 additions and 1762 deletions
|
@ -1,3 +1,3 @@
|
|||
#!/bin/bash -eu
|
||||
|
||||
NO_COVERAGE=1 EXTRA_VERIFAST_ARGS=-stats make list queue | grep overhead: | sort | uniq
|
||||
NO_COVERAGE=1 EXTRA_VERIFAST_ARGS=-stats make queue | grep overhead: | sort | uniq
|
||||
|
|
73
FreeRTOS/Test/VeriFast/scripts/extract.py
Executable file
73
FreeRTOS/Test/VeriFast/scripts/extract.py
Executable file
|
@ -0,0 +1,73 @@
|
|||
#!/usr/bin/env python3
|
||||
from __future__ import print_function
|
||||
import sys
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class Extractor(object):
|
||||
@staticmethod
|
||||
def __parse_ctags(tags_filename):
|
||||
def convert_excmd(excmd):
|
||||
assert excmd.endswith(';"')
|
||||
linenum = excmd[:-2] # remove ';"'
|
||||
return int(linenum)
|
||||
result = {}
|
||||
with open(tags_filename) as f:
|
||||
for line in f:
|
||||
if line.startswith('!'):
|
||||
continue
|
||||
parts = line.split('\t')
|
||||
funcname = parts[0]
|
||||
funcfile = parts[1]
|
||||
linenum = convert_excmd(parts[2])
|
||||
result[funcname] = (funcfile, linenum)
|
||||
return result
|
||||
|
||||
def __init__(self, tags_filename):
|
||||
self.map = Extractor.__parse_ctags(tags_filename)
|
||||
|
||||
class State(Enum):
|
||||
INIT = 0
|
||||
HEAD = 1
|
||||
BODY = 2
|
||||
|
||||
def text_of_funcname(self, funcname):
|
||||
if funcname not in self.map:
|
||||
return []
|
||||
funcfile, linenum = self.map[funcname]
|
||||
result = []
|
||||
state, bracecount = Extractor.State.INIT, 0
|
||||
with open(funcfile) as f:
|
||||
for i, line in enumerate(f, start=1): # ctags counts linenums from 1
|
||||
if state == Extractor.State.INIT and linenum <= i:
|
||||
state = Extractor.State.HEAD
|
||||
if state == Extractor.State.HEAD:
|
||||
result.append(line)
|
||||
lbrace = line.count('{')
|
||||
rbrace = line.count('}')
|
||||
bracecount += lbrace
|
||||
bracecount -= rbrace
|
||||
if '{' in line:
|
||||
state = Extractor.State.BODY
|
||||
continue
|
||||
if state == Extractor.State.BODY:
|
||||
result.append(line)
|
||||
lbrace = line.count('{')
|
||||
rbrace = line.count('}')
|
||||
bracecount += lbrace
|
||||
bracecount -= rbrace
|
||||
if bracecount == 0:
|
||||
break
|
||||
return result
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) != 3:
|
||||
print("Usage: %s <tagfile> <funcname>" % sys.argv[0])
|
||||
sys.exit(1)
|
||||
tag_filename = sys.argv[1]
|
||||
funcname = sys.argv[2]
|
||||
extractor = Extractor('tags')
|
||||
result = extractor.text_of_funcname(funcname)
|
||||
print(''.join(result))
|
||||
sys.exit(0)
|
Loading…
Add table
Add a link
Reference in a new issue