summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichael Jones <jonesmi@google.com>2013-12-06 14:19:52 -0800
committerMichael Jones <jonesmi@google.com>2013-12-06 17:06:18 -0800
commit95fd28f321cdc01f72f0a09c7439db7ec75c91cf (patch)
tree0a06266963e0ee07360eebe09ab8b0cb5fe09401 /tests
parente5cb6b604cf733818e0fb47464188513a7109555 (diff)
downloadloganalysis-95fd28f321cdc01f72f0a09c7439db7ec75c91cf.tar.gz
added new SelinuxItem class, in order to parse out and store Selinux domains
Change-Id: Ia507969c8f10368564d7645aee139e466daebec3
Diffstat (limited to 'tests')
-rw-r--r--tests/src/com/android/loganalysis/parser/KernelLogParserTest.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/src/com/android/loganalysis/parser/KernelLogParserTest.java b/tests/src/com/android/loganalysis/parser/KernelLogParserTest.java
index a654429..24e7ad7 100644
--- a/tests/src/com/android/loganalysis/parser/KernelLogParserTest.java
+++ b/tests/src/com/android/loganalysis/parser/KernelLogParserTest.java
@@ -17,6 +17,7 @@ package com.android.loganalysis.parser;
import com.android.loganalysis.item.KernelLogItem;
import com.android.loganalysis.item.MiscKernelLogItem;
+import com.android.loganalysis.item.SELinuxItem;
import com.android.loganalysis.util.LogPatternUtil;
import junit.framework.TestCase;
@@ -160,7 +161,8 @@ public class KernelLogParserTest extends TestCase {
}
assertEquals(KernelLogParser.KERNEL_ERROR, patternUtil.checkMessage("Internal error:"));
- assertEquals(KernelLogParser.SELINUX_DENIAL, patternUtil.checkMessage("avc: denied"));
+ assertEquals(KernelLogParser.SELINUX_DENIAL, patternUtil.checkMessage(
+ "avc: denied scontext=0:0:domain:0 "));
}
/**
@@ -183,10 +185,17 @@ public class KernelLogParserTest extends TestCase {
assertEquals(43.399164, kernelLog.getStopTime(), 0.0000005);
assertEquals(1, kernelLog.getEvents().size());
assertEquals(1, kernelLog.getMiscEvents(KernelLogParser.SELINUX_DENIAL).size());
+ assertEquals(1, kernelLog.getSELinuxEvents().size());
MiscKernelLogItem item = kernelLog.getMiscEvents(KernelLogParser.SELINUX_DENIAL).get(0);
assertEquals(43.399164, item.getEventTime(), 0.0000005);
assertEquals(KernelLogParser.SELINUX_DENIAL, item.getCategory());
assertEquals(SELINUX_DENIAL_STACK, item.getStack());
+
+ SELinuxItem selinuxItem = kernelLog.getSELinuxEvents().get(0);
+ assertEquals("system_server", selinuxItem.getSContext());
+ assertEquals(43.399164, selinuxItem.getEventTime(), 0.0000005);
+ assertEquals(KernelLogParser.SELINUX_DENIAL, selinuxItem.getCategory());
+ assertEquals(SELINUX_DENIAL_STACK, selinuxItem.getStack());
}
}