Commit Graph

97 Commits

Author SHA1 Message Date
Anna Schumaker 796cf6eec7 gtk: Create a TestCaseView and XfstestsView
The XfstestsView contains the TestCaseView, and will eventually contain
other views used to display test results and information.

For the moment, the TestCaseView displays the name of the testcases in a
single Xfstests run in a single column. I plan on adding more columns in
the near future.

Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
2023-08-14 13:27:22 -04:00
Anna Schumaker 4bce147e45 gtk: Create a LabelFactory
This is a Gtk.ListItemFactory that creates a Label widget and binds a
generic property to it.

Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
2023-08-14 10:17:10 -04:00
Anna Schumaker 7adbb5938d gtk: Add a TestCaseList Gio.ListModel
This is a list model designed to show xfstests results for a given
runid. I create a new one whenever the Application changes the runid.

Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
2023-08-14 10:17:10 -04:00
Anna Schumaker 15cee521c2 gtk: Add TestCase and XunitResult objects
These are the underlying GObjects that will be returned by a
TestCaseList ListModel.

Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
2023-08-14 10:17:10 -04:00
Anna Schumaker c1b73748f1 gtk: Add a window to the Application
This is an empty Adw.Window with a headerbar configured to display the
application name. I also bind the Application runid property to the
Window to print out the currently displayed run.

Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
2023-08-14 10:17:08 -04:00
Anna Schumaker d5413700f0 gtk: Give the gtk command a `runid` argument
This argument is passed to the Application using the 'command-line'
signal, so a running Application can switch to a new runid when
requested.

Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
2023-08-01 17:01:33 -04:00
Anna Schumaker 62bf603ca4 gtk: Add the `xfstestsdb gtk` command
This command doesn't do much at the moment, it simply sets up the Gtk
Application and then exits. The actual UI will be built up over the next
several patches.

Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
2023-08-01 17:01:29 -04:00
Anna Schumaker bea49c5eae xfstestsdb 1.2
Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
2023-07-26 11:27:32 -04:00
Anna Schumaker 14654dcf23 gc: Create the `xfstestsdb gc` command
This command is used to garbage collect the xfstestsdb sqlite database.
It removes xfstests runs that have no added xunits, and runs older than
180 days that have not been tagged.

Implements: #16 (`xfstestsdb gc`)
Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
2023-07-26 11:26:09 -04:00
Anna Schumaker 68a00ea94d xunit: Create the `xfstestsdb xunit gc` command
This command is used to garbage collect the xunit table by removing
xunits that have no testcases. This could be expanded on later to add
more removal conditions, such as xunits older than some age.

Implements: #15 (`xfstestsdb xunit gc`)
Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
2023-07-26 11:26:08 -04:00
Anna Schumaker c3eb740fb5 xunit delete: Xunit property performance improvements
I found that deleting an xunit from the database was very, very slow.
This patch addresses the issue by adding additional indexes on the
link_xunit_properties table to make it easier to find properties that
are still in use. I also rework the `cleanup_xunit_properties` trigger
to only check propids that were used by the deleted xunit.

Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
2023-07-25 12:42:30 -04:00
Anna Schumaker a168a7f84b xunit delete: Testcase message performance improvements
I found that deleting an xunit from the database was very, very slow.
This patch addresses the issue by adding additional indexes on the
testcases table to make it easier to find messages that are still in
use. I also rework the `cleanup_testcase_messages` trigger to only check
messageids that were used by the deleted testcase.

Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
2023-07-25 10:41:58 -04:00
Anna Schumaker 2082b904a0 sqlite: Add an upgrade script to database version 2
Right now it doesn't do any extra changes to the database besides
bumping the user_version to '2'. I'll fill it out over the next several
commits.

Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
2023-07-25 10:03:32 -04:00
Anna Schumaker 3f61adc941 sqlite: Give the Connection an executescript() function
This function builds on the built-in Python function, and adds in
opening and reading the file in a way that can be used for running
generic scripts on the database.

I also take this chance to move SQL scripts into a subdirectory to keep
them together.

Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
2023-07-25 09:54:31 -04:00
Anna Schumaker 14b848bddd xfstestsdb v1.1
- Updates for recent xfstests xunit generation changes
- Fix the `xunit delete` command
- Make sure SQLite foreign_keys are always enabled

Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
2023-04-17 15:58:00 -04:00
Anna Schumaker 5d141bd436 sqlite: Make sure foreign_keys are enabled
SQLite wants foreign_keys to be enabled for each connection, and doesn't
save this setting.

Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
2023-04-17 15:57:47 -04:00
Anna Schumaker 8a70fa6427 xunit: Fix `xunit delete`
xunit delete was incorrectly passing "rowid=" instead of "runid=" to the
sql DELETE statement.

Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
2023-04-17 14:35:29 -04:00
Anna Schumaker ee6c758943 xunit: Update read.py for the recent xunit changes
The xfstests xunit generation has been updated to include an xml
namespace and add some extra attributes to the root element. This broke
my xunit parsing code, which is fixed with this patch.

Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
2023-04-17 14:15:44 -04:00
Anna Schumaker b8460bfa60 Makefile: Add 'install' and 'uninstall' targets
I install to /usr/local by default, but this can be overridden by
setting PREFIX when running `make`

Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
2023-02-16 16:15:56 -05:00
Anna Schumaker 8311cbe478 Update 'README.md'
Update the README file for the initial release.

Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
2023-02-16 16:15:56 -05:00
Anna Schumaker 1996f3b798 xfstestsdb: Create the `xfstestsdb show` command
This command generates a table from the testcases that have been added
to a single run so the results of each testcase can be seen
side-by-side.

Implements: #9 (`xfstestsdb show`)
Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
2023-02-16 16:15:56 -05:00
Anna Schumaker a9a2c2bf7d testcase: Create the `xfstestsdb testcase show` command
This command shows detailed information about a specific testcase. The
'--maxlines=' option can be used to control the number of lines printed
from the system logs.

Implements: #13 (`xfstestsdb testcase show`)
Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
2023-02-16 16:15:56 -05:00
Anna Schumaker 489c08e55c testcase: Create the `xfstestsdb testcase list` command
This command prints out information about the known testcases. It has
extra options to filter by runid, device, xunit, testcase, and status.

Implements: #11 (`xfstestsdb testcase list`)
Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
2023-02-16 16:15:56 -05:00
Anna Schumaker 68a4b58a5a xfstestsdb: Add the `xfstestsdb testcase` subcommand
This subcomand doesn't actually do anything. It'll act as a hub for
testcase related subcommands instead.

Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
2023-02-16 16:15:56 -05:00
Anna Schumaker 3366c1eb0c xfstestsdb: Add testcases from the xunit file to the database
I use the testcases table to store testcase information, and store
messages, system out, and system error logs in the messages table.

The testcases_view is used to link testcases with their source xunits,
messages, system out, and system error logs. This view has an INSTEAD
OF INSERT trigger to allow insertions that properly set up message ids
in the testcases table.

Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
2023-02-16 16:15:55 -05:00
Anna Schumaker 84a7507998 xunit: Create the `xfstestsdb xunit properties` command
This command prints out (key, value) pairs for each xunit property in
the database. It has options to filter by runid, xunit name, property
name, and value.

Implements: #14 (`xfstestsdb xunit properties`)
Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
2023-02-16 14:22:32 -05:00
Anna Schumaker 29065d0f8f xfstestsdb: Add properties from the xunit file to the database
I use the xunit_properties table to store unique (key, value) pairs. The
link_xunit_properties table is then used to link properties to xunit
files.

I also make sure that properties are cleaned up when xunits are deleted,
but that we hang on to properties still in use by other xunits.

Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
2023-02-16 14:22:32 -05:00
Anna Schumaker e27bc9f5ae xfstestsdb: Create the `xfstestsdb xunit list` command
This command prints out information about the known xunit files. It has
extra options for filtering by runid, device, name, and hostname. I also
gave it optional Timestamp and Results columns that the user can enable.

Implements: #12 (`xfstestsdb xunit list`)
Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
2023-02-16 14:22:32 -05:00
Anna Schumaker f4b77f527b xfstestsdb: Add an 'Xunit' column to the `xfstestsdb list` table
This is an optional column that can be enabled by passing "--xunit" as
an option. The "--xunit" option takes an optional string that can be
used to filter results by a specific xunit pattern.

Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
2023-02-16 14:22:32 -05:00
Anna Schumaker 1b95487d06 xunit: Create the `xfstestsdb xunit delete` command
This command is used to delete individual xunit entries attached to a
specific xfstests run.

Implements: #5 (`xfstestsdb xunit delete`)
Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
2023-02-16 14:22:32 -05:00
Anna Schumaker 42ad3ad0fb xunit: Create the `xfstestsdb xunit rename` command
This command renames an xunit file associated with an xfstests run.

Implement: #4 (`xfstestsdb xunit rename`)
Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
2023-02-16 14:22:32 -05:00
Anna Schumaker ad48147a48 xfstestsdb: Make sure we clean up the xunits table
We need to delete xunit entries when their associated runs are deleted.

Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
2023-02-16 14:22:32 -05:00
Anna Schumaker 16399f375e xunit: Create the `xfstestsdb xunit read` command
This command reads an xunit file generated by passing "-R xunit" to
xfstests `./check`. Multiple xunit files can be added to a single
xfstests run, and will be shown side-by-side in columns when printed
out.

Implements: #3 (`xfstestsdb xunit read`)
Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
2023-02-16 14:22:32 -05:00
Anna Schumaker 35faa3a781 xfstestsdb: Add the `xfstestsdb xunit` subcommand
This subcommand doesn't actually do anything, it'll act as a hub for
xunit related subcommands instead.

Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
2023-02-15 15:57:38 -05:00
Anna Schumaker ceac28e943 xfstestsdb: Create the `xfstestsdb list` command
This uses the Table class to print out a list of xfstests runs in a
table. It supports '--device=', '--tags=', and '--timestamp=' options
that can be used to generate a SQLite GLOB expression to filter the
list of results.

Implements: #10 (`xfstestsdb list`)
Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
2023-02-15 15:57:37 -05:00
Anna Schumaker 456cef1090 xfstestsdb: Create a Table class
This class is designed to make it easy to print out data formatted as a
table. It was inspired by the prettytable Python module but is tailored
for how I intend to use it, including support for color schemes.

I use two different character sets for drawing borders. If color is
disabled, then I use basic ascii "+" and "-" characters. However, if
colors are enabled then I use characters from the Unicode Box Drawing
block to draw a table with rounded corners.

Finally, each table cell is formatted by calling the "do_format_cell()"
function. Table subclasses can override this function to implement their
own coloring schemes.

Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
2023-02-15 15:57:21 -05:00
Anna Schumaker 6529eb61f8 xfstestsdb: Create a ColorScheme class
This will be used by tools to print out text with colored outut. I
provide 3 options:

  * A NoneScheme for printing text without any formatting
  * A DarkScheme with colors chosen for a dark terminal
  * A LightScheme with colors chosen for a light terminal

Users can set the XFSTESTSDB_COLORS environment variable to either
"none", "dark", or "light". If this environment variable isn't set, or
if it is set to an invalid value, then xfstestsdb will use dark mode by
default.

Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
2023-02-15 15:57:19 -05:00
Anna Schumaker 6987a13f54 xfstestsdb: Create the `xfstestsdb delete` command
This command deletes a row from the xfstests_runs table and prints
either a success or failure message depending on if the row exists.

I use an sqlite trigger to automatically remove tags for the matching run.

Implements: #2 (`xfstestsdb delete`)
Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
2023-02-15 15:57:18 -05:00
Anna Schumaker b4043b2fa9 xfstestsdb: Create the `xfstestsdb untag` command
This is the opposite of `xfstestsdb tag`, and removes a tag from an
xfstests run.

Implements: #7 (`xfstestsdb untag`)
Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
2023-02-15 15:57:16 -05:00
Anna Schumaker 4e6c95b158 xfstestsdb: Create the `xfstestsdb tag` command
This lets us assign arbitrary text tags to an xfstests run.

Implements: #6 (`xfstestsdb tag`)
Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
2023-02-15 15:57:14 -05:00
Anna Schumaker 56774dbb85 xfstestsdb: Create the `xfstestsdb rename` command
This command renames the device in an xfstests_runs database row.

Implements: #8 (`xfstestsdb rename`)
Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
2023-02-15 15:56:44 -05:00
Anna Schumaker 6a6fe5dda8 xfstestsdb: Create the `xfstestsdb new` command
This command inserts a new row into the xfstests_runs table and prints
out the result.

Note that sqlite stores timestamps as UTC, so I use the datetime()
function to convert to localtime when returning the new row.

Implements: #1 (`xfstestsdb new`)
Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
2023-02-15 15:56:42 -05:00
Anna Schumaker 2a94b5e519 xfstestsdb: Create a generic Command class
This is intended to be used as a base class for implementing other
xfstestsdb commands.

Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
2023-02-15 11:52:42 -05:00
Anna Schumaker e3cf7e7017 xfstestsdb: Add a sqlite.Connection instance to the root Command
And take some extra steps to make sure we clean it up when the Command
is finished.

Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
2023-02-15 11:52:42 -05:00
Anna Schumaker 929c1dd5eb xfstestsdb: Create a custom sqlite3 Connection manager
The connection manager is used to initialize the database and has a
wrapper around the sqlite3.execute() and sqlite3.executemany() functions
for easier argument passing.

Additionally, it implements __enter__() and __exit__() functions to
manually begin a transaction to calls can use the sqlite3 "RETURNING"
clause.

Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
2023-02-15 11:52:41 -05:00
Anna Schumaker c210eff9b9 xfstestsdb: Create the root xfstestsdb Command
Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
2023-02-13 12:01:46 -05:00
Anna Schumaker bc8b6bdff8 Initial commit 2023-01-30 10:15:47 -05:00