-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(stats): Add
detsys-stats
program for getting stats of test run
``` > detsys-stats check --testId [the-testid-to-test] --file [file-describing-properties-to-test] ``` This will output a report for the test, with information how many runs had each property. The file should follow the following format: ``` [NAME OF REPORT] [NAME OF 1 PROPERTY] [LTL-FORMULA FOR THAT PROPERTY] [NAME OF 2 PROPERTY] [LTL-FORMULA FOR THAT PROPERTY] ... [NAME OF n PROPERTY] [LTL-FORMULA FOR THAT PROPERTY] ```
- Loading branch information
1 parent
8a07b4e
commit 03c4a49
Showing
15 changed files
with
3,194 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
steps: | ||
- imports: | ||
align: none | ||
list_align: with_module_name | ||
pad_module_names: false | ||
long_list_align: new_line_multiline | ||
empty_list_align: inherit | ||
list_padding: 7 # length "import " | ||
separate_lists: false | ||
space_surround: false | ||
- language_pragmas: | ||
style: vertical | ||
align: false | ||
remove_redundant: true | ||
- simple_align: | ||
cases: false | ||
top_level_patterns: false | ||
records: false | ||
- trailing_whitespace: {} | ||
|
||
# You need to put any language extensions that's enabled for the entire project | ||
# here. | ||
language_extensions: [] | ||
|
||
columns: 72 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Revision history for | ||
|
||
## 0.1.0.0 -- YYYY-mm-dd | ||
|
||
* First version. Released on an unsuspecting world. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Copyright (c) 2021 Symbiont Inc. | ||
|
||
All rights reserved. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
### Statistics for a detsys run | ||
|
||
> detsys-stats check --testId XXX --file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
{-# LANGUAGE CPP #-} | ||
{-# LANGUAGE DataKinds #-} | ||
{-# LANGUAGE DeriveGeneric #-} | ||
{-# LANGUAGE OverloadedStrings #-} | ||
{-# LANGUAGE RecordWildCards #-} | ||
{-# LANGUAGE TemplateHaskell #-} | ||
{-# LANGUAGE TypeOperators #-} | ||
|
||
module Main where | ||
|
||
import qualified Description | ||
import Options.Generic | ||
import qualified Stats | ||
|
||
------------------------------------------------------------------------ | ||
|
||
-- When building with Bazel we generate a module containing the git commit hash | ||
-- at compile-time. | ||
#ifdef __BAZEL_BUILD__ | ||
import GitHash | ||
-- When building with cabal we expect the git commit hash to be passed in via | ||
-- CPP flags, i.e. `--ghc-option=-D__GIT_HASH__=\"X\"`. | ||
#elif defined __GIT_HASH__ | ||
gitHash :: String | ||
gitHash = __GIT_HASH__ | ||
#else | ||
gitHash :: String | ||
gitHash = "unknown" | ||
#endif | ||
|
||
------------------------------------------------------------------------ | ||
|
||
-- shold we use some other type for FilePath that isn't just alias = [Char] | ||
data Config | ||
= Check | ||
{ testId :: Int <?> "Which TestId to get stats for", | ||
file :: FilePath <?> "File that contains the description of the stats" | ||
} | ||
| Version | ||
deriving (Generic) | ||
|
||
instance ParseRecord Config | ||
|
||
main :: IO () | ||
main = do | ||
(cfg, help) <- getWithHelp "Stats" | ||
case cfg of | ||
Version -> putStrLn gitHash | ||
Check {..} -> do | ||
input <- readFile $ unHelpful file | ||
case Description.parse input of | ||
Nothing -> do | ||
putStrLn "Can't parse <file>" | ||
Just desc -> do | ||
(result, nrRuns) <- Stats.gatherInformation (unHelpful testId) desc | ||
putStrLn $ Description.pprint nrRuns result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
packages: . | ||
|
||
with-compiler: ghc-8.10.4 | ||
|
||
reject-unconstrained-dependencies: all | ||
|
||
constraints: QuickCheck +old-random | ||
|
||
package stats | ||
ghc-options: | ||
-Wall | ||
-O2 | ||
|
||
allow-older: * | ||
allow-newer: * |
Oops, something went wrong.