diff --git a/CHANGELOG.md b/CHANGELOG.md index d8437c16a..e4572e768 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ **Features**: +- Add Linux distributions to the OS context. [#963](https://github.com/getsentry/sentry-native/pull/963) - Change the timestamp resolution to microseconds. ([#995](https://github.com/getsentry/sentry-native/pull/995)) ## 0.7.4 diff --git a/src/modulefinder/sentry_modulefinder_linux.c b/src/modulefinder/sentry_modulefinder_linux.c index 1ae8e2b73..6d5f0b273 100644 --- a/src/modulefinder/sentry_modulefinder_linux.c +++ b/src/modulefinder/sentry_modulefinder_linux.c @@ -7,6 +7,7 @@ #include "sentry_path.h" #include "sentry_string.h" #include "sentry_sync.h" +#include "sentry_utils.h" #include "sentry_value.h" #include @@ -31,8 +32,6 @@ process_vm_readv(pid_t __pid, const struct iovec *__local_iov, } #endif -#define MIN(a, b) ((a) < (b) ? (a) : (b)) - #define ENSURE(Ptr) \ if (!Ptr) \ goto fail diff --git a/src/sentry_os.c b/src/sentry_os.c index 66434863b..eddbbe275 100644 --- a/src/sentry_os.c +++ b/src/sentry_os.c @@ -1,6 +1,12 @@ #include "sentry_os.h" +#include "sentry_slice.h" #include "sentry_string.h" -#include "sentry_utils.h" +#if defined(SENTRY_PLATFORM_LINUX) || defined(SENTRY_PLATFORM_WINDOWS) +# include "sentry_utils.h" +#endif +#ifdef SENTRY_PLATFORM_LINUX +# include +#endif #ifdef SENTRY_PLATFORM_WINDOWS @@ -228,8 +234,123 @@ sentry__get_os_context(void) } #elif defined(SENTRY_PLATFORM_UNIX) +# include # include +# if defined(SENTRY_PLATFORM_LINUX) +# define OS_RELEASE_MAX_LINE_SIZE 256 +# define OS_RELEASE_MAX_KEY_SIZE 64 +# define OS_RELEASE_MAX_VALUE_SIZE 128 + +static int +parse_os_release_line(const char *line, char *key, char *value) +{ + const char *equals = strchr(line, '='); + if (equals == NULL) + return 1; + + unsigned long key_length = MIN(equals - line, OS_RELEASE_MAX_KEY_SIZE - 1); + strncpy(key, line, key_length); + key[key_length] = '\0'; + + sentry_slice_t value_slice + = { .ptr = equals + 1, .len = strlen(equals + 1) }; + + // some values are wrapped in double quotes + if (value_slice.ptr[0] == '\"') { + value_slice.ptr++; + value_slice.len -= 2; + } + + sentry__slice_to_buffer(value_slice, value, OS_RELEASE_MAX_VALUE_SIZE); + + return 0; +} + +static void +parse_line_into_object(const char *line, sentry_value_t os_dist) +{ + char value[OS_RELEASE_MAX_VALUE_SIZE]; + char key[OS_RELEASE_MAX_KEY_SIZE]; + + if (parse_os_release_line(line, key, value) == 0) { + if (strcmp(key, "ID") == 0) { + sentry_value_set_by_key( + os_dist, "name", sentry_value_new_string(value)); + } + + if (strcmp(key, "VERSION_ID") == 0) { + sentry_value_set_by_key( + os_dist, "version", sentry_value_new_string(value)); + } + + if (strcmp(key, "PRETTY_NAME") == 0) { + sentry_value_set_by_key( + os_dist, "pretty_name", sentry_value_new_string(value)); + } + } +} + +# ifndef SENTRY_UNITTEST +static +# endif + sentry_value_t + get_linux_os_release(const char *os_rel_path) +{ + const int fd = open(os_rel_path, O_RDONLY); + if (fd == -1) { + return sentry_value_new_null(); + } + + sentry_value_t os_dist = sentry_value_new_object(); + char buffer[OS_RELEASE_MAX_LINE_SIZE]; + ssize_t bytes_read; + ssize_t buffer_rest = 0; + const char *line = buffer; + while ((bytes_read = read( + fd, buffer + buffer_rest, sizeof(buffer) - buffer_rest - 1)) + > 0) { + ssize_t buffer_end = buffer_rest + bytes_read; + buffer[buffer_end] = '\0'; + + // extract all lines from the valid buffer-range and parse them + for (char *p = buffer; *p; ++p) { + if (*p != '\n') { + continue; + } + *p = '\0'; + parse_line_into_object(line, os_dist); + line = p + 1; + } + + if (line < buffer + buffer_end) { + // move the remaining partial line to the start of the buffer + buffer_rest = buffer + buffer_end - line; + memmove(buffer, line, buffer_rest); + } else { + // reset buffer_rest: the line-end coincided with the buffer-end + buffer_rest = 0; + } + line = buffer; + } + + if (bytes_read == -1) { + // read() failed and we can't assume to have valid data + sentry_value_decref(os_dist); + os_dist = sentry_value_new_null(); + } else if (buffer_rest > 0) { + // the file ended w/o a new-line; we still have a line left to parse + buffer[buffer_rest] = '\0'; + parse_line_into_object(line, os_dist); + } + + close(fd); + + return os_dist; +} + +# endif // defined(SENTRY_PLATFORM_LINUX) + sentry_value_t sentry__get_os_context(void) { @@ -270,6 +391,35 @@ sentry__get_os_context(void) sentry_value_set_by_key( os, "version", sentry_value_new_string(uts.release)); +# if defined(SENTRY_PLATFORM_LINUX) + /** + * The file /etc/os-release takes precedence over /usr/lib/os-release. + * Applications should check for the former, and exclusively use its data if + * it exists, and only fall back to /usr/lib/os-release if it is missing. + * Applications should not read data from both files at the same time. + * + * From: + * https://www.freedesktop.org/software/systemd/man/latest/os-release.html#Description + */ + sentry_value_t os_dist = get_linux_os_release("/etc/os-release"); + if (sentry_value_is_null(os_dist)) { + os_dist = get_linux_os_release("/usr/lib/os-release"); + if (sentry_value_is_null(os_dist)) { + return os; + } + } + sentry_value_set_by_key( + os, "distribution_name", sentry_value_get_by_key(os_dist, "name")); + sentry_value_set_by_key(os, "distribution_version", + sentry_value_get_by_key(os_dist, "version")); + sentry_value_set_by_key(os, "distribution_pretty_name", + sentry_value_get_by_key(os_dist, "pretty_name")); + sentry_value_incref(sentry_value_get_by_key(os_dist, "name")); + sentry_value_incref(sentry_value_get_by_key(os_dist, "version")); + sentry_value_incref(sentry_value_get_by_key(os_dist, "pretty_name")); + sentry_value_decref(os_dist); +# endif // defined(SENTRY_PLATFORM_LINUX) + return os; fail: diff --git a/src/sentry_slice.c b/src/sentry_slice.c index 0f68311b2..9e80a1355 100644 --- a/src/sentry_slice.c +++ b/src/sentry_slice.c @@ -1,5 +1,6 @@ #include "sentry_slice.h" #include "sentry_string.h" +#include "sentry_utils.h" #include #include @@ -18,6 +19,14 @@ sentry__slice_to_owned(sentry_slice_t slice) return sentry__string_clone_n_unchecked(slice.ptr, slice.len); } +void +sentry__slice_to_buffer(sentry_slice_t slice, char *buffer, size_t buffer_len) +{ + size_t copy_len = MIN(slice.len, buffer_len - 1); + strncpy(buffer, slice.ptr, copy_len); + buffer[copy_len] = 0; +} + bool sentry__slice_eq(sentry_slice_t a, sentry_slice_t b) { diff --git a/src/sentry_slice.h b/src/sentry_slice.h index 2681446a7..182a73559 100644 --- a/src/sentry_slice.h +++ b/src/sentry_slice.h @@ -20,6 +20,14 @@ typedef struct { */ sentry_slice_t sentry__slice_from_str(const char *str); +/** + * Copies a slice to a pre-allocated buffer. The resulting buffer will contain a + * zero-terminated string. `buffer_len` is expected to be the full length of the + * buffer, so the resulting string can at maximum be `buffer_len - 1` long. + */ +void sentry__slice_to_buffer( + sentry_slice_t slice, char *buffer, size_t buffer_len); + /** * Creates an owned copy from a slice. */ diff --git a/src/sentry_utils.h b/src/sentry_utils.h index 41678d7d4..e69f05e19 100644 --- a/src/sentry_utils.h +++ b/src/sentry_utils.h @@ -14,6 +14,9 @@ # include #endif +#define MIN(a, b) ((a) < (b) ? (a) : (b)) +#define MAX(a, b) ((a) > (b) ? (a) : (b)) + /** * This represents a URL parsed into its different parts. */ diff --git a/tests/assertions.py b/tests/assertions.py index de6320e27..c020846b8 100644 --- a/tests/assertions.py +++ b/tests/assertions.py @@ -102,6 +102,8 @@ def assert_meta( event["contexts"]["os"], {"name": "Linux", "version": version, "build": build}, ) + assert "distribution_name" in event["contexts"]["os"] + assert "distribution_version" in event["contexts"]["os"] elif sys.platform == "darwin": version = platform.mac_ver()[0].split(".") if len(version) < 3: diff --git a/tests/fixtures/os_releases/LICENSE b/tests/fixtures/os_releases/LICENSE new file mode 100644 index 000000000..261eeb9e9 --- /dev/null +++ b/tests/fixtures/os_releases/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/tests/fixtures/os_releases/README.md b/tests/fixtures/os_releases/README.md new file mode 100644 index 000000000..f2f756aba --- /dev/null +++ b/tests/fixtures/os_releases/README.md @@ -0,0 +1,13 @@ +# os_release + +Adapted from https://github.com/chef/os_release as data for unit-testing. + +This repo contains the /etc/os-release file from Linux distros. + +## About os-release + +/etc/os-release is a standard Linux file used to identify the OS, os release, and similar distros. It's now a standard file in systemd distros, but it can be found in just about every Linux distro released over the last 3-4 years. + +## Why collect them + +The fields in /etc/os-release are standardized, but the values are not. The only way to know that Redhat Enterprise Linux is 'rhel' or that openSUSE 15 is 'opensuse-leap' is to install the distros and check the file. This repo is a large collection of os-release files so you don't need to install each and every distro. diff --git a/tests/fixtures/os_releases/alma_8 b/tests/fixtures/os_releases/alma_8 new file mode 100644 index 000000000..d483909db --- /dev/null +++ b/tests/fixtures/os_releases/alma_8 @@ -0,0 +1,18 @@ +NAME="AlmaLinux" +VERSION="8.7 (Stone Smilodon)" +ID="almalinux" +ID_LIKE="rhel centos fedora" +VERSION_ID="8.7" +PLATFORM_ID="platform:el8" +PRETTY_NAME="AlmaLinux 8.7 (Stone Smilodon)" +ANSI_COLOR="0;34" +LOGO="fedora-logo-icon" +CPE_NAME="cpe:/o:almalinux:almalinux:8::baseos" +HOME_URL="https://almalinux.org/" +DOCUMENTATION_URL="https://wiki.almalinux.org/" +BUG_REPORT_URL="https://bugs.almalinux.org/" + +ALMALINUX_MANTISBT_PROJECT="AlmaLinux-8" +ALMALINUX_MANTISBT_PROJECT_VERSION="8.7" +REDHAT_SUPPORT_PRODUCT="AlmaLinux" +REDHAT_SUPPORT_PRODUCT_VERSION="8.7" diff --git a/tests/fixtures/os_releases/alma_9 b/tests/fixtures/os_releases/alma_9 new file mode 100644 index 000000000..e3210a0f6 --- /dev/null +++ b/tests/fixtures/os_releases/alma_9 @@ -0,0 +1,18 @@ +NAME="AlmaLinux" +VERSION="9.1 (Lime Lynx)" +ID="almalinux" +ID_LIKE="rhel centos fedora" +VERSION_ID="9.1" +PLATFORM_ID="platform:el9" +PRETTY_NAME="AlmaLinux 9.1 (Lime Lynx)" +ANSI_COLOR="0;34" +LOGO="fedora-logo-icon" +CPE_NAME="cpe:/o:almalinux:almalinux:9::baseos" +HOME_URL="https://almalinux.org/" +DOCUMENTATION_URL="https://wiki.almalinux.org/" +BUG_REPORT_URL="https://bugs.almalinux.org/" + +ALMALINUX_MANTISBT_PROJECT="AlmaLinux-9" +ALMALINUX_MANTISBT_PROJECT_VERSION="9.1" +REDHAT_SUPPORT_PRODUCT="AlmaLinux" +REDHAT_SUPPORT_PRODUCT_VERSION="9.1" diff --git a/tests/fixtures/os_releases/alpine_3_10 b/tests/fixtures/os_releases/alpine_3_10 new file mode 100644 index 000000000..2f0d61a43 --- /dev/null +++ b/tests/fixtures/os_releases/alpine_3_10 @@ -0,0 +1,6 @@ +NAME="Alpine Linux" +ID=alpine +VERSION_ID=3.10.9 +PRETTY_NAME="Alpine Linux v3.10" +HOME_URL="https://alpinelinux.org/" +BUG_REPORT_URL="https://bugs.alpinelinux.org/" diff --git a/tests/fixtures/os_releases/alpine_3_11 b/tests/fixtures/os_releases/alpine_3_11 new file mode 100644 index 000000000..9725c6f7e --- /dev/null +++ b/tests/fixtures/os_releases/alpine_3_11 @@ -0,0 +1,6 @@ +NAME="Alpine Linux" +ID=alpine +VERSION_ID=3.11.13 +PRETTY_NAME="Alpine Linux v3.11" +HOME_URL="https://alpinelinux.org/" +BUG_REPORT_URL="https://bugs.alpinelinux.org/" diff --git a/tests/fixtures/os_releases/alpine_3_12 b/tests/fixtures/os_releases/alpine_3_12 new file mode 100644 index 000000000..18b984f1f --- /dev/null +++ b/tests/fixtures/os_releases/alpine_3_12 @@ -0,0 +1,6 @@ +NAME="Alpine Linux" +ID=alpine +VERSION_ID=3.12.12 +PRETTY_NAME="Alpine Linux v3.12" +HOME_URL="https://alpinelinux.org/" +BUG_REPORT_URL="https://bugs.alpinelinux.org/" diff --git a/tests/fixtures/os_releases/alpine_3_13 b/tests/fixtures/os_releases/alpine_3_13 new file mode 100644 index 000000000..e95288ebb --- /dev/null +++ b/tests/fixtures/os_releases/alpine_3_13 @@ -0,0 +1,6 @@ +NAME="Alpine Linux" +ID=alpine +VERSION_ID=3.13.12 +PRETTY_NAME="Alpine Linux v3.13" +HOME_URL="https://alpinelinux.org/" +BUG_REPORT_URL="https://bugs.alpinelinux.org/" diff --git a/tests/fixtures/os_releases/alpine_3_14 b/tests/fixtures/os_releases/alpine_3_14 new file mode 100644 index 000000000..36b632a14 --- /dev/null +++ b/tests/fixtures/os_releases/alpine_3_14 @@ -0,0 +1,6 @@ +NAME="Alpine Linux" +ID=alpine +VERSION_ID=3.14.9 +PRETTY_NAME="Alpine Linux v3.14" +HOME_URL="https://alpinelinux.org/" +BUG_REPORT_URL="https://bugs.alpinelinux.org/" diff --git a/tests/fixtures/os_releases/alpine_3_15 b/tests/fixtures/os_releases/alpine_3_15 new file mode 100644 index 000000000..b0b5951ea --- /dev/null +++ b/tests/fixtures/os_releases/alpine_3_15 @@ -0,0 +1,6 @@ +NAME="Alpine Linux" +ID=alpine +VERSION_ID=3.15.7 +PRETTY_NAME="Alpine Linux v3.15" +HOME_URL="https://alpinelinux.org/" +BUG_REPORT_URL="https://bugs.alpinelinux.org/" diff --git a/tests/fixtures/os_releases/alpine_3_16 b/tests/fixtures/os_releases/alpine_3_16 new file mode 100644 index 000000000..7d4d5455d --- /dev/null +++ b/tests/fixtures/os_releases/alpine_3_16 @@ -0,0 +1,6 @@ +NAME="Alpine Linux" +ID=alpine +VERSION_ID=3.16.4 +PRETTY_NAME="Alpine Linux v3.16" +HOME_URL="https://alpinelinux.org/" +BUG_REPORT_URL="https://gitlab.alpinelinux.org/alpine/aports/-/issues" diff --git a/tests/fixtures/os_releases/alpine_3_17 b/tests/fixtures/os_releases/alpine_3_17 new file mode 100644 index 000000000..5e15703cd --- /dev/null +++ b/tests/fixtures/os_releases/alpine_3_17 @@ -0,0 +1,6 @@ +NAME="Alpine Linux" +ID=alpine +VERSION_ID=3.17.2 +PRETTY_NAME="Alpine Linux v3.17" +HOME_URL="https://alpinelinux.org/" +BUG_REPORT_URL="https://gitlab.alpinelinux.org/alpine/aports/-/issues" diff --git a/tests/fixtures/os_releases/alpine_3_8 b/tests/fixtures/os_releases/alpine_3_8 new file mode 100644 index 000000000..148fe2cb5 --- /dev/null +++ b/tests/fixtures/os_releases/alpine_3_8 @@ -0,0 +1,6 @@ +NAME="Alpine Linux" +ID=alpine +VERSION_ID=3.8.5 +PRETTY_NAME="Alpine Linux v3.8" +HOME_URL="http://alpinelinux.org" +BUG_REPORT_URL="http://bugs.alpinelinux.org" diff --git a/tests/fixtures/os_releases/alpine_3_9 b/tests/fixtures/os_releases/alpine_3_9 new file mode 100644 index 000000000..7f651a622 --- /dev/null +++ b/tests/fixtures/os_releases/alpine_3_9 @@ -0,0 +1,6 @@ +NAME="Alpine Linux" +ID=alpine +VERSION_ID=3.9.6 +PRETTY_NAME="Alpine Linux v3.9" +HOME_URL="https://alpinelinux.org/" +BUG_REPORT_URL="https://bugs.alpinelinux.org/" diff --git a/tests/fixtures/os_releases/amazon_2 b/tests/fixtures/os_releases/amazon_2 new file mode 100644 index 000000000..07a45072f --- /dev/null +++ b/tests/fixtures/os_releases/amazon_2 @@ -0,0 +1,9 @@ +NAME="Amazon Linux" +VERSION="2" +ID="amzn" +ID_LIKE="centos rhel fedora" +VERSION_ID="2" +PRETTY_NAME="Amazon Linux 2" +ANSI_COLOR="0;33" +CPE_NAME="cpe:2.3:o:amazon:amazon_linux:2" +HOME_URL="https://amazonlinux.com/" diff --git a/tests/fixtures/os_releases/amazon_2018 b/tests/fixtures/os_releases/amazon_2018 new file mode 100644 index 000000000..b2b1a0796 --- /dev/null +++ b/tests/fixtures/os_releases/amazon_2018 @@ -0,0 +1,9 @@ +NAME="Amazon Linux AMI" +VERSION="2018.03" +ID="amzn" +ID_LIKE="rhel fedora" +VERSION_ID="2018.03" +PRETTY_NAME="Amazon Linux AMI 2018.03" +ANSI_COLOR="0;33" +CPE_NAME="cpe:/o:amazon:linux:2018.03:ga" +HOME_URL="http://aws.amazon.com/amazon-linux-ami/" diff --git a/tests/fixtures/os_releases/amazon_2022 b/tests/fixtures/os_releases/amazon_2022 new file mode 100644 index 000000000..5bf88b1e0 --- /dev/null +++ b/tests/fixtures/os_releases/amazon_2022 @@ -0,0 +1,12 @@ +NAME="Amazon Linux" +VERSION="2022" +ID="amzn" +ID_LIKE="fedora" +VERSION_ID="2022" +PLATFORM_ID="platform:al2022" +PRETTY_NAME="Amazon Linux 2022" +ANSI_COLOR="0;33" +CPE_NAME="cpe:2.3:o:amazon:amazon_linux:2022" +HOME_URL="https://aws.amazon.com/linux/" +BUG_REPORT_URL="https://github.com/amazonlinux/amazon-linux-2022" +SUPPORT_END="2027-11-01" diff --git a/tests/fixtures/os_releases/antergos b/tests/fixtures/os_releases/antergos new file mode 100644 index 000000000..2d2ef127b --- /dev/null +++ b/tests/fixtures/os_releases/antergos @@ -0,0 +1,10 @@ +NAME="Antergos Linux" +VERSION="18.11-ISO-Rolling" +ID="antergos" +ID_LIKE="arch" +PRETTY_NAME="Antergos Linux" +CPE_NAME="cpe:/o:antergosproject:antergos:18.11" +ANSI_COLOR="1;34;40" +HOME_URL="https://antergos.com/" +SUPPORT_URL="https://forum.antergos.com/" +BUG_REPORT_URL="https://github.com/antergos" diff --git a/tests/fixtures/os_releases/arch b/tests/fixtures/os_releases/arch new file mode 100644 index 000000000..7a40967b3 --- /dev/null +++ b/tests/fixtures/os_releases/arch @@ -0,0 +1,11 @@ +NAME="Arch Linux" +PRETTY_NAME="Arch Linux" +ID=arch +BUILD_ID=rolling +VERSION_ID=TEMPLATE_VERSION_ID +ANSI_COLOR="38;2;23;147;209" +HOME_URL="https://archlinux.org/" +DOCUMENTATION_URL="https://wiki.archlinux.org/" +SUPPORT_URL="https://bbs.archlinux.org/" +BUG_REPORT_URL="https://bugs.archlinux.org/" +PRIVACY_POLICY_URL="https://terms.archlinux.org/docs/privacy-policy/" diff --git a/tests/fixtures/os_releases/archarm b/tests/fixtures/os_releases/archarm new file mode 100644 index 000000000..20ed38e29 --- /dev/null +++ b/tests/fixtures/os_releases/archarm @@ -0,0 +1,11 @@ +NAME="Arch Linux ARM" +PRETTY_NAME="Arch Linux ARM" +ID=archarm +ID_LIKE=arch +BUILD_ID=rolling +ANSI_COLOR="0;36" +HOME_URL="https://archlinuxarm.org/" +DOCUMENTATION_URL="https://archlinuxarm.org/wiki" +SUPPORT_URL="https://archlinuxarm.org/forum" +BUG_REPORT_URL="https://github.com/archlinuxarm/PKGBUILDs/issues" +LOGO=archlinux diff --git a/tests/fixtures/os_releases/arcolinux b/tests/fixtures/os_releases/arcolinux new file mode 100644 index 000000000..424c2c330 --- /dev/null +++ b/tests/fixtures/os_releases/arcolinux @@ -0,0 +1,9 @@ +NAME=ArcoLinux +ID=arcolinux +ID_LIKE=arch +BUILD_ID=rolling +ANSI_COLOR="0;36" +HOME_URL="https://arcolinux.info/" +SUPPORT_URL="https://arcolinuxforum.com/" +BUG_REPORT_URL="https://github.com/arcolinux" +LOGO=arcolinux-hello \ No newline at end of file diff --git a/tests/fixtures/os_releases/centos_7 b/tests/fixtures/os_releases/centos_7 new file mode 100644 index 000000000..c276e3ae5 --- /dev/null +++ b/tests/fixtures/os_releases/centos_7 @@ -0,0 +1,15 @@ +NAME="CentOS Linux" +VERSION="7 (Core)" +ID="centos" +ID_LIKE="rhel fedora" +VERSION_ID="7" +PRETTY_NAME="CentOS Linux 7 (Core)" +ANSI_COLOR="0;31" +CPE_NAME="cpe:/o:centos:centos:7" +HOME_URL="https://www.centos.org/" +BUG_REPORT_URL="https://bugs.centos.org/" + +CENTOS_MANTISBT_PROJECT="CentOS-7" +CENTOS_MANTISBT_PROJECT_VERSION="7" +REDHAT_SUPPORT_PRODUCT="centos" +REDHAT_SUPPORT_PRODUCT_VERSION="7" diff --git a/tests/fixtures/os_releases/centos_8 b/tests/fixtures/os_releases/centos_8 new file mode 100644 index 000000000..8e89cd340 --- /dev/null +++ b/tests/fixtures/os_releases/centos_8 @@ -0,0 +1,13 @@ +NAME="CentOS Linux" +VERSION="8" +ID="centos" +ID_LIKE="rhel fedora" +VERSION_ID="8" +PLATFORM_ID="platform:el8" +PRETTY_NAME="CentOS Linux 8" +ANSI_COLOR="0;31" +CPE_NAME="cpe:/o:centos:centos:8" +HOME_URL="https://centos.org/" +BUG_REPORT_URL="https://bugs.centos.org/" +CENTOS_MANTISBT_PROJECT="CentOS-8" +CENTOS_MANTISBT_PROJECT_VERSION="8" diff --git a/tests/fixtures/os_releases/centos_stream_8 b/tests/fixtures/os_releases/centos_stream_8 new file mode 100644 index 000000000..8948e12f4 --- /dev/null +++ b/tests/fixtures/os_releases/centos_stream_8 @@ -0,0 +1,13 @@ +NAME="CentOS Stream" +VERSION="8" +ID="centos" +ID_LIKE="rhel fedora" +VERSION_ID="8" +PLATFORM_ID="platform:el8" +PRETTY_NAME="CentOS Stream 8" +ANSI_COLOR="0;31" +CPE_NAME="cpe:/o:centos:centos:8" +HOME_URL="https://centos.org/" +BUG_REPORT_URL="https://bugzilla.redhat.com/" +REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux 8" +REDHAT_SUPPORT_PRODUCT_VERSION="CentOS Stream" diff --git a/tests/fixtures/os_releases/clearlinux_1 b/tests/fixtures/os_releases/clearlinux_1 new file mode 100644 index 000000000..849fa04a7 --- /dev/null +++ b/tests/fixtures/os_releases/clearlinux_1 @@ -0,0 +1,12 @@ +NAME="Clear Linux OS" +VERSION=1 +ID=clear-linux-os +ID_LIKE=clear-linux-os +VERSION_ID=38250 +PRETTY_NAME="Clear Linux OS" +ANSI_COLOR="1;35" +HOME_URL="https://clearlinux.org" +SUPPORT_URL="https://clearlinux.org" +BUG_REPORT_URL="mailto:dev@lists.clearlinux.org" +PRIVACY_POLICY_URL="http://www.intel.com/privacy" +BUILD_ID=38250 diff --git a/tests/fixtures/os_releases/clearos_7 b/tests/fixtures/os_releases/clearos_7 new file mode 100644 index 000000000..c1554d902 --- /dev/null +++ b/tests/fixtures/os_releases/clearos_7 @@ -0,0 +1,10 @@ +NAME="ClearOS" +VERSION="7 (Final)" +ID="clearos" +ID_LIKE="rhel fedora" +VERSION_ID="7" +PRETTY_NAME="ClearOS 7 (Final)" +ANSI_COLOR="0;31" +CPE_NAME="cpe:/o:clearos:clearos:7" +HOME_URL="https://www.clearos.com/" +BUG_REPORT_URL="https://tracker.clearos.com/" diff --git a/tests/fixtures/os_releases/cumulus_3_7 b/tests/fixtures/os_releases/cumulus_3_7 new file mode 100644 index 000000000..4814f4438 --- /dev/null +++ b/tests/fixtures/os_releases/cumulus_3_7 @@ -0,0 +1,9 @@ +NAME="Cumulus Linux" +VERSION_ID=3.7.2 +VERSION="Cumulus Linux 3.7.2" +PRETTY_NAME="Cumulus Linux" +ID=cumulus-linux +ID_LIKE=debian +CPE_NAME=cpe:/o:cumulusnetworks:cumulus_linux:3.7.2 +HOME_URL="http://www.cumulusnetworks.com/" +SUPPORT_URL="http://support.cumulusnetworks.com/" diff --git a/tests/fixtures/os_releases/debian_10 b/tests/fixtures/os_releases/debian_10 new file mode 100644 index 000000000..9b5419df8 --- /dev/null +++ b/tests/fixtures/os_releases/debian_10 @@ -0,0 +1,9 @@ +PRETTY_NAME="Debian GNU/Linux 10 (buster)" +NAME="Debian GNU/Linux" +VERSION_ID="10" +VERSION="10 (buster)" +VERSION_CODENAME=buster +ID=debian +HOME_URL="https://www.debian.org/" +SUPPORT_URL="https://www.debian.org/support" +BUG_REPORT_URL="https://bugs.debian.org/" diff --git a/tests/fixtures/os_releases/debian_11 b/tests/fixtures/os_releases/debian_11 new file mode 100644 index 000000000..611cf746b --- /dev/null +++ b/tests/fixtures/os_releases/debian_11 @@ -0,0 +1,9 @@ +PRETTY_NAME="Debian GNU/Linux 11 (bullseye)" +NAME="Debian GNU/Linux" +VERSION_ID="11" +VERSION="11 (bullseye)" +VERSION_CODENAME=bullseye +ID=debian +HOME_URL="https://www.debian.org/" +SUPPORT_URL="https://www.debian.org/support" +BUG_REPORT_URL="https://bugs.debian.org/" diff --git a/tests/fixtures/os_releases/debian_7 b/tests/fixtures/os_releases/debian_7 new file mode 100644 index 000000000..c110e3bc1 --- /dev/null +++ b/tests/fixtures/os_releases/debian_7 @@ -0,0 +1,9 @@ +PRETTY_NAME="Debian GNU/Linux 7 (wheezy)" +NAME="Debian GNU/Linux" +VERSION_ID="7" +VERSION="7 (wheezy)" +ID=debian +ANSI_COLOR="1;31" +HOME_URL="http://www.debian.org/" +SUPPORT_URL="http://www.debian.org/support/" +BUG_REPORT_URL="http://bugs.debian.org/" diff --git a/tests/fixtures/os_releases/debian_8 b/tests/fixtures/os_releases/debian_8 new file mode 100644 index 000000000..120c51b08 --- /dev/null +++ b/tests/fixtures/os_releases/debian_8 @@ -0,0 +1,8 @@ +PRETTY_NAME="Debian GNU/Linux 8 (jessie)" +NAME="Debian GNU/Linux" +VERSION_ID="8" +VERSION="8 (jessie)" +ID=debian +HOME_URL="http://www.debian.org/" +SUPPORT_URL="http://www.debian.org/support" +BUG_REPORT_URL="https://bugs.debian.org/" diff --git a/tests/fixtures/os_releases/debian_9 b/tests/fixtures/os_releases/debian_9 new file mode 100644 index 000000000..50fee901f --- /dev/null +++ b/tests/fixtures/os_releases/debian_9 @@ -0,0 +1,9 @@ +PRETTY_NAME="Debian GNU/Linux 9 (stretch)" +NAME="Debian GNU/Linux" +VERSION_ID="9" +VERSION="9 (stretch)" +VERSION_CODENAME=stretch +ID=debian +HOME_URL="https://www.debian.org/" +SUPPORT_URL="https://www.debian.org/support" +BUG_REPORT_URL="https://bugs.debian.org/" diff --git a/tests/fixtures/os_releases/distribution_names.txt b/tests/fixtures/os_releases/distribution_names.txt new file mode 100644 index 000000000..c027027ed --- /dev/null +++ b/tests/fixtures/os_releases/distribution_names.txt @@ -0,0 +1,41 @@ +almalinux (AlmaLinux) +alpine (Alpine Linux) +amzn (Amazon Linux) +antergos (Antergos Linux) +arch (Arch Linux) +archarm (Arch Linux ARM) +arcolinux (ArcoLinux) +centos (CentOS Linux) +clear-linux-os (Clear Linux OS) +clearos (ClearOS) +cumulus-linux (Cumulus Linux) +debian (Debian GNU/Linux) +elementary (elementary OS) +endeavouros (EndeavourOS) +fedora (Fedora Linux) +gentoo (Gentoo) +ios_xr (IOS XR) +kali (Kali GNU/Linux) +linuxmint (Linux Mint) +mageia (Mageia) +manjaro (Manjaro Linux) +manjaro-arm (Manjaro ARM) +nexus (Nexus) +nixos (NixOS) +ol (Oracle Linux Server) +opensuse (openSUSE Leap) +opensuse-leap (openSUSE Leap) +pop (Pop!_OS) +rancheros (RancherOS) +raspbian (Raspbian GNU/Linux) +rhel (Red Hat Enterprise Linux) +rocky (Rocky Linux) +scientific (Scientific Linux) +slackware (Slackware) +sled (SLED) +sles (SLES) +sles_sap (SLES_SAP) +ubuntu (Ubuntu) +virtuozzo (Virtuozzo) +xcp-ng (XCP-ng) +xenenterprise (XenServer) \ No newline at end of file diff --git a/tests/fixtures/os_releases/elementary_5 b/tests/fixtures/os_releases/elementary_5 new file mode 100644 index 000000000..dbb943b76 --- /dev/null +++ b/tests/fixtures/os_releases/elementary_5 @@ -0,0 +1,12 @@ +NAME="elementary OS" +VERSION="5.0 Juno" +ID=elementary +ID_LIKE=ubuntu +PRETTY_NAME="elementary OS 5.0 Juno" +VERSION_ID="5.0" +HOME_URL="https://elementary.io/" +SUPPORT_URL="https://elementary.io/support" +BUG_REPORT_URL="https://github.com/elementary/appcenter/issues/new" +PRIVACY_POLICY_URL="https://elementary.io/privacy-policy" +VERSION_CODENAME=juno +UBUNTU_CODENAME=juno diff --git a/tests/fixtures/os_releases/elementary_6 b/tests/fixtures/os_releases/elementary_6 new file mode 100644 index 000000000..1f15fdafe --- /dev/null +++ b/tests/fixtures/os_releases/elementary_6 @@ -0,0 +1,14 @@ +NAME="elementary OS" +VERSION="6 Odin" +ID=elementary +ID_LIKE=ubuntu +PRETTY_NAME="elementary OS 6 Odin" +LOGO=distributor-logo +VERSION_ID="6" +HOME_URL="https://elementary.io/" +DOCUMENTATION_URL="https://elementary.io/docs/learning-the-basics" +SUPPORT_URL="https://elementary.io/support" +BUG_REPORT_URL="https://github.com/elementary/os/issues/new" +PRIVACY_POLICY_URL="https://elementary.io/privacy-policy" +VERSION_CODENAME=odin +UBUNTU_CODENAME=focal diff --git a/tests/fixtures/os_releases/endeavouros b/tests/fixtures/os_releases/endeavouros new file mode 100644 index 000000000..51873c66e --- /dev/null +++ b/tests/fixtures/os_releases/endeavouros @@ -0,0 +1,12 @@ +NAME=EndeavourOS +PRETTY_NAME=EndeavourOS +ID=endeavouros +ID_LIKE=arch +BUILD_ID=rolling +ANSI_COLOR="38;2;23;147;209" +HOME_URL='https://endeavouros.com' +DOCUMENTATION_URL='https://discovery.endeavouros.com' +SUPPORT_URL='https://forum.endeavouros.com' +BUG_REPORT_URL='https://forum.endeavouros.com/c/arch-based-related-questions/bug-reports' +PRIVACY_POLICY_URL="https://terms.archlinux.org/docs/privacy-policy/" +LOGO=endeavouros \ No newline at end of file diff --git a/tests/fixtures/os_releases/fedora_28 b/tests/fixtures/os_releases/fedora_28 new file mode 100644 index 000000000..1cffc1110 --- /dev/null +++ b/tests/fixtures/os_releases/fedora_28 @@ -0,0 +1,18 @@ +NAME=Fedora +VERSION="28 (Cloud Edition)" +ID=fedora +VERSION_ID=28 +PLATFORM_ID="platform:f28" +PRETTY_NAME="Fedora 28 (Cloud Edition)" +ANSI_COLOR="0;34" +CPE_NAME="cpe:/o:fedoraproject:fedora:28" +HOME_URL="https://fedoraproject.org/" +SUPPORT_URL="https://fedoraproject.org/wiki/Communicating_and_getting_help" +BUG_REPORT_URL="https://bugzilla.redhat.com/" +REDHAT_BUGZILLA_PRODUCT="Fedora" +REDHAT_BUGZILLA_PRODUCT_VERSION=28 +REDHAT_SUPPORT_PRODUCT="Fedora" +REDHAT_SUPPORT_PRODUCT_VERSION=28 +PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy" +VARIANT="Cloud Edition" +VARIANT_ID=cloud diff --git a/tests/fixtures/os_releases/fedora_29 b/tests/fixtures/os_releases/fedora_29 new file mode 100644 index 000000000..f046aecad --- /dev/null +++ b/tests/fixtures/os_releases/fedora_29 @@ -0,0 +1,21 @@ +NAME=Fedora +VERSION="29 (Container Image)" +ID=fedora +VERSION_ID=29 +VERSION_CODENAME="" +PLATFORM_ID="platform:f29" +PRETTY_NAME="Fedora 29 (Container Image)" +ANSI_COLOR="0;34" +LOGO=fedora-logo-icon +CPE_NAME="cpe:/o:fedoraproject:fedora:29" +HOME_URL="https://fedoraproject.org/" +DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f29/system-administrators-guide/" +SUPPORT_URL="https://fedoraproject.org/wiki/Communicating_and_getting_help" +BUG_REPORT_URL="https://bugzilla.redhat.com/" +REDHAT_BUGZILLA_PRODUCT="Fedora" +REDHAT_BUGZILLA_PRODUCT_VERSION=29 +REDHAT_SUPPORT_PRODUCT="Fedora" +REDHAT_SUPPORT_PRODUCT_VERSION=29 +PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy" +VARIANT="Container Image" +VARIANT_ID=container diff --git a/tests/fixtures/os_releases/fedora_30 b/tests/fixtures/os_releases/fedora_30 new file mode 100644 index 000000000..8fc7f4a9d --- /dev/null +++ b/tests/fixtures/os_releases/fedora_30 @@ -0,0 +1,21 @@ +NAME=Fedora +VERSION="30 (Container Image)" +ID=fedora +VERSION_ID=30 +VERSION_CODENAME="" +PLATFORM_ID="platform:f30" +PRETTY_NAME="Fedora 30 (Container Image)" +ANSI_COLOR="0;34" +LOGO=fedora-logo-icon +CPE_NAME="cpe:/o:fedoraproject:fedora:30" +HOME_URL="https://fedoraproject.org/" +DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f30/system-administrators-guide/" +SUPPORT_URL="https://fedoraproject.org/wiki/Communicating_and_getting_help" +BUG_REPORT_URL="https://bugzilla.redhat.com/" +REDHAT_BUGZILLA_PRODUCT="Fedora" +REDHAT_BUGZILLA_PRODUCT_VERSION=30 +REDHAT_SUPPORT_PRODUCT="Fedora" +REDHAT_SUPPORT_PRODUCT_VERSION=30 +PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy" +VARIANT="Container Image" +VARIANT_ID=container diff --git a/tests/fixtures/os_releases/fedora_31 b/tests/fixtures/os_releases/fedora_31 new file mode 100644 index 000000000..8791e2694 --- /dev/null +++ b/tests/fixtures/os_releases/fedora_31 @@ -0,0 +1,21 @@ +NAME=Fedora +VERSION="31 (Container Image)" +ID=fedora +VERSION_ID=31 +VERSION_CODENAME="" +PLATFORM_ID="platform:f31" +PRETTY_NAME="Fedora 31 (Container Image)" +ANSI_COLOR="0;34" +LOGO=fedora-logo-icon +CPE_NAME="cpe:/o:fedoraproject:fedora:31" +HOME_URL="https://fedoraproject.org/" +DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f31/system-administrators-guide/" +SUPPORT_URL="https://fedoraproject.org/wiki/Communicating_and_getting_help" +BUG_REPORT_URL="https://bugzilla.redhat.com/" +REDHAT_BUGZILLA_PRODUCT="Fedora" +REDHAT_BUGZILLA_PRODUCT_VERSION=31 +REDHAT_SUPPORT_PRODUCT="Fedora" +REDHAT_SUPPORT_PRODUCT_VERSION=31 +PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy" +VARIANT="Container Image" +VARIANT_ID=container diff --git a/tests/fixtures/os_releases/fedora_32 b/tests/fixtures/os_releases/fedora_32 new file mode 100644 index 000000000..941b24e8f --- /dev/null +++ b/tests/fixtures/os_releases/fedora_32 @@ -0,0 +1,21 @@ +NAME=Fedora +VERSION="32 (Container Image)" +ID=fedora +VERSION_ID=32 +VERSION_CODENAME="" +PLATFORM_ID="platform:f32" +PRETTY_NAME="Fedora 32 (Container Image)" +ANSI_COLOR="0;34" +LOGO=fedora-logo-icon +CPE_NAME="cpe:/o:fedoraproject:fedora:32" +HOME_URL="https://fedoraproject.org/" +DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f32/system-administrators-guide/" +SUPPORT_URL="https://fedoraproject.org/wiki/Communicating_and_getting_help" +BUG_REPORT_URL="https://bugzilla.redhat.com/" +REDHAT_BUGZILLA_PRODUCT="Fedora" +REDHAT_BUGZILLA_PRODUCT_VERSION=32 +REDHAT_SUPPORT_PRODUCT="Fedora" +REDHAT_SUPPORT_PRODUCT_VERSION=32 +PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy" +VARIANT="Container Image" +VARIANT_ID=container diff --git a/tests/fixtures/os_releases/fedora_33 b/tests/fixtures/os_releases/fedora_33 new file mode 100644 index 000000000..550563db0 --- /dev/null +++ b/tests/fixtures/os_releases/fedora_33 @@ -0,0 +1,20 @@ +VERSION="33 (Container Image)" +ID=fedora +VERSION_ID=33 +VERSION_CODENAME="" +PLATFORM_ID="platform:f33" +PRETTY_NAME="Fedora 33 (Container Image)" +ANSI_COLOR="0;38;2;60;110;180" +LOGO=fedora-logo-icon +CPE_NAME="cpe:/o:fedoraproject:fedora:33" +HOME_URL="https://fedoraproject.org/" +DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f33/system-administrators-guide/" +SUPPORT_URL="https://fedoraproject.org/wiki/Communicating_and_getting_help" +BUG_REPORT_URL="https://bugzilla.redhat.com/" +REDHAT_BUGZILLA_PRODUCT="Fedora" +REDHAT_BUGZILLA_PRODUCT_VERSION=33 +REDHAT_SUPPORT_PRODUCT="Fedora" +REDHAT_SUPPORT_PRODUCT_VERSION=33 +PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy" +VARIANT="Container Image" +VARIANT_ID=container diff --git a/tests/fixtures/os_releases/fedora_34 b/tests/fixtures/os_releases/fedora_34 new file mode 100644 index 000000000..79be882c7 --- /dev/null +++ b/tests/fixtures/os_releases/fedora_34 @@ -0,0 +1,21 @@ +NAME=Fedora +VERSION="34 (Container Image)" +ID=fedora +VERSION_ID=34 +VERSION_CODENAME="" +PLATFORM_ID="platform:f34" +PRETTY_NAME="Fedora 34 (Container Image)" +ANSI_COLOR="0;38;2;60;110;180" +LOGO=fedora-logo-icon +CPE_NAME="cpe:/o:fedoraproject:fedora:34" +HOME_URL="https://fedoraproject.org/" +DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f34/system-administrators-guide/" +SUPPORT_URL="https://fedoraproject.org/wiki/Communicating_and_getting_help" +BUG_REPORT_URL="https://bugzilla.redhat.com/" +REDHAT_BUGZILLA_PRODUCT="Fedora" +REDHAT_BUGZILLA_PRODUCT_VERSION=34 +REDHAT_SUPPORT_PRODUCT="Fedora" +REDHAT_SUPPORT_PRODUCT_VERSION=34 +PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy" +VARIANT="Container Image" +VARIANT_ID=container diff --git a/tests/fixtures/os_releases/fedora_35 b/tests/fixtures/os_releases/fedora_35 new file mode 100644 index 000000000..1cff88a03 --- /dev/null +++ b/tests/fixtures/os_releases/fedora_35 @@ -0,0 +1,21 @@ +NAME="Fedora Linux" +VERSION="35 (Container Image)" +ID=fedora +VERSION_ID=35 +VERSION_CODENAME="" +PLATFORM_ID="platform:f35" +PRETTY_NAME="Fedora Linux 35 (Container Image)" +ANSI_COLOR="0;38;2;60;110;180" +LOGO=fedora-logo-icon +CPE_NAME="cpe:/o:fedoraproject:fedora:35" +HOME_URL="https://fedoraproject.org/" +DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f35/system-administrators-guide/" +SUPPORT_URL="https://ask.fedoraproject.org/" +BUG_REPORT_URL="https://bugzilla.redhat.com/" +REDHAT_BUGZILLA_PRODUCT="Fedora" +REDHAT_BUGZILLA_PRODUCT_VERSION=35 +REDHAT_SUPPORT_PRODUCT="Fedora" +REDHAT_SUPPORT_PRODUCT_VERSION=35 +PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy" +VARIANT="Container Image" +VARIANT_ID=container diff --git a/tests/fixtures/os_releases/fedora_36 b/tests/fixtures/os_releases/fedora_36 new file mode 100644 index 000000000..ae039188b --- /dev/null +++ b/tests/fixtures/os_releases/fedora_36 @@ -0,0 +1,22 @@ +NAME="Fedora Linux" +VERSION="36 (Container Image)" +ID=fedora +VERSION_ID=36 +VERSION_CODENAME="" +PLATFORM_ID="platform:f36" +PRETTY_NAME="Fedora Linux 36 (Container Image)" +ANSI_COLOR="0;38;2;60;110;180" +LOGO=fedora-logo-icon +CPE_NAME="cpe:/o:fedoraproject:fedora:36" +HOME_URL="https://fedoraproject.org/" +DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f36/system-administrators-guide/" +SUPPORT_URL="https://ask.fedoraproject.org/" +BUG_REPORT_URL="https://bugzilla.redhat.com/" +REDHAT_BUGZILLA_PRODUCT="Fedora" +REDHAT_BUGZILLA_PRODUCT_VERSION=36 +REDHAT_SUPPORT_PRODUCT="Fedora" +REDHAT_SUPPORT_PRODUCT_VERSION=36 +PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy" +SUPPORT_END=2023-05-16 +VARIANT="Container Image" +VARIANT_ID=container diff --git a/tests/fixtures/os_releases/fedora_37 b/tests/fixtures/os_releases/fedora_37 new file mode 100644 index 000000000..a44f5bc6e --- /dev/null +++ b/tests/fixtures/os_releases/fedora_37 @@ -0,0 +1,22 @@ +NAME="Fedora Linux" +VERSION="37 (Container Image)" +ID=fedora +VERSION_ID=37 +VERSION_CODENAME="" +PLATFORM_ID="platform:f37" +PRETTY_NAME="Fedora Linux 37 (Container Image)" +ANSI_COLOR="0;38;2;60;110;180" +LOGO=fedora-logo-icon +CPE_NAME="cpe:/o:fedoraproject:fedora:37" +DEFAULT_HOSTNAME="fedora" +HOME_URL="https://fedoraproject.org/" +DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f37/system-administrators-guide/" +SUPPORT_URL="https://ask.fedoraproject.org/" +BUG_REPORT_URL="https://bugzilla.redhat.com/" +REDHAT_BUGZILLA_PRODUCT="Fedora" +REDHAT_BUGZILLA_PRODUCT_VERSION=37 +REDHAT_SUPPORT_PRODUCT="Fedora" +REDHAT_SUPPORT_PRODUCT_VERSION=37 +SUPPORT_END=2023-11-14 +VARIANT="Container Image" +VARIANT_ID=container diff --git a/tests/fixtures/os_releases/fedora_38 b/tests/fixtures/os_releases/fedora_38 new file mode 100644 index 000000000..ba3a59e8c --- /dev/null +++ b/tests/fixtures/os_releases/fedora_38 @@ -0,0 +1,22 @@ +NAME="Fedora Linux" +VERSION="38 (Workstation Edition)" +ID=fedora +VERSION_ID=38 +VERSION_CODENAME="" +PLATFORM_ID="platform:f38" +PRETTY_NAME="Fedora Linux 38 (Workstation Edition)" +ANSI_COLOR="0;38;2;60;110;180" +LOGO=fedora-logo-icon +CPE_NAME="cpe:/o:fedoraproject:fedora:38" +DEFAULT_HOSTNAME="fedora" +HOME_URL="https://fedoraproject.org/" +DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f38/system-administrators-guide/" +SUPPORT_URL="https://ask.fedoraproject.org/" +BUG_REPORT_URL="https://bugzilla.redhat.com/" +REDHAT_BUGZILLA_PRODUCT="Fedora" +REDHAT_BUGZILLA_PRODUCT_VERSION=38 +REDHAT_SUPPORT_PRODUCT="Fedora" +REDHAT_SUPPORT_PRODUCT_VERSION=38 +SUPPORT_END=2024-05-14 +VARIANT="Workstation Edition" +VARIANT_ID=workstation diff --git a/tests/fixtures/os_releases/gentoo b/tests/fixtures/os_releases/gentoo new file mode 100644 index 000000000..2a75fec6a --- /dev/null +++ b/tests/fixtures/os_releases/gentoo @@ -0,0 +1,7 @@ +NAME=Gentoo +ID=gentoo +PRETTY_NAME="Gentoo/Linux" +ANSI_COLOR="1;32" +HOME_URL="https://www.gentoo.org/" +SUPPORT_URL="https://www.gentoo.org/support/" +BUG_REPORT_URL="https://bugs.gentoo.org/" diff --git a/tests/fixtures/os_releases/ios_xr_6 b/tests/fixtures/os_releases/ios_xr_6 new file mode 100644 index 000000000..7d3d0845c --- /dev/null +++ b/tests/fixtures/os_releases/ios_xr_6 @@ -0,0 +1,9 @@ +ID="ios_xr" +ID_LIKE="cisco-wrlinux wrlinux" +NAME="IOS XR" +VERSION="6.0.0.14I" +VERSION_ID="6.0.0.14I" +PRETTY_NAME="Cisco IOS XR Software, Version 6.0.0.14I" +BUILD_ID="2015-09-10-15-50-17" +HOME_URL="http://www.cisco.com" +CISCO_RELEASE_INFO="/etc/os-release" diff --git a/tests/fixtures/os_releases/kali_2018_4 b/tests/fixtures/os_releases/kali_2018_4 new file mode 100644 index 000000000..497deba28 --- /dev/null +++ b/tests/fixtures/os_releases/kali_2018_4 @@ -0,0 +1,10 @@ +PRETTY_NAME="Kali GNU/Linux Rolling" +NAME="Kali GNU/Linux" +ID=kali +VERSION="2018.4" +VERSION_ID="2018.4" +ID_LIKE=debian +ANSI_COLOR="1;31" +HOME_URL="https://www.kali.org/" +SUPPORT_URL="https://forums.kali.org/" +BUG_REPORT_URL="https://bugs.kali.org/" diff --git a/tests/fixtures/os_releases/linuxmint_18_2 b/tests/fixtures/os_releases/linuxmint_18_2 new file mode 100644 index 000000000..02e791435 --- /dev/null +++ b/tests/fixtures/os_releases/linuxmint_18_2 @@ -0,0 +1,11 @@ +NAME="Linux Mint" +VERSION="18.2 (Sonya)" +ID=linuxmint +ID_LIKE=ubuntu +PRETTY_NAME="Linux Mint 18.2" +VERSION_ID="18.2" +HOME_URL="http://www.linuxmint.com/" +SUPPORT_URL="http://forums.linuxmint.com/" +BUG_REPORT_URL="http://bugs.launchpad.net/linuxmint/" +VERSION_CODENAME=sonya +UBUNTU_CODENAME=xenial diff --git a/tests/fixtures/os_releases/linuxmint_19 b/tests/fixtures/os_releases/linuxmint_19 new file mode 100644 index 000000000..163341871 --- /dev/null +++ b/tests/fixtures/os_releases/linuxmint_19 @@ -0,0 +1,12 @@ +NAME="Linux Mint" +VERSION="19 (Tara)" +ID=linuxmint +ID_LIKE=ubuntu +PRETTY_NAME="Linux Mint 19" +VERSION_ID="19" +HOME_URL="https://www.linuxmint.com/" +SUPPORT_URL="https://forums.ubuntu.com/" +BUG_REPORT_URL="http://linuxmint-troubleshooting-guide.readthedocs.io/en/latest/" +PRIVACY_POLICY_URL="https://www.linuxmint.com/" +VERSION_CODENAME=tara +UBUNTU_CODENAME=bionic diff --git a/tests/fixtures/os_releases/mageia_6 b/tests/fixtures/os_releases/mageia_6 new file mode 100644 index 000000000..c17468aba --- /dev/null +++ b/tests/fixtures/os_releases/mageia_6 @@ -0,0 +1,11 @@ +NAME="Mageia" +VERSION="6" +ID=mageia +VERSION_ID=6 +ID_LIKE="mandriva fedora" +PRETTY_NAME="Mageia 6" +ANSI_COLOR="1;36" +HOME_URL="http://www.mageia.org/" +SUPPORT_URL="http://www.mageia.org/support/" +BUG_REPORT_URL="https://bugs.mageia.org/" +PRIVACY_POLICY_URL="https://wiki.mageia.org/en/Privacy_policy" diff --git a/tests/fixtures/os_releases/manjaro b/tests/fixtures/os_releases/manjaro new file mode 100644 index 000000000..f7b5a1231 --- /dev/null +++ b/tests/fixtures/os_releases/manjaro @@ -0,0 +1,12 @@ +NAME="Manjaro Linux" +PRETTY_NAME="Manjaro Linux" +ID=manjaro +ID_LIKE=arch +BUILD_ID=rolling +ANSI_COLOR="1;32" +HOME_URL="https://www.manjaro.org/" +DOCUMENTATION_URL="https://wiki.manjaro.org/" +SUPPORT_URL="https://forum.manjaro.org/" +BUG_REPORT_URL="https://docs.manjaro.org/reporting-bugs/" +PRIVACY_POLICY_URL="https://manjaro.org/privacy-policy/" +LOGO=manjarolinux diff --git a/tests/fixtures/os_releases/manjaro-arm b/tests/fixtures/os_releases/manjaro-arm new file mode 100644 index 000000000..228d58f14 --- /dev/null +++ b/tests/fixtures/os_releases/manjaro-arm @@ -0,0 +1,8 @@ +NAME="Manjaro ARM" +ID="manjaro-arm" +ID_LIKE="manjaro arch" +PRETTY_NAME="Manjaro ARM" +ANSI_COLOR="1;32" +HOME_URL="https://www.manjaro.org/" +SUPPORT_URL="https://forum.manjaro.org/c/arm/" +LOGO=manjarolinux \ No newline at end of file diff --git a/tests/fixtures/os_releases/nexus_7 b/tests/fixtures/os_releases/nexus_7 new file mode 100644 index 000000000..66dc771ab --- /dev/null +++ b/tests/fixtures/os_releases/nexus_7 @@ -0,0 +1,8 @@ +ID=nexus +ID_LIKE=wrlinux +NAME=Nexus +HOME_URL=http://www.cisco.com +BUILD_ID=TBD +VERSION="7.0(BUILDER)" +VERSION_ID="7.0(BUILDER)" +CISCO_RELEASE_INFO="/etc/os-release" diff --git a/tests/fixtures/os_releases/nixos b/tests/fixtures/os_releases/nixos new file mode 100644 index 000000000..4c0160d09 --- /dev/null +++ b/tests/fixtures/os_releases/nixos @@ -0,0 +1,9 @@ +NAME=NixOS +ID=nixos +VERSION="18.09.1436.a7fd4310c0c (Jellyfish)" +VERSION_CODENAME=jellyfish +VERSION_ID="18.09.1436.a7fd4310c0c" +PRETTY_NAME="NixOS 18.09.1436.a7fd4310c0c (Jellyfish)" +HOME_URL="https://nixos.org/" +SUPPORT_URL="https://nixos.org/nixos/support.html" +BUG_REPORT_URL="https://github.com/NixOS/nixpkgs/issues" diff --git a/tests/fixtures/os_releases/opensuseleap_15 b/tests/fixtures/os_releases/opensuseleap_15 new file mode 100644 index 000000000..fa61b75b0 --- /dev/null +++ b/tests/fixtures/os_releases/opensuseleap_15 @@ -0,0 +1,12 @@ +NAME="openSUSE Leap" +VERSION="15.4" +ID="opensuse-leap" +ID_LIKE="suse opensuse" +VERSION_ID="15.4" +PRETTY_NAME="openSUSE Leap 15.4" +ANSI_COLOR="0;32" +CPE_NAME="cpe:/o:opensuse:leap:15.4" +BUG_REPORT_URL="https://bugs.opensuse.org" +HOME_URL="https://www.opensuse.org/" +DOCUMENTATION_URL="https://en.opensuse.org/Portal:Leap" +LOGO="distributor-logo-Leap" diff --git a/tests/fixtures/os_releases/opensuseleap_42_3 b/tests/fixtures/os_releases/opensuseleap_42_3 new file mode 100644 index 000000000..a449c2ce1 --- /dev/null +++ b/tests/fixtures/os_releases/opensuseleap_42_3 @@ -0,0 +1,10 @@ +NAME="openSUSE Leap" +VERSION="42.3" +ID=opensuse +ID_LIKE="suse" +VERSION_ID="42.3" +PRETTY_NAME="openSUSE Leap 42.3" +ANSI_COLOR="0;32" +CPE_NAME="cpe:/o:opensuse:leap:42.3" +BUG_REPORT_URL="https://bugs.opensuse.org" +HOME_URL="https://www.opensuse.org/" diff --git a/tests/fixtures/os_releases/oracle_7 b/tests/fixtures/os_releases/oracle_7 new file mode 100644 index 000000000..f8823a8e1 --- /dev/null +++ b/tests/fixtures/os_releases/oracle_7 @@ -0,0 +1,17 @@ +NAME="Oracle Linux Server" +VERSION="7.9" +ID="ol" +ID_LIKE="fedora" +VARIANT="Server" +VARIANT_ID="server" +VERSION_ID="7.9" +PRETTY_NAME="Oracle Linux Server 7.9" +ANSI_COLOR="0;31" +CPE_NAME="cpe:/o:oracle:linux:7:9:server" +HOME_URL="https://linux.oracle.com/" +BUG_REPORT_URL="https://bugzilla.oracle.com/" + +ORACLE_BUGZILLA_PRODUCT="Oracle Linux 7" +ORACLE_BUGZILLA_PRODUCT_VERSION=7.9 +ORACLE_SUPPORT_PRODUCT="Oracle Linux" +ORACLE_SUPPORT_PRODUCT_VERSION=7.9 diff --git a/tests/fixtures/os_releases/oracle_8 b/tests/fixtures/os_releases/oracle_8 new file mode 100644 index 000000000..b91c366e4 --- /dev/null +++ b/tests/fixtures/os_releases/oracle_8 @@ -0,0 +1,18 @@ +NAME="Oracle Linux Server" +VERSION="8.7" +ID="ol" +ID_LIKE="fedora" +VARIANT="Server" +VARIANT_ID="server" +VERSION_ID="8.7" +PLATFORM_ID="platform:el8" +PRETTY_NAME="Oracle Linux Server 8.7" +ANSI_COLOR="0;31" +CPE_NAME="cpe:/o:oracle:linux:8:7:server" +HOME_URL="https://linux.oracle.com/" +BUG_REPORT_URL="https://bugzilla.oracle.com/" + +ORACLE_BUGZILLA_PRODUCT="Oracle Linux 8" +ORACLE_BUGZILLA_PRODUCT_VERSION=8.7 +ORACLE_SUPPORT_PRODUCT="Oracle Linux" +ORACLE_SUPPORT_PRODUCT_VERSION=8.7 diff --git a/tests/fixtures/os_releases/oracle_9 b/tests/fixtures/os_releases/oracle_9 new file mode 100644 index 000000000..b19d16f7d --- /dev/null +++ b/tests/fixtures/os_releases/oracle_9 @@ -0,0 +1,18 @@ +NAME="Oracle Linux Server" +VERSION="9.1" +ID="ol" +ID_LIKE="fedora" +VARIANT="Server" +VARIANT_ID="server" +VERSION_ID="9.1" +PLATFORM_ID="platform:el9" +PRETTY_NAME="Oracle Linux Server 9.1" +ANSI_COLOR="0;31" +CPE_NAME="cpe:/o:oracle:linux:9:1:server" +HOME_URL="https://linux.oracle.com/" +BUG_REPORT_URL="https://github.com/oracle/oracle-linux" + +ORACLE_BUGZILLA_PRODUCT="Oracle Linux 9" +ORACLE_BUGZILLA_PRODUCT_VERSION=9.1 +ORACLE_SUPPORT_PRODUCT="Oracle Linux" +ORACLE_SUPPORT_PRODUCT_VERSION=9.1 diff --git a/tests/fixtures/os_releases/pop_os_22_04 b/tests/fixtures/os_releases/pop_os_22_04 new file mode 100644 index 000000000..c6d01202d --- /dev/null +++ b/tests/fixtures/os_releases/pop_os_22_04 @@ -0,0 +1,13 @@ +NAME="Pop!_OS" +VERSION="22.04 LTS" +ID=pop +ID_LIKE="ubuntu debian" +PRETTY_NAME="Pop!_OS 22.04 LTS" +VERSION_ID="22.04" +HOME_URL="https://pop.system76.com" +SUPPORT_URL="https://support.system76.com" +BUG_REPORT_URL="https://github.com/pop-os/pop/issues" +PRIVACY_POLICY_URL="https://system76.com/privacy" +VERSION_CODENAME=jammy +UBUNTU_CODENAME=jammy +LOGO=distributor-logo-pop-os diff --git a/tests/fixtures/os_releases/rancheros_1_4 b/tests/fixtures/os_releases/rancheros_1_4 new file mode 100644 index 000000000..18c7916ff --- /dev/null +++ b/tests/fixtures/os_releases/rancheros_1_4 @@ -0,0 +1,10 @@ +NAME="RancherOS" +VERSION=v1.4.2 +ID=rancheros +ID_LIKE= +VERSION_ID=v1.4.2 +PRETTY_NAME="RancherOS v1.4.2" +HOME_URL="http://rancher.com/rancher-os/" +SUPPORT_URL="https://forums.rancher.com/c/rancher-os" +BUG_REPORT_URL="https://github.com/rancher/os/issues" +BUILD_ID= diff --git a/tests/fixtures/os_releases/raspbian_10 b/tests/fixtures/os_releases/raspbian_10 new file mode 100644 index 000000000..673a8743b --- /dev/null +++ b/tests/fixtures/os_releases/raspbian_10 @@ -0,0 +1,10 @@ +PRETTY_NAME="Raspbian GNU/Linux 10 (buster)" +NAME="Raspbian GNU/Linux" +VERSION_ID="10" +VERSION="10 (buster)" +VERSION_CODENAME=buster +ID=raspbian +ID_LIKE=debian +HOME_URL="http://www.raspbian.org/" +SUPPORT_URL="http://www.raspbian.org/RaspbianForums" +BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs" diff --git a/tests/fixtures/os_releases/raspbian_8 b/tests/fixtures/os_releases/raspbian_8 new file mode 100644 index 000000000..070b4b84a --- /dev/null +++ b/tests/fixtures/os_releases/raspbian_8 @@ -0,0 +1,9 @@ +PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)" +NAME="Raspbian GNU/Linux" +VERSION_ID="8" +VERSION="8 (jessie)" +ID=raspbian +ID_LIKE=debian +HOME_URL="http://www.raspbian.org/" +SUPPORT_URL="http://www.raspbian.org/RaspbianForums" +BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs" diff --git a/tests/fixtures/os_releases/redhat_7 b/tests/fixtures/os_releases/redhat_7 new file mode 100644 index 000000000..7f0eb9491 --- /dev/null +++ b/tests/fixtures/os_releases/redhat_7 @@ -0,0 +1,17 @@ +NAME="Red Hat Enterprise Linux Server" +VERSION="7.5 (Maipo)" +ID="rhel" +ID_LIKE="fedora" +VARIANT="Server" +VARIANT_ID="server" +VERSION_ID="7.5" +PRETTY_NAME="Red Hat Enterprise Linux Server 7.5 (Maipo)" +ANSI_COLOR="0;31" +CPE_NAME="cpe:/o:redhat:enterprise_linux:7.5:GA:server" +HOME_URL="https://www.redhat.com/" +BUG_REPORT_URL="https://bugzilla.redhat.com/" + +REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 7" +REDHAT_BUGZILLA_PRODUCT_VERSION=7.5 +REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux" +REDHAT_SUPPORT_PRODUCT_VERSION="7.5" diff --git a/tests/fixtures/os_releases/redhat_8 b/tests/fixtures/os_releases/redhat_8 new file mode 100644 index 000000000..36051a7ac --- /dev/null +++ b/tests/fixtures/os_releases/redhat_8 @@ -0,0 +1,16 @@ +NAME="Red Hat Enterprise Linux" +VERSION="8.0 (Ootpa)" +ID="rhel" +ID_LIKE="fedora" +VERSION_ID="8.0" +PLATFORM_ID="platform:el8" +PRETTY_NAME="Red Hat Enterprise Linux 8.0 (Ootpa)" +ANSI_COLOR="0;31" +CPE_NAME="cpe:/o:redhat:enterprise_linux:8.0:GA" +HOME_URL="https://www.redhat.com/" +BUG_REPORT_URL="https://bugzilla.redhat.com/" + +REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 8" +REDHAT_BUGZILLA_PRODUCT_VERSION=8.0 +REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux" +REDHAT_SUPPORT_PRODUCT_VERSION="8.0" diff --git a/tests/fixtures/os_releases/redhat_9 b/tests/fixtures/os_releases/redhat_9 new file mode 100644 index 000000000..f055bcc4e --- /dev/null +++ b/tests/fixtures/os_releases/redhat_9 @@ -0,0 +1,18 @@ +NAME="Red Hat Enterprise Linux" +VERSION="9.1 (Plow)" +ID="rhel" +ID_LIKE="fedora" +VERSION_ID="9.1" +PLATFORM_ID="platform:el9" +PRETTY_NAME="Red Hat Enterprise Linux 9.1 (Plow)" +ANSI_COLOR="0;31" +LOGO="fedora-logo-icon" +CPE_NAME="cpe:/o:redhat:enterprise_linux:9::baseos" +HOME_URL="https://www.redhat.com/" +DOCUMENTATION_URL="https://access.redhat.com/documentation/red_hat_enterprise_linux/9/" +BUG_REPORT_URL="https://bugzilla.redhat.com/" + +REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 9" +REDHAT_BUGZILLA_PRODUCT_VERSION=9.1 +REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux" +REDHAT_SUPPORT_PRODUCT_VERSION="9.1" diff --git a/tests/fixtures/os_releases/rocky_8 b/tests/fixtures/os_releases/rocky_8 new file mode 100644 index 000000000..2fd5d0f4b --- /dev/null +++ b/tests/fixtures/os_releases/rocky_8 @@ -0,0 +1,16 @@ +NAME="Rocky Linux" +VERSION="8.7 (Green Obsidian)" +ID="rocky" +ID_LIKE="rhel centos fedora" +VERSION_ID="8.7" +PLATFORM_ID="platform:el8" +PRETTY_NAME="Rocky Linux 8.7 (Green Obsidian)" +ANSI_COLOR="0;32" +LOGO="fedora-logo-icon" +CPE_NAME="cpe:/o:rocky:rocky:8:GA" +HOME_URL="https://rockylinux.org/" +BUG_REPORT_URL="https://bugs.rockylinux.org/" +ROCKY_SUPPORT_PRODUCT="Rocky-Linux-8" +ROCKY_SUPPORT_PRODUCT_VERSION="8.7" +REDHAT_SUPPORT_PRODUCT="Rocky Linux" +REDHAT_SUPPORT_PRODUCT_VERSION="8.7" diff --git a/tests/fixtures/os_releases/rocky_9 b/tests/fixtures/os_releases/rocky_9 new file mode 100644 index 000000000..12802c3aa --- /dev/null +++ b/tests/fixtures/os_releases/rocky_9 @@ -0,0 +1,16 @@ +NAME="Rocky Linux" +VERSION="9.1 (Blue Onyx)" +ID="rocky" +ID_LIKE="rhel centos fedora" +VERSION_ID="9.1" +PLATFORM_ID="platform:el9" +PRETTY_NAME="Rocky Linux 9.1 (Blue Onyx)" +ANSI_COLOR="0;32" +LOGO="fedora-logo-icon" +CPE_NAME="cpe:/o:rocky:rocky:9::baseos" +HOME_URL="https://rockylinux.org/" +BUG_REPORT_URL="https://bugs.rockylinux.org/" +ROCKY_SUPPORT_PRODUCT="Rocky-Linux-9" +ROCKY_SUPPORT_PRODUCT_VERSION="9.1" +REDHAT_SUPPORT_PRODUCT="Rocky Linux" +REDHAT_SUPPORT_PRODUCT_VERSION="9.1" diff --git a/tests/fixtures/os_releases/scientific_7 b/tests/fixtures/os_releases/scientific_7 new file mode 100644 index 000000000..fb54808b1 --- /dev/null +++ b/tests/fixtures/os_releases/scientific_7 @@ -0,0 +1,15 @@ +NAME="Scientific Linux" +VERSION="7.5 (Nitrogen)" +ID="scientific" +ID_LIKE="rhel centos fedora" +VERSION_ID="7.5" +PRETTY_NAME="Scientific Linux 7.5 (Nitrogen)" +ANSI_COLOR="0;31" +CPE_NAME="cpe:/o:scientificlinux:scientificlinux:7.5:GA" +HOME_URL="http://www.scientificlinux.org//" +BUG_REPORT_URL="mailto:scientific-linux-devel@listserv.fnal.gov" + +REDHAT_BUGZILLA_PRODUCT="Scientific Linux 7" +REDHAT_BUGZILLA_PRODUCT_VERSION=7.5 +REDHAT_SUPPORT_PRODUCT="Scientific Linux" +REDHAT_SUPPORT_PRODUCT_VERSION="7.5" diff --git a/tests/fixtures/os_releases/slackware_14_2 b/tests/fixtures/os_releases/slackware_14_2 new file mode 100644 index 000000000..de8afe3bb --- /dev/null +++ b/tests/fixtures/os_releases/slackware_14_2 @@ -0,0 +1,10 @@ +NAME=Slackware +VERSION="14.2" +ID=slackware +VERSION_ID=14.2 +PRETTY_NAME="Slackware 14.2" +ANSI_COLOR="0;34" +CPE_NAME="cpe:/o:slackware:slackware_linux:14.2" +HOME_URL="http://slackware.com/" +SUPPORT_URL="http://www.linuxquestions.org/questions/slackware-14/" +BUG_REPORT_URL="http://www.linuxquestions.org/questions/slackware-14/" diff --git a/tests/fixtures/os_releases/sled_12_3 b/tests/fixtures/os_releases/sled_12_3 new file mode 100644 index 000000000..b47a2964d --- /dev/null +++ b/tests/fixtures/os_releases/sled_12_3 @@ -0,0 +1,7 @@ +NAME="SLED" +VERSION="12-SP3" +VERSION_ID="12.3" +PRETTY_NAME="SUSE Linux Enterprise Desktop 12 SP3" +ID="sled" +ANSI_COLOR="0;32" +CPE_NAME="cpe:/o:suse:sled:12:sp3" diff --git a/tests/fixtures/os_releases/sled_15 b/tests/fixtures/os_releases/sled_15 new file mode 100644 index 000000000..803dd876f --- /dev/null +++ b/tests/fixtures/os_releases/sled_15 @@ -0,0 +1,8 @@ +NAME="SLED" +VERSION="15" +VERSION_ID="15" +PRETTY_NAME="SUSE Linux Enterprise Desktop 15" +ID="sled" +ID_LIKE="suse" +ANSI_COLOR="0;32" +CPE_NAME="cpe:/o:suse:sled:15" diff --git a/tests/fixtures/os_releases/sles_11_4 b/tests/fixtures/os_releases/sles_11_4 new file mode 100644 index 000000000..ed95ddbf3 --- /dev/null +++ b/tests/fixtures/os_releases/sles_11_4 @@ -0,0 +1,7 @@ +NAME="SLES" +VERSION="11.4" +VERSION_ID="11.4" +PRETTY_NAME="SUSE Linux Enterprise Server 11 SP4" +ID="sles" +ANSI_COLOR="0;32" +CPE_NAME="cpe:/o:suse:sles:11:4" diff --git a/tests/fixtures/os_releases/sles_12_3 b/tests/fixtures/os_releases/sles_12_3 new file mode 100644 index 000000000..b68860e14 --- /dev/null +++ b/tests/fixtures/os_releases/sles_12_3 @@ -0,0 +1,7 @@ +NAME="SLES" +VERSION="12-SP3" +VERSION_ID="12.3" +PRETTY_NAME="SUSE Linux Enterprise Server 12 SP3" +ID="sles" +ANSI_COLOR="0;32" +CPE_NAME="cpe:/o:suse:sles:12:sp3" diff --git a/tests/fixtures/os_releases/sles_15_0 b/tests/fixtures/os_releases/sles_15_0 new file mode 100644 index 000000000..d06c32ffd --- /dev/null +++ b/tests/fixtures/os_releases/sles_15_0 @@ -0,0 +1,8 @@ +NAME="SLES" +VERSION="15" +VERSION_ID="15" +PRETTY_NAME="SUSE Linux Enterprise Server 15" +ID="sles" +ID_LIKE="suse" +ANSI_COLOR="0;32" +CPE_NAME="cpe:/o:suse:sles:15" diff --git a/tests/fixtures/os_releases/sles_15_1 b/tests/fixtures/os_releases/sles_15_1 new file mode 100644 index 000000000..c9161574c --- /dev/null +++ b/tests/fixtures/os_releases/sles_15_1 @@ -0,0 +1,8 @@ +NAME="SLES" +VERSION="15-SP1" +VERSION_ID="15.1" +PRETTY_NAME="SUSE Linux Enterprise Server 15 SP1" +ID="sles" +ID_LIKE="suse" +ANSI_COLOR="0;32" +CPE_NAME="cpe:/o:suse:sles:15:sp1" diff --git a/tests/fixtures/os_releases/sles_sap_12_0 b/tests/fixtures/os_releases/sles_sap_12_0 new file mode 100644 index 000000000..cd06cd95e --- /dev/null +++ b/tests/fixtures/os_releases/sles_sap_12_0 @@ -0,0 +1,7 @@ +NAME="SLES_SAP" +VERSION="12.0.1" +VERSION_ID="12.0.1" +PRETTY_NAME="SUSE Linux Enterprise Server for SAP Applications 12" +ID="sles_sap" +ANSI_COLOR="0;32" +CPE_NAME="cpe:/o:suse:sles_sap:12" diff --git a/tests/fixtures/os_releases/sles_sap_12_1 b/tests/fixtures/os_releases/sles_sap_12_1 new file mode 100644 index 000000000..a2d3d5783 --- /dev/null +++ b/tests/fixtures/os_releases/sles_sap_12_1 @@ -0,0 +1,7 @@ +NAME="SLES_SAP" +VERSION="12-SP1" +VERSION_ID="12.1.0.1" +PRETTY_NAME="SUSE Linux Enterprise Server for SAP Applications 12 SP1" +ID="sles_sap" +ANSI_COLOR="0;32" +CPE_NAME="cpe:/o:suse:sles_sap:12:sp1" diff --git a/tests/fixtures/os_releases/sles_sap_12_2 b/tests/fixtures/os_releases/sles_sap_12_2 new file mode 100644 index 000000000..939b83bdb --- /dev/null +++ b/tests/fixtures/os_releases/sles_sap_12_2 @@ -0,0 +1,7 @@ +NAME="SLES_SAP" +VERSION="12-SP2" +VERSION_ID="12.2" +PRETTY_NAME="SUSE Linux Enterprise Server for SAP Applications 12 SP2" +ID="sles_sap" +ANSI_COLOR="0;32" +CPE_NAME="cpe:/o:suse:sles_sap:12:sp2" diff --git a/tests/fixtures/os_releases/sles_sap_12_3 b/tests/fixtures/os_releases/sles_sap_12_3 new file mode 100644 index 000000000..68f6253fe --- /dev/null +++ b/tests/fixtures/os_releases/sles_sap_12_3 @@ -0,0 +1,7 @@ +NAME="SLES" +VERSION="12-SP3" +VERSION_ID="12.3" +PRETTY_NAME="SUSE Linux Enterprise Server 12 SP3" +ID="sles" +ANSI_COLOR="0;32" +CPE_NAME="cpe:/o:suse:sles_sap:12:sp3" diff --git a/tests/fixtures/os_releases/ubuntu_1404 b/tests/fixtures/os_releases/ubuntu_1404 new file mode 100644 index 000000000..fa4c4a394 --- /dev/null +++ b/tests/fixtures/os_releases/ubuntu_1404 @@ -0,0 +1,9 @@ +NAME="Ubuntu" +VERSION="14.04.5 LTS, Trusty Tahr" +ID=ubuntu +ID_LIKE=debian +PRETTY_NAME="Ubuntu 14.04.5 LTS" +VERSION_ID="14.04" +HOME_URL="http://www.ubuntu.com/" +SUPPORT_URL="http://help.ubuntu.com/" +BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/" diff --git a/tests/fixtures/os_releases/ubuntu_1604 b/tests/fixtures/os_releases/ubuntu_1604 new file mode 100644 index 000000000..8a6e79fb4 --- /dev/null +++ b/tests/fixtures/os_releases/ubuntu_1604 @@ -0,0 +1,11 @@ +NAME="Ubuntu" +VERSION="16.04.5 LTS (Xenial Xerus)" +ID=ubuntu +ID_LIKE=debian +PRETTY_NAME="Ubuntu 16.04.5 LTS" +VERSION_ID="16.04" +HOME_URL="http://www.ubuntu.com/" +SUPPORT_URL="http://help.ubuntu.com/" +BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/" +VERSION_CODENAME=xenial +UBUNTU_CODENAME=xenial diff --git a/tests/fixtures/os_releases/ubuntu_1804 b/tests/fixtures/os_releases/ubuntu_1804 new file mode 100644 index 000000000..ba60d3c68 --- /dev/null +++ b/tests/fixtures/os_releases/ubuntu_1804 @@ -0,0 +1,12 @@ +NAME="Ubuntu" +VERSION="18.04.1 LTS (Bionic Beaver)" +ID=ubuntu +ID_LIKE=debian +PRETTY_NAME="Ubuntu 18.04.1 LTS" +VERSION_ID="18.04" +HOME_URL="https://www.ubuntu.com/" +SUPPORT_URL="https://help.ubuntu.com/" +BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" +PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" +VERSION_CODENAME=bionic +UBUNTU_CODENAME=bionic diff --git a/tests/fixtures/os_releases/ubuntu_2004 b/tests/fixtures/os_releases/ubuntu_2004 new file mode 100644 index 000000000..022a4ca01 --- /dev/null +++ b/tests/fixtures/os_releases/ubuntu_2004 @@ -0,0 +1,12 @@ +NAME="Ubuntu" +VERSION="20.04.4 LTS (Focal Fossa)" +ID=ubuntu +ID_LIKE=debian +PRETTY_NAME="Ubuntu 20.04.4 LTS" +VERSION_ID="20.04" +HOME_URL="https://www.ubuntu.com/" +SUPPORT_URL="https://help.ubuntu.com/" +BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" +PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" +VERSION_CODENAME=focal +UBUNTU_CODENAME=focal diff --git a/tests/fixtures/os_releases/ubuntu_2204 b/tests/fixtures/os_releases/ubuntu_2204 new file mode 100644 index 000000000..9a95bef8c --- /dev/null +++ b/tests/fixtures/os_releases/ubuntu_2204 @@ -0,0 +1,12 @@ +PRETTY_NAME="Ubuntu 22.04 LTS" +NAME="Ubuntu" +VERSION_ID="22.04" +VERSION="22.04 LTS (Jammy Jellyfish)" +VERSION_CODENAME=jammy +ID=ubuntu +ID_LIKE=debian +HOME_URL="https://www.ubuntu.com/" +SUPPORT_URL="https://help.ubuntu.com/" +BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" +PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" +UBUNTU_CODENAME=jammy diff --git a/tests/fixtures/os_releases/virtuozzo_7 b/tests/fixtures/os_releases/virtuozzo_7 new file mode 100644 index 000000000..22fd9cb12 --- /dev/null +++ b/tests/fixtures/os_releases/virtuozzo_7 @@ -0,0 +1,10 @@ +NAME="Virtuozzo" +VERSION="7.0.16" +ID="virtuozzo" +ID_LIKE="rhel fedora" +VERSION_ID="7" +PRETTY_NAME="OpenVZ release 7.0.16" +ANSI_COLOR="0;31" +CPE_NAME="cpe:/o:virtuozzoproject:vz:7" +HOME_URL="http://www.virtuozzo.com" +BUG_REPORT_URL="https://bugs.openvz.org/" diff --git a/tests/fixtures/os_releases/xbian b/tests/fixtures/os_releases/xbian new file mode 100644 index 000000000..0ba42d131 --- /dev/null +++ b/tests/fixtures/os_releases/xbian @@ -0,0 +1,10 @@ +PRETTY_NAME="XBian 1.0 (knockout)" +NAME=XBian +VERSION_ID=1.0 +VERSION="1.0 (knockout)" +ID=raspbian +ID_LIKE=debian +ANSI_COLOR="1;31" +HOME_URL="http://www.xbian.org/" +SUPPORT_URL="http://forum.xbian.org/" +BUG_REPORT_URL="https://github.com/xbianonpi/xbian/issues" diff --git a/tests/fixtures/os_releases/xcp-ng_7_4 b/tests/fixtures/os_releases/xcp-ng_7_4 new file mode 100644 index 000000000..1fa9c4a4d --- /dev/null +++ b/tests/fixtures/os_releases/xcp-ng_7_4 @@ -0,0 +1,9 @@ +NAME="XCP-ng" +VERSION="7.4.0" +ID="XCP-ng" +ID_LIKE="centos rhel fedora" +VERSION_ID="7.4.0" +PRETTY_NAME="XCP-ng 7.4.0" +ANSI_COLOR="0;31" +HOME_URL="http://xcp-ng.org/" +BUG_REPORT_URL="https://github.com/xcp-ng/xcp" diff --git a/tests/fixtures/os_releases/xcp-ng_7_5 b/tests/fixtures/os_releases/xcp-ng_7_5 new file mode 100644 index 000000000..e4127a628 --- /dev/null +++ b/tests/fixtures/os_releases/xcp-ng_7_5 @@ -0,0 +1,9 @@ +NAME="XCP-ng" +VERSION="7.5.0" +ID="xenenterprise" +ID_LIKE="centos rhel fedora" +VERSION_ID="7.5.0" +PRETTY_NAME="XCP-ng 7.5.0" +ANSI_COLOR="0;31" +HOME_URL="http://xcp-ng.org/" +BUG_REPORT_URL="https://github.com/xcp-ng/xcp" diff --git a/tests/fixtures/os_releases/xcp-ng_8 b/tests/fixtures/os_releases/xcp-ng_8 new file mode 100644 index 000000000..3302b21b2 --- /dev/null +++ b/tests/fixtures/os_releases/xcp-ng_8 @@ -0,0 +1,9 @@ +NAME="XCP-ng" +VERSION="8.2.0" +ID="xenenterprise" +ID_LIKE="centos rhel fedora" +VERSION_ID="8.2.0" +PRETTY_NAME="XCP-ng 8.2.0" +ANSI_COLOR="0;31" +HOME_URL="http://xcp-ng.org/" +BUG_REPORT_URL="https://github.com/xcp-ng/xcp" diff --git a/tests/fixtures/os_releases/xenserver_7_6 b/tests/fixtures/os_releases/xenserver_7_6 new file mode 100644 index 000000000..b7d423ab8 --- /dev/null +++ b/tests/fixtures/os_releases/xenserver_7_6 @@ -0,0 +1,8 @@ +NAME="XenServer" +VERSION="7.6.0" +ID="xenenterprise" +ID_LIKE="centos rhel fedora" +PRETTY_NAME="XenServer 7.6.0" +ANSI_COLOR="0;31" +HOME_URL="https://xenserver.org/" +BUG_REPORT_URL="https://bugs.xenserver.org/" diff --git a/tests/unit/CMakeLists.txt b/tests/unit/CMakeLists.txt index 840c85561..6864f3eae 100644 --- a/tests/unit/CMakeLists.txt +++ b/tests/unit/CMakeLists.txt @@ -29,6 +29,7 @@ add_executable(sentry_test_unit test_modulefinder.c test_mpack.c test_options.c + test_os_release.c test_path.c test_ratelimiter.c test_sampling.c diff --git a/tests/unit/test_os_release.c b/tests/unit/test_os_release.c new file mode 100644 index 000000000..40ed80297 --- /dev/null +++ b/tests/unit/test_os_release.c @@ -0,0 +1,194 @@ +#include "sentry_path.h" +#include "sentry_testsupport.h" + +#if defined(SENTRY_PLATFORM_LINUX) && !defined(SENTRY_PLATFORM_ANDROID) +# include + +struct distro { + char *name; + char *version; +}; + +const struct distro test_dists[] = { + { .name = "almalinux", .version = "8.7" }, + { .name = "amzn", .version = "2" }, + { .name = "alpine", .version = "3.9.6" }, + { .name = "fedora", .version = "28" }, + { .name = "sles_sap", .version = "12.2" }, + { .name = "opensuse-leap", .version = "15.4" }, + { .name = "clear-linux-os", .version = "38250" }, + { .name = "almalinux", .version = "9.1" }, + { .name = "alpine", .version = "3.8.5" }, + { .name = "xenenterprise", .version = "8.2.0" }, + { .name = "sles", .version = "12.3" }, + { .name = "manjaro-arm", .version = "" }, + { .name = "fedora", .version = "29" }, + { .name = "slackware", .version = "14.2" }, + { .name = "debian", .version = "8" }, + { .name = "cumulus-linux", .version = "3.7.2" }, + { .name = "ubuntu", .version = "18.04" }, + { .name = "debian", .version = "9" }, + { .name = "ubuntu", .version = "16.04" }, + { .name = "debian", .version = "7" }, + { .name = "sles", .version = "12.3" }, + { .name = "debian", .version = "10" }, + { .name = "elementary", .version = "5.0" }, + { .name = "raspbian", .version = "8" }, + { .name = "ubuntu", .version = "20.04" }, + { .name = "ol", .version = "8.7" }, + { .name = "alpine", .version = "3.17.2" }, + { .name = "amzn", .version = "2018.03" }, + { .name = "scientific", .version = "7.5" }, + { .name = "alpine", .version = "3.10.9" }, + { .name = "debian", .version = "11" }, + { .name = "ol", .version = "7.9" }, + { .name = "alpine", .version = "3.11.13" }, + { .name = "ol", .version = "9.1" }, + { .name = "alpine", .version = "3.16.4" }, + { .name = "fedora", .version = "34" }, + { .name = "fedora", .version = "33" }, + { .name = "sled", .version = "15" }, + { .name = "XCP-ng", .version = "7.4.0" }, + { .name = "linuxmint", .version = "18.2" }, + { .name = "fedora", .version = "32" }, + { .name = "fedora", .version = "35" }, + { .name = "sles", .version = "11.4" }, + { .name = "clearos", .version = "7" }, + { .name = "xenenterprise", .version = "7.5.0" }, + { .name = "sles_sap", .version = "12.1.0.1" }, + { .name = "centos", .version = "8" }, + { .name = "kali", .version = "2018.4" }, + { .name = "centos", .version = "7" }, + { .name = "sles_sap", .version = "12.0.1" }, + { .name = "arch", .version = "TEMPLATE_VERSION_ID" }, + { .name = "ios_xr", .version = "6.0.0.14I" }, + { .name = "rocky", .version = "8.7" }, + { .name = "nexus", .version = "7.0(BUILDER)" }, + { .name = "ubuntu", .version = "14.04" }, + { .name = "xenenterprise", .version = "" }, + { .name = "rancheros", .version = "v1.4.2" }, + { .name = "raspbian", .version = "1.0" }, + { .name = "rocky", .version = "9.1" }, + { .name = "antergos", .version = "" }, + { .name = "linuxmint", .version = "19" }, + { .name = "alpine", .version = "3.13.12" }, + { .name = "nixos", .version = "18.09.1436.a7fd4310c0c" }, + { .name = "alpine", .version = "3.14.9" }, + { .name = "arcolinux", .version = "" }, + { .name = "elementary", .version = "6" }, + { .name = "ubuntu", .version = "22.04" }, + { .name = "manjaro", .version = "" }, + { .name = "amzn", .version = "2022" }, + { .name = "alpine", .version = "3.15.7" }, + { .name = "alpine", .version = "3.12.12" }, + { .name = "gentoo", .version = "" }, + { .name = "archarm", .version = "" }, + { .name = "raspbian", .version = "10" }, + { .name = "sles", .version = "15" }, + { .name = "rhel", .version = "8.0" }, + { .name = "fedora", .version = "30" }, + { .name = "fedora", .version = "37" }, + { .name = "mageia", .version = "6" }, + { .name = "rhel", .version = "9.1" }, + { .name = "sles", .version = "15.1" }, + { .name = "rhel", .version = "7.5" }, + { .name = "fedora", .version = "38" }, + { .name = "centos", .version = "8" }, + { .name = "fedora", .version = "36" }, + { .name = "endeavouros", .version = "" }, + { .name = "virtuozzo", .version = "7" }, + { .name = "opensuse", .version = "42.3" }, + { .name = "fedora", .version = "31" }, + { .name = "pop", .version = "22.04" }, + { .name = "sled", .version = "12.3" }, +}; + +const size_t num_test_dists = sizeof(test_dists) / sizeof(struct distro); + +int +value_strcmp_by_key(sentry_value_t value, const char *key, const char *str) +{ + return strcmp( + sentry_value_as_string(sentry_value_get_by_key(value, key)), str); +} + +int +assert_equals_snap(sentry_value_t os_dist) +{ + for (size_t i = 0; i < num_test_dists; i++) { + const struct distro *expected = &test_dists[i]; + if (value_strcmp_by_key(os_dist, "name", expected->name) == 0 + && value_strcmp_by_key(os_dist, "version", expected->version) + == 0) { + return 1; + } + } + return 0; +} + +extern sentry_value_t get_linux_os_release(const char *os_rel_path); +#endif // defined(SENTRY_PLATFORM_LINUX) && !defined(SENTRY_PLATFORM_ANDROID) + +SENTRY_TEST(os_releases_snapshot) +{ +#if !defined(SENTRY_PLATFORM_LINUX) || defined(SENTRY_PLATFORM_ANDROID) + SKIP_TEST(); +#else + const char *rel_test_data_path = "../fixtures/os_releases"; + sentry_path_t *path = sentry__path_from_str(__FILE__); + sentry_path_t *dir = sentry__path_dir(path); + sentry__path_free(path); + + sentry_path_t *test_data_path + = sentry__path_join_str(dir, rel_test_data_path); + sentry__path_free(dir); + TEST_ASSERT(sentry__path_is_dir(test_data_path)); + + DIR *test_data_dir = opendir(test_data_path->path); + TEST_ASSERT(test_data_dir != NULL); + + struct dirent *entry; + + int successful_snap_asserts = 0; + while ((entry = readdir(test_data_dir)) != NULL) { + if (entry->d_type != DT_REG || strcmp("LICENSE", entry->d_name) == 0 + || strcmp("README.md", entry->d_name) == 0 + || strcmp("distribution_names.txt", entry->d_name) == 0) { + continue; + } + + sentry_path_t *test_file_path + = sentry__path_join_str(test_data_path, entry->d_name); + sentry_value_t os_dist = get_linux_os_release(test_file_path->path); + sentry__path_free(test_file_path); + TEST_ASSERT(!sentry_value_is_null(os_dist)); + int snap_result = assert_equals_snap(os_dist); + if (!snap_result) { + TEST_CHECK(snap_result); + TEST_MSG("%s: %s not found", + sentry_value_as_string( + sentry_value_get_by_key(os_dist, "name")), + sentry_value_as_string( + sentry_value_get_by_key(os_dist, "version"))); + } else { + successful_snap_asserts++; + } + sentry_value_decref(os_dist); + } + + TEST_CHECK_INT_EQUAL(successful_snap_asserts, num_test_dists); + + closedir(test_data_dir); + sentry__path_free(test_data_path); +#endif // !defined(SENTRY_PLATFORM_LINUX) || defined(SENTRY_PLATFORM_ANDROID) +} + +SENTRY_TEST(os_release_non_existent_files) +{ +#if !defined(SENTRY_PLATFORM_LINUX) || defined(SENTRY_PLATFORM_ANDROID) + SKIP_TEST(); +#else + sentry_value_t os_release = get_linux_os_release("invalid_path"); + TEST_ASSERT(sentry_value_is_null(os_release)); +#endif // !defined(SENTRY_PLATFORM_LINUX) || defined(SENTRY_PLATFORM_ANDROID) +} \ No newline at end of file diff --git a/tests/unit/tests.inc b/tests/unit/tests.inc index d7f9fae29..e5c241e38 100644 --- a/tests/unit/tests.inc +++ b/tests/unit/tests.inc @@ -61,6 +61,8 @@ XX(options_sdk_name_custom) XX(options_sdk_name_defaults) XX(options_sdk_name_invalid) XX(os) +XX(os_release_non_existent_files) +XX(os_releases_snapshot) XX(overflow_spans) XX(page_allocator) XX(path_basics)