VirtualBox

Ignore:
Timestamp:
Mar 30, 2023 2:24:55 PM (2 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
156614
Message:

ValidationKit/tests/api/tdCloneMedium1.py: Solaris delivers python2 as a
32-bit binary which can't handle signed values above 0x7fffffff (MAXINT)
such as 0xdeadbeef. This causes the test suite to fail on Solaris with
the message: 'OverflowError: Python int too large to convert to C long'.
Fixed by using a smaller value when running 32-bit python2 on Solaris.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/tests/api/tdCloneMedium1.py

    r98651 r99235  
    4444import os
    4545import sys
     46import platform
    4647
    4748# Only the main script needs to modify the path.
     
    5253
    5354# Validation Kit imports.
     55from common     import utils
    5456from testdriver import base
    5557from testdriver import reporter
     
    6567    def __init__(self, oTstDrv):
    6668        base.SubTestDriverBase.__init__(self, oTstDrv, 'clone-medium', 'Move Medium');
     69        # Solaris delivers a 32-bit version of Python 2.7 which can't handle signed values
     70        # above 0x7fffffff (MAXINT) such as 0xdeadbeef.  N.B. If this ever needs to be
     71        # extended to other OSes the Python docs:
     72        # https://docs.python.org/3/library/platform.html#platform.architecture
     73        # mention that the platform.architecture() call can be wrong on macOS.
     74        if utils.getHostOs() == 'solaris' and sys.version_info[0] < 3 and platform.architecture()[0] == '32bit':
     75            self.iDataToWrite = 0x0badcafe;
     76        else:
     77            self.iDataToWrite = 0xdeadbeef;
    6778
    6879    def testIt(self):
     
    174185        oVM = self.oTstDrv.createTestVM('test-medium-clone-only', 1, None, 4)
    175186
    176         hd1 = self.createTestMedium(oVM, "hd1-cloneonly", data=[0xdeadbeef])
     187        hd1 = self.createTestMedium(oVM, "hd1-cloneonly", data=[self.iDataToWrite])
    177188        hd2 = self.createTestMedium(oVM, "hd2-cloneonly")
    178189
     
    205216        oVM = self.oTstDrv.createTestVM('test-medium-clone-only', 1, None, 4)
    206217
    207         hd1 = self.createTestMedium(oVM, "hd1-resizeandclone", data=[0xdeadbeef])
     218        hd1 = self.createTestMedium(oVM, "hd1-resizeandclone", data=[self.iDataToWrite])
    208219        hd2 = self.createTestMedium(oVM, "hd2-resizeandclone")
    209220
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette