Skip to content

Commit

Permalink
new: Add unit tests and helper support for Atop 2.6.
Browse files Browse the repository at this point in the history
  • Loading branch information
dfrtz authored Jan 15, 2024
1 parent 5247a12 commit b713b29
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pyatop/atop_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,14 @@
from pyatop.structs import atop_2_3
from pyatop.structs import atop_2_4
from pyatop.structs import atop_2_5
from pyatop.structs import atop_2_6

_VERSIONS = [
atop_1_26,
atop_2_3,
atop_2_4,
atop_2_5,
atop_2_6,
]
Header = Union[tuple(module.Header for module in _VERSIONS)]
Record = Union[tuple(module.Record for module in _VERSIONS)]
Expand Down
88 changes: 88 additions & 0 deletions test/test_atop.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,34 @@
},
},
},
"2.6": {
"args": [
os.path.join(TEST_FILE_DIR, "atop_2_6.log.gz"),
],
"returns": {
"aversion": 33286,
"hertz": 100,
"magic": 4276993775,
"osrel": 5,
"ossub": 104,
"osvers": 10,
"pagesize": 4096,
"rawheadlen": 480,
"rawreclen": 96,
"semantic_version": "2.6",
"sstatlen": 716656,
"supportflags": 53,
"tstatlen": 840,
"utsname": {
"domain": "(none)",
"machine": "x86_64",
"nodename": "fires-of-mount-doom1",
"release": "5.10.104-linuxkit",
"sysname": "Linux",
"version": "#1 SMP Thu Mar 17 17:08:06 UTC 2022",
},
},
},
},
"file_record": {
"1.26": {
Expand Down Expand Up @@ -227,6 +255,29 @@
"totzomb": 0,
},
},
"2.6": {
"args": [
os.path.join(TEST_FILE_DIR, "atop_2_6.log.gz"),
],
"returns": {
"curtime": 1705252822,
"flags": 32,
"interval": 1,
"nactproc": 1,
"ndeviat": 3,
"nexit": 0,
"noverflow": 0,
"ntask": 3,
"pcomplen": 255,
"record_index": 4,
"scomplen": 1020,
"totproc": 3,
"totrun": 1,
"totslpi": 2,
"totslpu": 0,
"totzomb": 0,
},
},
},
"file_sstat": {
"1.26": {
Expand Down Expand Up @@ -325,6 +376,30 @@
"sample_index": 4,
},
},
"2.6": {
"args": [
os.path.join(TEST_FILE_DIR, "atop_2_6.log.gz"),
],
"returns": {
"cpu": {
"nrcpu": 6,
"lavg1": 0.25,
},
"mem": {
"physmem": 2037722,
"freemem": 1526155,
},
"intf": {
"nrintf": 4,
"intf": [{"name": "lo"}],
},
"dsk": {
"ndsk": 17,
"dsk": [{"name": "nbd0"}],
},
"sample_index": 4,
},
},
},
"file_tstat": {
"1.26": {
Expand Down Expand Up @@ -379,6 +454,19 @@
"tstat_index": 2,
},
},
"2.6": {
"args": [
os.path.join(TEST_FILE_DIR, "atop_2_6.log.gz"),
],
"returns": {
"gen": {
"cmdline": "/mnt/pyatop/atop 1 5 -w /mnt/pyatop/atop_v2.6.0.log",
"name": "atop",
},
"sample_index": 4,
"tstat_index": 2,
},
},
},
"get_header": {
"Valid": {
Expand Down

0 comments on commit b713b29

Please sign in to comment.