Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sepolicy
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CodeLinaro
public-release-test
platform
system
sepolicy
Commits
1d5131e9
Commit
1d5131e9
authored
7 years ago
by
TreeHugger Robot
Committed by
Android (Google) Code Review
7 years ago
Browse files
Options
Downloads
Plain Diff
Merge "treble compat: Add test for removed public types without compat entry." into oc-mr1-dev
parents
78b3d573
8682d712
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/mini_parser.py
+3
-3
3 additions, 3 deletions
tests/mini_parser.py
tests/treble_sepolicy_tests.py
+24
-0
24 additions, 0 deletions
tests/treble_sepolicy_tests.py
with
27 additions
and
3 deletions
tests/mini_parser.py
+
3
−
3
View file @
1d5131e9
...
@@ -41,12 +41,12 @@ class MiniCilParser:
...
@@ -41,12 +41,12 @@ class MiniCilParser:
def
_parseType
(
self
,
stmt
):
def
_parseType
(
self
,
stmt
):
m
=
re
.
match
(
r
"
type\s+(.+)
"
,
stmt
)
m
=
re
.
match
(
r
"
type\s+(.+)
"
,
stmt
)
self
.
types
.
update
(
set
(
m
.
group
(
1
))
)
self
.
types
.
add
(
m
.
group
(
1
))
return
return
def
_parseTypeattribute
(
self
,
stmt
):
def
_parseTypeattribute
(
self
,
stmt
):
m
=
re
.
match
(
r
"
typeattribute\s+(.+)
"
,
stmt
)
m
=
re
.
match
(
r
"
typeattribute\s+(.+)
"
,
stmt
)
self
.
typeattributes
.
update
(
set
(
m
.
group
(
1
))
)
self
.
typeattributes
.
add
(
m
.
group
(
1
))
return
return
def
_parseTypeattributeset
(
self
,
stmt
):
def
_parseTypeattributeset
(
self
,
stmt
):
...
@@ -67,7 +67,7 @@ class MiniCilParser:
...
@@ -67,7 +67,7 @@ class MiniCilParser:
# check to see if this typeattributeset is a versioned public type
# check to see if this typeattributeset is a versioned public type
pub
=
re
.
match
(
r
"
(\w+)_\d+_\d+
"
,
ta
)
pub
=
re
.
match
(
r
"
(\w+)_\d+_\d+
"
,
ta
)
if
pub
is
not
None
:
if
pub
is
not
None
:
self
.
pubtypes
.
update
(
set
(
pub
.
group
(
1
))
)
self
.
pubtypes
.
add
(
pub
.
group
(
1
))
return
return
def
_parseStmt
(
self
,
stmt
):
def
_parseStmt
(
self
,
stmt
):
...
...
This diff is collapsed.
Click to expand it.
tests/treble_sepolicy_tests.py
+
24
−
0
View file @
1d5131e9
...
@@ -212,6 +212,7 @@ def TestCoredomainViolations():
...
@@ -212,6 +212,7 @@ def TestCoredomainViolations():
def
TestNoUnmappedNewTypes
():
def
TestNoUnmappedNewTypes
():
global
alltypes
global
alltypes
global
oldalltypes
global
oldalltypes
global
compatMapping
newt
=
alltypes
-
oldalltypes
newt
=
alltypes
-
oldalltypes
ret
=
""
ret
=
""
violators
=
[]
violators
=
[]
...
@@ -228,8 +229,31 @@ def TestNoUnmappedNewTypes():
...
@@ -228,8 +229,31 @@ def TestNoUnmappedNewTypes():
ret
+=
"
"
.
join
(
str
(
x
)
for
x
in
sorted
(
violators
))
+
"
\n
"
ret
+=
"
"
.
join
(
str
(
x
)
for
x
in
sorted
(
violators
))
+
"
\n
"
return
ret
return
ret
###
# Make sure that any public type removed in the current policy has its
# declaration added to the mapping file for use in non-platform policy
def
TestNoUnmappedRmTypes
():
global
alltypes
global
oldalltypes
global
compatMapping
rmt
=
oldalltypes
-
alltypes
ret
=
""
violators
=
[]
for
o
in
rmt
:
if
o
in
compatMapping
.
pubtypes
and
not
o
in
compatMapping
.
types
:
violators
.
append
(
o
)
if
len
(
violators
)
>
0
:
ret
+=
"
SELinux: The following formerly public types were removed from
"
ret
+=
"
policy without a declaration in the compatibility mapping
"
ret
+=
"
file(s) found in prebuilts/api/
"
+
compatMapping
.
apiLevel
+
"
/
\n
"
ret
+=
"
"
.
join
(
str
(
x
)
for
x
in
sorted
(
violators
))
+
"
\n
"
return
ret
def
TestTrebleCompatMapping
():
def
TestTrebleCompatMapping
():
ret
=
TestNoUnmappedNewTypes
()
ret
=
TestNoUnmappedNewTypes
()
ret
+=
TestNoUnmappedRmTypes
()
return
ret
return
ret
###
###
# extend OptionParser to allow the same option flag to be used multiple times.
# extend OptionParser to allow the same option flag to be used multiple times.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment