9d2a1c6a | 04-Jun-2023 |
Andrew Jeffery <andrew@aj.id.au> |
libpldm: Explicit deprecated, stable and testing ABI classes
Experimenting with new APIs is important, but ABI stability of the library is also important. We wish to have the freedom to add APIs wit
libpldm: Explicit deprecated, stable and testing ABI classes
Experimenting with new APIs is important, but ABI stability of the library is also important. We wish to have the freedom to add APIs without being burdened by them being immediately set in stone.
We implement this wish by introducing three classes of ABI:
1. deprecated 2. stable 3. testing
These are enforced by corresponding function attributes:
1. LIBPLDM_ABI_DEPRECATED 2. LIBPLDM_ABI_STABLE 3. LIBPLDM_ABI_TESTING
Symbol visibility in the library is flipped to 'hidden' by default, so one of these annotations must be used for the symbol to be exposed.
With these classes in place there are now clear points in time at which we update the ABI dumps captured under the abi/ directory: When an API is migrated from the 'testing' class to the 'stable' class, or when removed from the 'deprecated' class.
Which classes of functions are exposed by the build is controlled by the new 'abi' meson option. The option is of array type which contains the list of ABI classes the build should consider. It defaults to enabling all classes to provide test coverage in CI. The classes used should be constrained to deprecated and stable (and not test) in any dependent projects.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: I25402e20c7be9c9f264f9ccd7ac36b384823734c
show more ...
|
33e21a22 | 28-May-2023 |
Andrew Jeffery <andrew@aj.id.au> |
abi: Differentiate on architectures and compilers
aarch64 and x86_64 have different stack orderings for parameters to decode_get_date_time_resp() and decode_get_fru_record_table_metadata_resp(). Thi
abi: Differentiate on architectures and compilers
aarch64 and x86_64 have different stack orderings for parameters to decode_get_date_time_resp() and decode_get_fru_record_table_metadata_resp(). This triggers a false ABI break warning from abi-compliance-checker, as we weren't differentiating on architecture.
Rearrange the compliance check to support multiple architectures and compilers.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: Ida057dc69a5a6eb33304bf6ead236b1d12ab048e
show more ...
|
953bc8c1 | 22-May-2023 |
Andrew Jeffery <andrew@aj.id.au> |
libpldm: Enable API/ABI compliance checks
This catches breaks to the API and ABI of the library at compile time, providing feedback to developers that they should probably not be doing whatever it i
libpldm: Enable API/ABI compliance checks
This catches breaks to the API and ABI of the library at compile time, providing feedback to developers that they should probably not be doing whatever it is they have done.
abi-compliance-checker is only enabled if tests are enabled and the necessary external programs can be found. The check can be forcefully disabled with `-Dabi-compliance-check=disabled`.
A further constraint is that compliance is only checked with GCC. There are some minor issues with abi-compliance-checker if the new dump is generated with a different compiler (e.g. clang) to the reference dump. The GCC limitation will remain until I can find a comfortable way forward.
Below is an example of a detected violation where an existing API is changed:
``` $ git diff diff --git a/include/libpldm/platform.h b/include/libpldm/platform.h index ead3421af4f9..44654bc6f0c3 100644 --- a/include/libpldm/platform.h +++ b/include/libpldm/platform.h @@ -1385,7 +1385,7 @@ int encode_get_pdr_repository_info_resp( const uint8_t *update_time, const uint8_t *oem_update_time, uint32_t record_count, uint32_t repository_size, uint32_t largest_record_size, uint8_t data_transfer_handle_timeout, - struct pldm_msg *msg); + struct pldm_msg *msg, int test);
/** @brief Decode GetPDRRepositoryInfo response data * diff --git a/src/platform.c b/src/platform.c index 5da538cfa36e..69e5f87b0e41 100644 --- a/src/platform.c +++ b/src/platform.c @@ -366,7 +366,7 @@ int encode_get_pdr_repository_info_resp( const uint8_t *update_time, const uint8_t *oem_update_time, uint32_t record_count, uint32_t repository_size, uint32_t largest_record_size, uint8_t data_transfer_handle_timeout, - struct pldm_msg *msg) + struct pldm_msg *msg, int test __attribute__((unused))) { if (msg == NULL) { return PLDM_ERROR_INVALID_DATA; diff --git a/tests/libpldm_platform_test.cpp b/tests/libpldm_platform_test.cpp index 0b3370dec60e..6fc1dd005535 100644 --- a/tests/libpldm_platform_test.cpp +++ b/tests/libpldm_platform_test.cpp @@ -405,7 +405,7 @@ TEST(GetPDRRepositoryInfo, testGoodEncodeResponse) auto rc = encode_get_pdr_repository_info_resp( 0, PLDM_SUCCESS, repositoryState, updateTime, oemUpdateTime, recordCount, repositorySize, largestRecordSize, - dataTransferHandleTimeout, response); + dataTransferHandleTimeout, response, 1);
EXPECT_EQ(rc, PLDM_SUCCESS); struct pldm_pdr_repository_info_resp* resp = @@ -436,7 +436,7 @@ TEST(GetPDRRepositoryInfo, testBadEncodeResponse) auto rc = encode_get_pdr_repository_info_resp( 0, PLDM_SUCCESS, repositoryState, updateTime, oemUpdateTime, recordCount, repositorySize, largestRecordSize, - dataTransferHandleTimeout, nullptr); + dataTransferHandleTimeout, nullptr, 1); EXPECT_EQ(rc, PLDM_ERROR_INVALID_DATA); }
$ meson compile -C build INFO: autodetecting backend as ninja INFO: calculating backend command to run: /usr/bin/ninja -C /mnt/host/andrew/home/andrew/src/openbmc/libpldm/build ninja: Entering directory `/mnt/host/andrew/home/andrew/src/openbmc/libpldm/build' [9/10] Generating abi-dump with a custom command Detect public symbols Reading debug-info WARNING: a "Struct" type with no attributes detected in the DWARF dump (192) ERROR: invalid debug_loc section of object, please fix your elf utils ERROR: missed type id 13275 ERROR: missed type id 13632 ERROR: missed type id 11631 ERROR: missed type id 13540 ERROR: missed type id 702 ERROR: missed type id 60867 ERROR: missed type id 60369 ERROR: missed type id 30341 ERROR: missed type id 3570 ERROR: missed type id 3881 ERROR: missed type id 65373 ERROR: missed type id 66112 ERROR: missed type id 66916 Creating ABI dump
The object ABI has been dumped to: current.dump [10/10] Generating abi-compliance with a custom command FAILED: abi-compliance /usr/bin/abi-compliance-checker -l libpldm -old /mnt/host/andrew/home/andrew/src/openbmc/libpldm/abi/baseline.dump -new current.dump Preparing, please wait ... Comparing ABIs ... Comparing APIs ... Creating compatibility report ... Binary compatibility: 99.8% Source compatibility: 99.8% Total binary compatibility problems: 1, warnings: 0 Total source compatibility problems: 1, warnings: 0 Report: compat_reports/libpldm/0.2.0_to_0.2.0/compat_report.html ninja: build stopped: subcommand failed. ```
Change-Id: I72981ce48420eee970c3917059fbcbd350b00da9 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
show more ...
|