5 def boot_armv5_cpio(emulator, builddir):
6 img = os.path.join(builddir, "images", "rootfs.cpio")
7 emulator.boot(arch="armv5", kernel="builtin",
8 options=["-initrd", img])
11 class TestNoTimezone(infra.basetest.BRTest):
12 config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
14 # BR2_TARGET_TZ_INFO is not set
15 BR2_TARGET_ROOTFS_CPIO=y
16 # BR2_TARGET_ROOTFS_TAR is not set
20 boot_armv5_cpio(self.emulator, self.builddir)
21 tz, _ = self.emulator.run("TZ=UTC date +%Z")
22 self.assertEqual(tz[0].strip(), "UTC")
23 tz, _ = self.emulator.run("TZ=America/Los_Angeles date +%Z")
24 self.assertEqual(tz[0].strip(), "UTC")
26 class TestGlibcAllTimezone(infra.basetest.BRTest):
30 BR2_TOOLCHAIN_EXTERNAL=y
32 BR2_TARGET_ROOTFS_CPIO=y
33 # BR2_TARGET_ROOTFS_TAR is not set
37 boot_armv5_cpio(self.emulator, self.builddir)
38 tz, _ = self.emulator.run("date +%Z")
39 self.assertEqual(tz[0].strip(), "UTC")
40 tz, _ = self.emulator.run("TZ=UTC date +%Z")
41 self.assertEqual(tz[0].strip(), "UTC")
42 tz, _ = self.emulator.run("TZ=America/Los_Angeles date +%Z")
43 self.assertEqual(tz[0].strip(), "PST")
44 tz, _ = self.emulator.run("TZ=Europe/Paris date +%Z")
45 self.assertEqual(tz[0].strip(), "CET")
47 class TestGlibcNonDefaultLimitedTimezone(infra.basetest.BRTest):
51 BR2_TOOLCHAIN_EXTERNAL=y
53 BR2_TARGET_TZ_ZONELIST="northamerica"
54 BR2_TARGET_LOCALTIME="America/New_York"
55 BR2_TARGET_ROOTFS_CPIO=y
56 # BR2_TARGET_ROOTFS_TAR is not set
60 boot_armv5_cpio(self.emulator, self.builddir)
61 tz, _ = self.emulator.run("date +%Z")
62 self.assertEqual(tz[0].strip(), "EST")
63 tz, _ = self.emulator.run("TZ=UTC date +%Z")
64 self.assertEqual(tz[0].strip(), "UTC")
65 tz, _ = self.emulator.run("TZ=America/Los_Angeles date +%Z")
66 self.assertEqual(tz[0].strip(), "PST")
67 tz, _ = self.emulator.run("TZ=Europe/Paris date +%Z")
68 self.assertEqual(tz[0].strip(), "Europe")