#endif
static int verbosity_level;
+static GArray *load_expected_aml(test_data *data);
static bool compare_signature(const AcpiSdtTable *sdt, const char *signature)
{
static void dump_aml_files(test_data *data, bool rebuild)
{
- AcpiSdtTable *sdt;
+ AcpiSdtTable *sdt, *exp_sdt;
GError *error = NULL;
gchar *aml_file = NULL;
+ test_data exp_data = {};
gint fd;
ssize_t ret;
int i;
+ exp_data.tables = load_expected_aml(data);
for (i = 0; i < data->tables->len; ++i) {
const char *ext = data->variant ? data->variant : "";
sdt = &g_array_index(data->tables, AcpiSdtTable, i);
+ exp_sdt = &g_array_index(exp_data.tables, AcpiSdtTable, i);
g_assert(sdt->aml);
+ g_assert(exp_sdt->aml);
if (rebuild) {
aml_file = g_strdup_printf("%s/%s/%.4s%s", data_dir, data->machine,
sdt->aml, ext);
+ if (!g_file_test(aml_file, G_FILE_TEST_EXISTS) &&
+ sdt->aml_len == exp_sdt->aml_len &&
+ !memcmp(sdt->aml, exp_sdt->aml, sdt->aml_len)) {
+ /* identical tables, no need to write new files */
+ g_free(aml_file);
+ continue;
+ }
fd = g_open(aml_file, O_WRONLY|O_TRUNC|O_CREAT,
S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH);
if (fd < 0) {