()
| 979 | |
| 980 | #[test] |
| 981 | fn test_lint_inner() -> Result<()> { |
| 982 | let root = &passing_fixture()?; |
| 983 | let config = &LintExecutionConfig::default(); |
| 984 | |
| 985 | // Verify that all lints run |
| 986 | let mut out = Vec::new(); |
| 987 | let root_type = RootType::Alternative; |
| 988 | let r = lint_inner(root, root_type, config, [], &mut out).unwrap(); |
| 989 | let running_only_lints = LINTS.len().checked_sub(*ALTROOT_LINTS).unwrap(); |
| 990 | assert_eq!(r.warnings, 0); |
| 991 | assert_eq!(r.fatal, 0); |
| 992 | assert_eq!(r.skipped, running_only_lints); |
| 993 | assert_eq!(r.passed, *ALTROOT_LINTS); |
| 994 | |
| 995 | let r = lint_inner(root, root_type, config, ["var-log"], &mut out).unwrap(); |
| 996 | // Trigger a failure in var-log by creating a non-empty log file. |
| 997 | root.create_dir_all("var/log/dnf")?; |
| 998 | root.write("var/log/dnf/dnf.log", b"dummy dnf log")?; |
| 999 | assert_eq!(r.passed, ALTROOT_LINTS.checked_sub(1).unwrap()); |
| 1000 | assert_eq!(r.fatal, 0); |
| 1001 | assert_eq!(r.skipped, running_only_lints + 1); |
| 1002 | assert_eq!(r.warnings, 0); |
| 1003 | |
| 1004 | // But verify that not skipping it results in a warning |
| 1005 | let mut out = Vec::new(); |
| 1006 | let r = lint_inner(root, root_type, config, [], &mut out).unwrap(); |
| 1007 | assert_eq!(r.passed, ALTROOT_LINTS.checked_sub(1).unwrap()); |
| 1008 | assert_eq!(r.fatal, 0); |
| 1009 | assert_eq!(r.skipped, running_only_lints); |
| 1010 | assert_eq!(r.warnings, 1); |
| 1011 | Ok(()) |
| 1012 | } |
| 1013 | |
| 1014 | #[test] |
| 1015 | fn test_kernel_lint() -> Result<()> { |
nothing calls this directly
no test coverage detected