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,4BAA7D,CApBmD;;AAAA;AAqBzD,oBAAQ,GAAR,CAAY,gBAAZ;AArByD;AAAA,mBAsBnD,+BAAK,kCAAkC,WAAlC,GAAgD,GAAhD,GAAsD,sBAA3D,CAtBmD;;AAAA;AAuBzD,oBAAQ,GAAR,CAAY,gBAAZ;AAvByD,8CAwBlD,+BAAK,sBAAsB,4BAAtB,GAAqD,GAArD,GAA2D,sBAAhE,EACJ,KADI,CACE,UAAC,KAAD,EAAW;AAChB,sBAAQ,KAAR,CAAc,MAAM,MAApB;AACA,sBAAQ,KAAR,CAAc,MAAM,MAApB;AACA,2BAAO,IAAP,CAAY,WAAZ,EAAyB,YAAzB,EAAuC,MAAM,OAA7C;AACD,aALI,CAxBkD;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAA3D;AA+BD,CArDD","file":"vmdk-to-vhd.spec.js","sourcesContent":["'use strict'\n\nimport {assert} from 'chai'\nimport {describe, it} from 'mocha'\nimport {exec} from 'child-process-promise'\nimport {createReadStream, createWriteStream} from 'fs-promise'\n\nimport {readRawContent} from './vmdk-read'\nimport {VHDFile, convertFromVMDK, computeGeometryForSize} from './vhd-write'\n\ndescribe('VMDK to VHD conversion', () => {\n it('can convert a random data file with readRawContent()', async () => {\n let inputRawFileName = 'random-data.raw'\n let vmdkFileName = 'random-data.vmdk'\n let vhdFileName = 'from-vmdk-readRawContent.vhd'\n let reconvertedRawFilemane = 'from-vhd.raw'\n let dataSize = 5222400\n await exec('rm -f ' + [inputRawFileName, vmdkFileName, vhdFileName, reconvertedRawFilemane].join(' '))\n await exec('base64 /dev/urandom | head -c ' + dataSize + ' > ' + inputRawFileName)\n await exec('VBoxManage convertfromraw --format VMDK --variant Stream ' + inputRawFileName + ' ' + vmdkFileName)\n const rawContent = (await readRawContent(createReadStream(vmdkFileName))).rawFile\n const f = new VHDFile(rawContent.length, 523557791)\n await f.writeBuffer(rawContent)\n await f.writeFile(vhdFileName)\n await exec('qemu-img convert -fvpc -Oraw ' + vhdFileName + ' ' + reconvertedRawFilemane)\n await exec('qemu-img compare ' + vmdkFileName + ' ' + vhdFileName)\n .catch((error) => {\n console.error(error.stdout)\n console.error(error.stderr)\n assert.fail(vhdFileName, vmdkFileName, error.message)\n })\n })\n it('can convert a random data file with VMDKDirectParser', async () => {\n let inputRawFileName = 'random-data.raw'\n let vmdkFileName = 'random-data.vmdk'\n let vhdFileName = 'from-vmdk-VMDKDirectParser.vhd'\n let reconvertedRawFilemane = 'from-vhd.raw'\n let reconvertedByVBoxRawFilemane = 'from-vhd-by-vbox.raw'\n let dataSize = computeGeometryForSize(8 * 1024 * 1024).actualSize\n await exec('rm -f ' + [inputRawFileName, vmdkFileName, vhdFileName, reconvertedRawFilemane, reconvertedByVBoxRawFilemane].join(' '))\n await exec('base64 /dev/urandom | head -c ' + dataSize + ' > ' + inputRawFileName)\n console.log('after urandom')\n\n await exec('VBoxManage convertfromraw --format VMDK --variant Stream ' + inputRawFileName + ' ' + vmdkFileName)\n\n console.log('after convertfromraw')\n const pipe = (await convertFromVMDK(createReadStream(vmdkFileName))).pipe(createWriteStream(vhdFileName))\n await new Promise((resolve, reject) => {\n pipe.on('finish', resolve)\n pipe.on('error', reject)\n })\n console.log('after pipe')\n await exec('qemu-img convert -fvmdk -Oraw ' + vmdkFileName + ' ' + reconvertedByVBoxRawFilemane)\n console.log('after convert1')\n await exec('qemu-img convert -fvpc -Oraw ' + vhdFileName + ' ' + reconvertedRawFilemane)\n console.log('after convert2')\n return exec('qemu-img compare ' + reconvertedByVBoxRawFilemane + ' ' + reconvertedRawFilemane)\n .catch((error) => {\n console.error(error.stdout)\n console.error(error.stderr)\n assert.fail(vhdFileName, vmdkFileName, error.message)\n })\n })\n})\n"]}
\No newline at end of file