From 34c994011ba790167c2ffa8a9f7da78e38236147 Mon Sep 17 00:00:00 2001
From: gcontini <1121667+gcontini@users.noreply.github.com>
Date: 周日, 11 10月 2020 17:09:26 +0800
Subject: [PATCH] add tests/docs for Ubuntu 20.04

---
 doc/development/Dependencies.md      |    1 +
 /dev/null                            |    1 -
 doc/development/Build-the-library.md |    5 +++--
 test/library/os_linux_test.cpp       |   12 ++++++++----
 src/library/os/linux/os_linux.cpp    |    3 ++-
 .github/workflows/cpp.yml            |    3 +++
 6 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/.github/FUNDING.YML b/.github/FUNDING.YML
deleted file mode 100644
index c498801..0000000
--- a/.github/FUNDING.YML
+++ /dev/null
@@ -1 +0,0 @@
-custom: ['https://www.paypal.me/1gabr1']
\ No newline at end of file
diff --git a/.github/workflows/cpp.yml b/.github/workflows/cpp.yml
index cf8dba2..bf45393 100644
--- a/.github/workflows/cpp.yml
+++ b/.github/workflows/cpp.yml
@@ -9,6 +9,9 @@
 
     steps:
     - uses: actions/checkout@v1
+    - name: Setup Boost (Windows / Linux latest)
+      shell: bash
+      run: echo "BOOST_ROOT=$BOOST_ROOT_1_72_0" >> $GITHUB_ENV
     - name: Compile & Test
       run: |
         mkdir -p build
diff --git a/doc/development/Build-the-library.md b/doc/development/Build-the-library.md
index 6c4bc21..f36cb2e 100644
--- a/doc/development/Build-the-library.md
+++ b/doc/development/Build-the-library.md
@@ -1,10 +1,11 @@
 # Build - Linux
 
 ## Install prerequisites
-Below the prerequisites for compiling open-license-manager. For developing it we use Eclipse. Recent CDT works smoothly with CMake. Remember to install the Ninja package as build system and Cmake Gui for a good eclipse integration.
+Below the prerequisites for compiling `open-license-manager`. For developing it we use Eclipse. 
+Recent CDT works smoothly with CMake. Remember to install the Ninja package as build system and Cmake Gui for a good eclipse integration.
  
 ### Ubuntu
-Supported Ubuntu distributions are 18.04 (Bionic Beaver) and 16.04 (Xenial) though it should be possible to build on any recent Ubuntu version.
+Supported Ubuntu distributions are 20.04 (Focal Fossa), 18.04 (Bionic Beaver) and 16.04 (Xenial). It should be possible to build on any recent Ubuntu (debian like) version.
 
 Install prerequisites:
 
diff --git a/doc/development/Dependencies.md b/doc/development/Dependencies.md
index aa81f4e..0c22d27 100644
--- a/doc/development/Dependencies.md
+++ b/doc/development/Dependencies.md
@@ -11,6 +11,7 @@
 
 | Operating System               | Openssl    | Zlib                        | Boost<sup>2</sup>   |
 |--------------------------------|:----------:|:---------------------------:|:-------------------:| 
+| Ubuntu 20.04     | :heavy_check_mark: v1.1.1f| :question: optional         | optional(test) 1.71 |
 | Ubuntu 18.04     | :heavy_check_mark: v1.1.1| :question: optional         | optional(test) 1.65 |
 | Ubuntu 16.04     | :heavy_check_mark: v1.0.2| :question: req.by openssl   | optional(test)      |
 | Centos 7         | :heavy_check_mark: v1.0.2| :question: req.by openssl   | otpional(test) 1.53 |
diff --git a/src/library/os/linux/os_linux.cpp b/src/library/os/linux/os_linux.cpp
index d934623..f1041a4 100644
--- a/src/library/os/linux/os_linux.cpp
+++ b/src/library/os/linux/os_linux.cpp
@@ -91,7 +91,8 @@
 	currentDrive = 0;
 	while (NULL != (ent = getmntent(aFile))) {
 		if ((strncmp(ent->mnt_type, "ext", 3) == 0 || strncmp(ent->mnt_type, "xfs", 3) == 0 ||
-			 strncmp(ent->mnt_type, "vfat", 4) == 0 || strncmp(ent->mnt_type, "ntfs", 4) == 0) &&
+			 strncmp(ent->mnt_type, "vfat", 4) == 0 || strncmp(ent->mnt_type, "ntfs", 4) == 0
+				|| strncmp(ent->mnt_type, "btr", 3) == 0) &&
 			ent->mnt_fsname != NULL && strncmp(ent->mnt_fsname, "/dev/", 5) == 0) {
 			if (stat(ent->mnt_fsname, &mount_stat) == 0) {
 				drive_found = -1;
diff --git a/test/library/os_linux_test.cpp b/test/library/os_linux_test.cpp
index 68d3c76..ae725d7 100644
--- a/test/library/os_linux_test.cpp
+++ b/test/library/os_linux_test.cpp
@@ -23,12 +23,16 @@
 		FUNCTION_RETURN result = getDiskInfos(NULL, &disk_info_size);
 		BOOST_CHECK_EQUAL(result, FUNC_RET_OK);
 		BOOST_CHECK_GT(disk_info_size, 0);
-		diskInfos = (DiskInfo *)malloc(sizeof(DiskInfo) * disk_info_size);
+		diskInfos = (DiskInfo*) malloc(sizeof(DiskInfo) * disk_info_size);
 		result = getDiskInfos(diskInfos, &disk_info_size);
 		BOOST_CHECK_EQUAL(result, FUNC_RET_OK);
 		BOOST_CHECK_GT(mstrnlen_s(diskInfos[0].device, sizeof(diskInfos[0].device)), 0);
 		BOOST_CHECK_GT(mstrnlen_s(diskInfos[0].label, sizeof diskInfos[0].label), 0);
-		BOOST_CHECK_GT(diskInfos[0].disk_sn[0], 0);
+		bool all_zero = true;
+		for (int i = 0; i < diskInfos[0].disk_sn && all_zero; i++) {
+			all_zero = (diskInfos[0].disk_sn[i] != 0);
+		}
+		BOOST_CHECK_MESSAGE(!all_zero, "disksn is not all zero");
 		free(diskInfos);
 	} else if (virt == LCC_API_VIRTUALIZATION_SUMMARY::CONTAINER) {
 		// docker or lxc diskInfo is not meaningful
@@ -39,5 +43,5 @@
 	}
 }
 
-}  // namespace test
-}  // namespace license
+} // namespace test
+} // namespace license

--
Gitblit v1.9.1