<feed xmlns='http://www.w3.org/2005/Atom'>
<title>efi-boot-shim.git/mock-variables.c, branch rolling</title>
<subtitle> (mirror of https://github.com/vyos/efi-boot-shim.git)
</subtitle>
<id>https://git.amelek.net/vyos/efi-boot-shim.git/atom?h=rolling</id>
<link rel='self' href='https://git.amelek.net/vyos/efi-boot-shim.git/atom?h=rolling'/>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/efi-boot-shim.git/'/>
<updated>2025-02-24T20:26:20+00:00</updated>
<entry>
<title>test-mock-variables: improve some debug prints</title>
<updated>2025-02-24T20:26:20+00:00</updated>
<author>
<name>Peter Jones</name>
<email>pjones@redhat.com</email>
</author>
<published>2025-02-18T20:19:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/efi-boot-shim.git/commit/?id=f0958baa7cc0fcce0de09323d89dda7bf23afec3'/>
<id>urn:sha1:f0958baa7cc0fcce0de09323d89dda7bf23afec3</id>
<content type='text'>
This changes test-mock-variables and related code to not print all debug
messages at SHIM_DEBUG=1, and also adds some prints and comments for
context as to what's going on in the tests.

Signed-off-by: Peter Jones &lt;pjones@redhat.com&gt;
</content>
</entry>
<entry>
<title>mock-variables: fix debugging printf format specifier oopsie</title>
<updated>2025-02-24T20:26:20+00:00</updated>
<author>
<name>Peter Jones</name>
<email>pjones@redhat.com</email>
</author>
<published>2025-02-18T17:55:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/efi-boot-shim.git/commit/?id=e136e645d54983d2b5a89610d1565c23538ca1fa'/>
<id>urn:sha1:e136e645d54983d2b5a89610d1565c23538ca1fa</id>
<content type='text'>
This debug printf in our mock variable test code, which isn't normally
enabled, has a missing comma at the end of the format specifier.  This
causes __FILE__ to be part of the format specifier, which then means
we've got a missing parameter and also the types don't match up like
you'd hope.

This causes the most confusing segfaults.

Signed-off-by: Peter Jones &lt;pjones@redhat.com&gt;
</content>
</entry>
<entry>
<title>tests: make it possible to use different limits for variable space</title>
<updated>2025-01-17T22:17:20+00:00</updated>
<author>
<name>Peter Jones</name>
<email>pjones@redhat.com</email>
</author>
<published>2021-09-20T21:09:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/efi-boot-shim.git/commit/?id=f7e1d7226de8b9fc005257b8fede70093c547ad5'/>
<id>urn:sha1:f7e1d7226de8b9fc005257b8fede70093c547ad5</id>
<content type='text'>
This splits up the API for setting default usage limits, adding a test
API function to set alternate usage limits.

Signed-off-by: Peter Jones &lt;pjones@redhat.com&gt;
</content>
</entry>
<entry>
<title>Make mock_set_variable() correctly account for resource usage.</title>
<updated>2025-01-17T22:17:20+00:00</updated>
<author>
<name>Peter Jones</name>
<email>pjones@redhat.com</email>
</author>
<published>2021-09-20T21:06:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/efi-boot-shim.git/commit/?id=9229e7caea9133484aa18178cb713f2a2f1e93d0'/>
<id>urn:sha1:9229e7caea9133484aa18178cb713f2a2f1e93d0</id>
<content type='text'>
When SetVariable() is called, currently the test for being out of space
is correct, but the accounting is backwards - success adds more space
available.

This fixes the accounting and (with SHIM_DEBUG) logs the variable size.

Signed-off-by: Peter Jones &lt;pjones@redhat.com&gt;
</content>
</entry>
<entry>
<title>mock-variables.c: fix gcc warning</title>
<updated>2022-05-04T18:57:13+00:00</updated>
<author>
<name>Alexey Kodanev</name>
<email>aleksei.kodanev@bell-sw.com</email>
</author>
<published>2022-04-20T15:18:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/efi-boot-shim.git/commit/?id=4df989abdf893326cb866e153b24ddaf2b29d0d7'/>
<id>urn:sha1:4df989abdf893326cb866e153b24ddaf2b29d0d7</id>
<content type='text'>
$ make test

    ...
    mock-variables.c: In function 'mock_sv_attrs_match':
    mock-variables.c:448:23: error: conversion from 'long unsigned int' to 'UINT32'
        {aka 'unsigned int'} changes value from '18446744073709551551' to '4294967231' [-Werror=overflow]
      448 |         UINT32 mask = ~EFI_VARIABLE_APPEND_WRITE;
          |                       ^
    cc1: all warnings being treated as errors

Signed-off-by: Alexey Kodanev &lt;aleksei.kodanev@bell-sw.com&gt;
</content>
</entry>
<entry>
<title>tests: Add config table support</title>
<updated>2021-09-07T21:05:04+00:00</updated>
<author>
<name>Peter Jones</name>
<email>pjones@redhat.com</email>
</author>
<published>2021-07-26T21:29:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/efi-boot-shim.git/commit/?id=63a5ae1f7c9383f43e4431316eb0c77bcb079b98'/>
<id>urn:sha1:63a5ae1f7c9383f43e4431316eb0c77bcb079b98</id>
<content type='text'>
This adds a simple implementation of ST-&gt;ConfigurationTable,
ST-&gt;NumberOfTableEntries, and BS-&gt;InstallConfigurationTable  to our test
harness.

Currently it is limited at 1024 entries, but that should be well more
than enough for any tests we've currently considered.

Signed-off-by: Peter Jones &lt;pjones@redhat.com&gt;
</content>
</entry>
<entry>
<title>tests: add pre and post hooks to the mock variable store</title>
<updated>2021-09-07T21:05:04+00:00</updated>
<author>
<name>Peter Jones</name>
<email>pjones@redhat.com</email>
</author>
<published>2021-07-22T20:23:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/efi-boot-shim.git/commit/?id=3386d4f5b7cf63fba4b1ba9b1c2878617b141b23'/>
<id>urn:sha1:3386d4f5b7cf63fba4b1ba9b1c2878617b141b23</id>
<content type='text'>
For testing of the mok mirroring behavior, we have to be able to account
for what variable calls happened and in what order.

In order to support that, this patch adds 8 callbacks:

	mock_set_variable_pre_hook()
	mock_set_variable_post_hook()
	mock_get_variable_pre_hook()
	mock_get_variable_post_hook()
	mock_get_next_variable_name_pre_hook()
	mock_get_next_variable_name_post_hook()
	mock_query_variable_info_pre_hook()
	mock_query_variable_info_post_hook()

The pre hooks each take the same arguments as their mocked namesake, and
they fire before any input validation.  The post hooks take an
additional EFI_STATUS argument.  The post hook fires immediately before
any return from the mocked namesake function.  For SetVariable(), the
arguments when the post hook fires are the current contents of the
variable if status is EFI_SUCCESS, and whatever arguments were passed in
if status is any other value.  For everything else, the arguments are
the correct results on EFI_SUCCESS, and whatever was passed in if status
is any other value.

Signed-off-by: Peter Jones &lt;pjones@redhat.com&gt;
</content>
</entry>
<entry>
<title>tests: model different behaviors for deleting variables</title>
<updated>2021-09-07T21:05:04+00:00</updated>
<author>
<name>Peter Jones</name>
<email>pjones@redhat.com</email>
</author>
<published>2021-08-03T17:11:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/efi-boot-shim.git/commit/?id=54bc72cf0abd306d96782cdfa6db7c71ff72e056'/>
<id>urn:sha1:54bc72cf0abd306d96782cdfa6db7c71ff72e056</id>
<content type='text'>
Signed-off-by: Peter Jones &lt;pjones@redhat.com&gt;
</content>
</entry>
<entry>
<title>tests: add a mock implementation of {Get,Set}Variable and tests for it</title>
<updated>2021-09-07T21:05:04+00:00</updated>
<author>
<name>Peter Jones</name>
<email>pjones@redhat.com</email>
</author>
<published>2021-07-22T19:45:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/efi-boot-shim.git/commit/?id=2c9eebcf6ddd198c5ba49d784c4536d05023c28b'/>
<id>urn:sha1:2c9eebcf6ddd198c5ba49d784c4536d05023c28b</id>
<content type='text'>
Some tests will need variables, and so we need a mock implementation of
the various calls relating to them.

This patch adds implementations for the EFI Runtime Services calls
GetVariable(), SetVariable(), GetNextVariableName(), and
QueryVariableInfo().  Additionally, it enforces tunable limits on
storage for variables, and (with only a little work) the limits can be
different for SetVariable() vs what is returned by QueryVariableInfo().
That is, it can lie to you like real systems do.

Signed-off-by: Peter Jones &lt;pjones@redhat.com&gt;
</content>
</entry>
</feed>
