xref: /OK3568_Linux_fs/yocto/poky/meta/lib/oeqa/sdk/cases/perl.py (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun#
2*4882a593Smuzhiyun# SPDX-License-Identifier: MIT
3*4882a593Smuzhiyun#
4*4882a593Smuzhiyun
5*4882a593Smuzhiyunimport unittest
6*4882a593Smuzhiyunfrom oeqa.sdk.case import OESDKTestCase
7*4882a593Smuzhiyun
8*4882a593Smuzhiyunfrom oeqa.utils.subprocesstweak import errors_have_output
9*4882a593Smuzhiyunerrors_have_output()
10*4882a593Smuzhiyun
11*4882a593Smuzhiyunclass PerlTest(OESDKTestCase):
12*4882a593Smuzhiyun    def setUp(self):
13*4882a593Smuzhiyun        if not (self.tc.hasHostPackage("nativesdk-perl") or
14*4882a593Smuzhiyun                self.tc.hasHostPackage("perl-native")):
15*4882a593Smuzhiyun            raise unittest.SkipTest("No perl package in the SDK")
16*4882a593Smuzhiyun
17*4882a593Smuzhiyun    def test_perl(self):
18*4882a593Smuzhiyun        cmd = "perl -e '$_=\"Uryyb, jbeyq\"; tr/a-zA-Z/n-za-mN-ZA-M/;print'"
19*4882a593Smuzhiyun        output = self._run(cmd)
20*4882a593Smuzhiyun        self.assertEqual(output, "Hello, world")
21