Message ID | 20241109175509.1364647-2-ju.o@free.fr |
---|---|
State | Accepted |
Headers | show |
Series | [1/2] package/proj: add an option to build and install apps | expand |
On 2024-11-09 18:55, Julien Olivain wrote: > Signed-off-by: Julien Olivain <ju.o@free.fr> Tested-by: Zoltan Gyarmati <zgyarmati@zgyarmati.de> Reviewed-by: Zoltan Gyarmati <zgyarmati@zgyarmati.de> > --- > Patch series runtime tested in: > https://gitlab.com/jolivain/buildroot/-/jobs/8316072722 > --- > DEVELOPERS | 1 + > support/testing/tests/package/test_proj.py | 59 ++++++++++++++++++++++ > 2 files changed, 60 insertions(+) > create mode 100644 support/testing/tests/package/test_proj.py > > diff --git a/DEVELOPERS b/DEVELOPERS > index 1d70e46e8d..1eb2a58502 100644 > --- a/DEVELOPERS > +++ b/DEVELOPERS > @@ -1970,6 +1970,7 @@ F: support/testing/tests/package/test_pigz.py > F: support/testing/tests/package/test_postgresql.py > F: support/testing/tests/package/test_pppd.py > F: support/testing/tests/package/test_pppd/ > +F: support/testing/tests/package/test_proj.py > F: support/testing/tests/package/test_pv.py > F: support/testing/tests/package/test_python_distro.py > F: support/testing/tests/package/test_python_gnupg.py > diff --git a/support/testing/tests/package/test_proj.py > b/support/testing/tests/package/test_proj.py > new file mode 100644 > index 0000000000..ed23c229fd > --- /dev/null > +++ b/support/testing/tests/package/test_proj.py > @@ -0,0 +1,59 @@ > +import os > + > +import infra.basetest > + > + > +class TestProj(infra.basetest.BRTest): > + config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \ > + """ > + BR2_PACKAGE_PROJ=y > + BR2_PACKAGE_PROJ_APPS=y > + BR2_TARGET_ROOTFS_CPIO=y > + # BR2_TARGET_ROOTFS_TAR is not set > + """ > + > + def test_run(self): > + cpio_file = os.path.join(self.builddir, "images", > "rootfs.cpio") > + self.emulator.boot(arch="armv5", > + kernel="builtin", > + options=["-initrd", cpio_file]) > + self.emulator.login() > + > + # We check the program can run. The "proj" command does not > + # have a "--version" option. It will just show its version > + # when invoked without any argument. > + self.assertRunOk("proj") > + > + # The commands in this tests are taken from the Proj > + # documentation quickstart page, at: > + # https://proj.org/en/9.5/usage/quickstart.html > + > + proj_str = "+proj=merc +lat_ts=56.5 +ellps=GRS80" > + cmd = "echo 55.2 12.2" > + cmd += f" | proj {proj_str}" > + out, ret = self.emulator.run(cmd) > + self.assertEqual(ret, 0) > + expected_values = [3399483.80, 752085.60] > + values = list(map(lambda x: float(x), out[0].split())) > + for i in range(len(expected_values)): > + self.assertAlmostEqual(values[i], expected_values[i]) > + > + proj_str = "+proj=merc +lat_ts=56.5 +ellps=GRS80 +to +proj=utm > +zone=32" > + cmd = "echo 3399483.80 752085.60" > + cmd += f" | cs2cs {proj_str}" > + out, ret = self.emulator.run(cmd) > + self.assertEqual(ret, 0) > + expected_values = [6103992.36, 1924052.47, 0.00] > + values = list(map(lambda x: float(x), out[0].split())) > + for i in range(len(expected_values)): > + self.assertAlmostEqual(values[i], expected_values[i]) > + > + proj_str = "+init=epsg:4326 +to +init=epsg:25832" > + cmd = "echo 56 12" > + cmd += f" | cs2cs {proj_str}" > + out, ret = self.emulator.run(cmd) > + self.assertEqual(ret, 0) > + expected_values = [6231950.54, 1920310.71, 0.00] > + values = list(map(lambda x: float(x), out[0].split())) > + for i in range(len(expected_values)): > + self.assertAlmostEqual(values[i], expected_values[i])
diff --git a/DEVELOPERS b/DEVELOPERS index 1d70e46e8d..1eb2a58502 100644 --- a/DEVELOPERS +++ b/DEVELOPERS @@ -1970,6 +1970,7 @@ F: support/testing/tests/package/test_pigz.py F: support/testing/tests/package/test_postgresql.py F: support/testing/tests/package/test_pppd.py F: support/testing/tests/package/test_pppd/ +F: support/testing/tests/package/test_proj.py F: support/testing/tests/package/test_pv.py F: support/testing/tests/package/test_python_distro.py F: support/testing/tests/package/test_python_gnupg.py diff --git a/support/testing/tests/package/test_proj.py b/support/testing/tests/package/test_proj.py new file mode 100644 index 0000000000..ed23c229fd --- /dev/null +++ b/support/testing/tests/package/test_proj.py @@ -0,0 +1,59 @@ +import os + +import infra.basetest + + +class TestProj(infra.basetest.BRTest): + config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \ + """ + BR2_PACKAGE_PROJ=y + BR2_PACKAGE_PROJ_APPS=y + BR2_TARGET_ROOTFS_CPIO=y + # BR2_TARGET_ROOTFS_TAR is not set + """ + + def test_run(self): + cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio") + self.emulator.boot(arch="armv5", + kernel="builtin", + options=["-initrd", cpio_file]) + self.emulator.login() + + # We check the program can run. The "proj" command does not + # have a "--version" option. It will just show its version + # when invoked without any argument. + self.assertRunOk("proj") + + # The commands in this tests are taken from the Proj + # documentation quickstart page, at: + # https://proj.org/en/9.5/usage/quickstart.html + + proj_str = "+proj=merc +lat_ts=56.5 +ellps=GRS80" + cmd = "echo 55.2 12.2" + cmd += f" | proj {proj_str}" + out, ret = self.emulator.run(cmd) + self.assertEqual(ret, 0) + expected_values = [3399483.80, 752085.60] + values = list(map(lambda x: float(x), out[0].split())) + for i in range(len(expected_values)): + self.assertAlmostEqual(values[i], expected_values[i]) + + proj_str = "+proj=merc +lat_ts=56.5 +ellps=GRS80 +to +proj=utm +zone=32" + cmd = "echo 3399483.80 752085.60" + cmd += f" | cs2cs {proj_str}" + out, ret = self.emulator.run(cmd) + self.assertEqual(ret, 0) + expected_values = [6103992.36, 1924052.47, 0.00] + values = list(map(lambda x: float(x), out[0].split())) + for i in range(len(expected_values)): + self.assertAlmostEqual(values[i], expected_values[i]) + + proj_str = "+init=epsg:4326 +to +init=epsg:25832" + cmd = "echo 56 12" + cmd += f" | cs2cs {proj_str}" + out, ret = self.emulator.run(cmd) + self.assertEqual(ret, 0) + expected_values = [6231950.54, 1920310.71, 0.00] + values = list(map(lambda x: float(x), out[0].split())) + for i in range(len(expected_values)): + self.assertAlmostEqual(values[i], expected_values[i])
Signed-off-by: Julien Olivain <ju.o@free.fr> --- Patch series runtime tested in: https://gitlab.com/jolivain/buildroot/-/jobs/8316072722 --- DEVELOPERS | 1 + support/testing/tests/package/test_proj.py | 59 ++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 support/testing/tests/package/test_proj.py