diff options
| author | Carl Hetherington <cth@carlh.net> | 2012-07-17 17:25:18 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2012-07-17 17:25:18 +0100 |
| commit | 1c22ef308a1d62b4c6935ede8233b1fea082b0ca (patch) | |
| tree | c3d8e8321e4b1aa09cce056d5a35da908a0ae3d9 | |
| parent | 0e7591e3bf95d4abe08d854850b6fc4e411586b0 (diff) | |
Various test hackery.
| -rwxr-xr-x | asdcplib/src/KM_prng.cpp | 2 | ||||
| -rwxr-xr-x | asdcplib/src/KM_prng.h | 2 | ||||
| -rwxr-xr-x | asdcplib/src/KM_util.cpp | 11 | ||||
| -rwxr-xr-x | asdcplib/src/KM_util.h | 2 | ||||
| -rwxr-xr-x | run-tests.sh | 6 | ||||
| -rw-r--r-- | src/asset.cc | 1 | ||||
| -rw-r--r-- | test/ref/DCP/8e293965-f8ad-48c6-971d-261b01f65cdb_pkl.xml | 8 | ||||
| -rw-r--r-- | test/ref/DCP/ASSETMAP.xml | 2 | ||||
| -rw-r--r-- | test/ref/DCP/audio.mxf | bin | 305326 -> 305326 bytes | |||
| -rw-r--r-- | test/ref/DCP/df0e4141-13c3-4a7a-bef8-b5a04fcbc4bb_cpl.xml | 8 | ||||
| -rw-r--r-- | test/ref/DCP/video.mxf | bin | 26080 -> 26080 bytes | |||
| -rwxr-xr-x | test/ref/make.py | 43 | ||||
| -rw-r--r-- | test/tests.cc | 2 |
13 files changed, 63 insertions, 24 deletions
diff --git a/asdcplib/src/KM_prng.cpp b/asdcplib/src/KM_prng.cpp index 3c64bdcc..e7526da1 100755 --- a/asdcplib/src/KM_prng.cpp +++ b/asdcplib/src/KM_prng.cpp @@ -48,8 +48,6 @@ using namespace Kumu; const char* DEV_URANDOM = "/dev/urandom"; #endif // KM_WIN32 -bool Kumu::libdcp_test = false; - const ui32_t RNG_KEY_SIZE = 512UL; const ui32_t RNG_KEY_SIZE_BITS = 256UL; const ui32_t RNG_BLOCK_SIZE = 16UL; diff --git a/asdcplib/src/KM_prng.h b/asdcplib/src/KM_prng.h index a1f23288..4d7ab2b7 100755 --- a/asdcplib/src/KM_prng.h +++ b/asdcplib/src/KM_prng.h @@ -50,8 +50,6 @@ namespace Kumu // key_len must be <= 64 (larger values will be truncated) void Gen_FIPS_186_Value(const byte_t* key_in, ui32_t key_len, byte_t* buf, ui32_t buf_len); - - extern bool libdcp_test; } // namespace Kumu diff --git a/asdcplib/src/KM_util.cpp b/asdcplib/src/KM_util.cpp index 325bd2da..23e8a1a6 100755 --- a/asdcplib/src/KM_util.cpp +++ b/asdcplib/src/KM_util.cpp @@ -40,6 +40,8 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include <map> #include <string> +bool Kumu::libdcp_test = false; + const char* Kumu::Version() { @@ -688,7 +690,14 @@ Kumu::write_BER(byte_t* buf, ui64_t val, ui32_t ber_len) // Kumu::Timestamp::Timestamp() : m_TZOffsetMinutes(0) { - m_Timestamp.now(); + if (libdcp_test) + { + m_Timestamp.x = 42; + } + else + { + m_Timestamp.now(); + } } Kumu::Timestamp::Timestamp(const Timestamp& rhs) { diff --git a/asdcplib/src/KM_util.h b/asdcplib/src/KM_util.h index 78f07398..892670e6 100755 --- a/asdcplib/src/KM_util.h +++ b/asdcplib/src/KM_util.h @@ -41,6 +41,8 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. namespace Kumu { + extern bool libdcp_test; + // The version number declaration and explanation are in ../configure.ac const char* Version(); diff --git a/run-tests.sh b/run-tests.sh index a837a287..a16806f7 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -3,4 +3,8 @@ LD_LIBRARY_PATH=build/src:build/asdcplib/src build/test/tests diff -ur build/test/foo test/ref/DCP -
\ No newline at end of file +if [ "$?" != "0" ]; then + echo "FAIL: files differ" + exit 1 +fi +echo "PASS"
\ No newline at end of file diff --git a/src/asset.cc b/src/asset.cc index 6b4c3fe4..4e3bb0e1 100644 --- a/src/asset.cc +++ b/src/asset.cc @@ -17,6 +17,7 @@ */ +#include <iostream> #include <boost/filesystem.hpp> #include "AS_DCP.h" #include "KM_util.h" diff --git a/test/ref/DCP/8e293965-f8ad-48c6-971d-261b01f65cdb_pkl.xml b/test/ref/DCP/8e293965-f8ad-48c6-971d-261b01f65cdb_pkl.xml index e8342cc7..0e62ce07 100644 --- a/test/ref/DCP/8e293965-f8ad-48c6-971d-261b01f65cdb_pkl.xml +++ b/test/ref/DCP/8e293965-f8ad-48c6-971d-261b01f65cdb_pkl.xml @@ -2,27 +2,27 @@ <PackingList xmlns="http://www.smpte-ra.org/schemas/429-8/2007/PKL"> <Id>urn:uuid:8e293965-f8ad-48c6-971d-261b01f65cdb</Id> <AnnotationText>A Test DCP</AnnotationText> - <IssueDate>2012-07-17T04:32:07+00:00</IssueDate> + <IssueDate>2012-07-17T04:45:18+00:00</IssueDate> <Issuer>OpenDCP 0.0.25</Issuer> <Creator>OpenDCP 0.0.25</Creator> <AssetList> <Asset> <Id>urn:uuid:81fb54df-e1bf-4647-8788-ea7ba154375b</Id> <AnnotationText>video.mxf</AnnotationText> - <Hash>4jimd5RaYhFS0ENh6tUTnjMqN/M=</Hash> + <Hash>E2vhyxdJQhEzSQZdp31w84ZZpfk=</Hash> <Size>26080</Size> <Type>application/mxf</Type> </Asset> <Asset> <Id>urn:uuid:c38bdd62-ce03-4988-8603-195f134207c7</Id> <AnnotationText>audio.mxf</AnnotationText> - <Hash>6YhrUkOvm46kYdhrgDuKNvfa9uA=</Hash> + <Hash>9OVODrw+zTkSbkGduoQ30k3Kk6Y=</Hash> <Size>305326</Size> <Type>application/mxf</Type> </Asset> <Asset> <Id>urn:uuid:df0e4141-13c3-4a7a-bef8-b5a04fcbc4bb</Id> - <Hash>DR62woRxafHQcqScRIHQd6hChFU=</Hash> + <Hash>5E8Q9swcc2bBbFF3IEPNXfIP8gM=</Hash> <Size>1526</Size> <Type>text/xml</Type> </Asset> diff --git a/test/ref/DCP/ASSETMAP.xml b/test/ref/DCP/ASSETMAP.xml index cf845772..edb62bda 100644 --- a/test/ref/DCP/ASSETMAP.xml +++ b/test/ref/DCP/ASSETMAP.xml @@ -3,7 +3,7 @@ <Id>urn:uuid:18be072e-5a0f-44e1-b2eb-c8a52ae12789</Id> <Creator>OpenDCP 0.0.25</Creator> <VolumeCount>1</VolumeCount> - <IssueDate>2012-07-17T04:32:07+00:00</IssueDate> + <IssueDate>2012-07-17T04:45:18+00:00</IssueDate> <Issuer>OpenDCP 0.0.25</Issuer> <AssetList> <Asset> diff --git a/test/ref/DCP/audio.mxf b/test/ref/DCP/audio.mxf Binary files differindex a945da6d..8910b6fb 100644 --- a/test/ref/DCP/audio.mxf +++ b/test/ref/DCP/audio.mxf diff --git a/test/ref/DCP/df0e4141-13c3-4a7a-bef8-b5a04fcbc4bb_cpl.xml b/test/ref/DCP/df0e4141-13c3-4a7a-bef8-b5a04fcbc4bb_cpl.xml index 27fdc5b5..bb8775fd 100644 --- a/test/ref/DCP/df0e4141-13c3-4a7a-bef8-b5a04fcbc4bb_cpl.xml +++ b/test/ref/DCP/df0e4141-13c3-4a7a-bef8-b5a04fcbc4bb_cpl.xml @@ -2,18 +2,18 @@ <CompositionPlaylist xmlns="http://www.smpte-ra.org/schemas/429-7/2006/CPL"> <Id>urn:uuid:df0e4141-13c3-4a7a-bef8-b5a04fcbc4bb</Id> <AnnotationText>A Test DCP</AnnotationText> - <IssueDate>2012-07-17T04:32:07+00:00</IssueDate> + <IssueDate>2012-07-17T04:45:18+00:00</IssueDate> <Creator>OpenDCP 0.0.25</Creator> <ContentTitleText>A Test DCP</ContentTitleText> <ContentKind>feature</ContentKind> <ContentVersion> - <Id>urn:uri:df0e4141-13c3-4a7a-bef8-b5a04fcbc4bb_2012-07-17T04:32:07+00:00</Id> - <LabelText>df0e4141-13c3-4a7a-bef8-b5a04fcbc4bb_2012-07-17T04:32:07+00:00</LabelText> + <Id>urn:uri:df0e4141-13c3-4a7a-bef8-b5a04fcbc4bb_2012-07-17T04:45:18+00:00</Id> + <LabelText>df0e4141-13c3-4a7a-bef8-b5a04fcbc4bb_2012-07-17T04:45:18+00:00</LabelText> </ContentVersion> <RatingList/> <ReelList> <Reel> - <Id>urn:uuid:e4456baa-d4d6-42f6-bfc6-1cf748582227</Id> + <Id>urn:uuid:b135d5cf-d180-43d8-b0b3-7373737b73bf</Id> <AssetList> <MainPicture> <Id>urn:uuid:81fb54df-e1bf-4647-8788-ea7ba154375b</Id> diff --git a/test/ref/DCP/video.mxf b/test/ref/DCP/video.mxf Binary files differindex d71cf1e3..645fb85a 100644 --- a/test/ref/DCP/video.mxf +++ b/test/ref/DCP/video.mxf diff --git a/test/ref/make.py b/test/ref/make.py index 013a7c24..0b469e24 100755 --- a/test/ref/make.py +++ b/test/ref/make.py @@ -5,17 +5,18 @@ import sys import fileinput from lxml import etree -def replace(l, a, b): - return l.replace(a, b) - assetmap_namespace = 'http://www.smpte-ra.org/schemas/429-9/2007/AM' cpl_namespace = 'http://www.smpte-ra.org/schemas/429-7/2006/CPL' +pkl_namespace = 'http://www.smpte-ra.org/schemas/429-8/2007/PKL' wanted_cpl_id = 'df0e4141-13c3-4a7a-bef8-b5a04fcbc4bb' wanted_pkl_id = '8e293965-f8ad-48c6-971d-261b01f65cdb' wanted_assetmap_id = '18be072e-5a0f-44e1-b2eb-c8a52ae12789' wanted_video_mxf_id = '81fb54df-e1bf-4647-8788-ea7ba154375b' wanted_audio_mxf_id = 'c38bdd62-ce03-4988-8603-195f134207c7' +wanted_reel_id = 'b135d5cf-d180-43d8-b0b3-7373737b73bf' +wanted_asset_hashes = ['E2vhyxdJQhEzSQZdp31w84ZZpfk=', '9OVODrw+zTkSbkGduoQ30k3Kk6Y=', '5E8Q9swcc2bBbFF3IEPNXfIP8gM='] +wanted_issue_date = '2012-07-17T04:45:18+00:00' os.system('rm -rf DCP') os.mkdir('DCP') @@ -27,6 +28,9 @@ os.system('mv *.xml DCP') cpl_id = None pkl_id = None assetmap_id = None +video_mxf_id = None +audio_mxf_id = None +reel_id = None for r, d, f in os.walk('DCP'): for n in f: @@ -61,15 +65,38 @@ audio_mxf_id = xml.getroot().find(cpl_name('ReelList')). \ find(cpl_name('Id')).text audio_mxf_id = audio_mxf_id.replace('urn:uuid:', '') +reel_id = xml.getroot().find(cpl_name('ReelList')). \ + find(cpl_name('Reel')). \ + find(cpl_name('Id')).text +reel_id = reel_id.replace('urn:uuid:', '') + +def pkl_name(s): + return '{%s}%s' % (pkl_namespace, s) + +xml = etree.parse('DCP/%s_pkl.xml' % wanted_pkl_id) + +asset_list = xml.getroot().find(pkl_name('AssetList')) +asset_hashes = [] +print asset_list +for a in asset_list.iter(): + if a.tag == "{%s}Hash" % pkl_namespace: + asset_hashes.append(a.text) + +issue_date = xml.getroot().find(pkl_name('IssueDate')).text + for r, d, f in os.walk('DCP'): for n in f: if n.endswith('.xml'): for line in fileinput.input(os.path.join(r, n), inplace = 1): - line = replace(line, cpl_id, wanted_cpl_id) - line = replace(line, pkl_id, wanted_pkl_id) - line = replace(line, assetmap_id, wanted_assetmap_id) - line = replace(line, video_mxf_id, wanted_video_mxf_id) - line = replace(line, audio_mxf_id, wanted_audio_mxf_id) + line = line.replace(cpl_id, wanted_cpl_id) + line = line.replace(pkl_id, wanted_pkl_id) + line = line.replace(assetmap_id, wanted_assetmap_id) + line = line.replace(video_mxf_id, wanted_video_mxf_id) + line = line.replace(audio_mxf_id, wanted_audio_mxf_id) + line = line.replace(reel_id, wanted_reel_id) + line = line.replace(issue_date, wanted_issue_date) + for i in range(0, len(asset_hashes)): + line = line.replace(asset_hashes[i], wanted_asset_hashes[i]) print line, diff --git a/test/tests.cc b/test/tests.cc index 11f8a7ee..41811b1e 100644 --- a/test/tests.cc +++ b/test/tests.cc @@ -40,7 +40,7 @@ BOOST_AUTO_TEST_CASE (dcp_test) t->company_name = "OpenDCP"; t->product_name = "OpenDCP"; t->product_version = "0.0.25"; - t->issue_date = "2012-07-17T04:32:07+00:00"; + t->issue_date = "2012-07-17T04:45:18+00:00"; filesystem::remove_all ("build/test/foo"); filesystem::create_directories ("build/test/foo"); libdcp::DCP d ("build/test/foo", "A Test DCP", libdcp::DCP::FEATURE, 24, 24); |
