1
#include <zypp/media/MediaManager.h>
2
#include <zypp/base/String.h>
3
#include <zypp/base/Logger.h>
4
#include <zypp/Pathname.h>
13
#include "mymediaverifier.h"
15
#include <boost/test/unit_test.hpp>
16
#include <boost/test/auto_unit_test.hpp>
18
using boost::unit_test::test_suite;
19
using boost::unit_test::test_case;
22
using namespace zypp::media;
36
#define ONE_STEP(MSG) \
38
DBG << "======================================" << std::endl; \
39
DBG << "==>> " << MSG << std::endl; \
40
DBG << "======================================" << std::endl; \
41
if( do_step) { pause(); if( do_quit) exit(0); } \
44
BOOST_AUTO_TEST_CASE(strange_test)
46
bool eject_src = false;
47
bool close_src = false;
50
sigemptyset(&sa.sa_mask);
53
sigaction(SIGINT, &sa, NULL);
55
sigaction(SIGTERM, &sa, NULL);
57
// std::cerr << "ARGS=" << argc << std::endl;
58
// for(int i=1; i < argc; i++)
60
// if( std::string(argv[i]) == "-i")
63
// if( std::string(argv[i]) == "-e")
66
// if( std::string(argv[i]) == "-c")
71
MediaVerifierRef verifier(
72
new MyMediaVerifier(/* "SUSE-Linux-CORE-i386 9" */)
75
media::MediaId src = 0;
80
src_url = "nfs://dist.suse.de/dist/install";
83
iso_url.setQueryParam("iso", "SUSE-10.1-Beta5/SUSE-Linux-10.1-beta5-i386-CD1.iso");
84
iso_url.setQueryParam("url", src_url.asString());
88
iso_url.setQueryParam("iso", "/space/tmp/iso/SUSE-Linux-10.1-beta7-i386-CD1.iso");
93
if( eject_src || close_src)
95
ONE_STEP("SRC: open " + src_url.asString());
96
src = mm.open(src_url);
98
ONE_STEP("SRC: attach")
102
ONE_STEP("ISO: open " + iso_url.asString());
103
iso = mm.open(iso_url);
105
ONE_STEP("ISO: add verifier")
106
mm.addVerifier(iso, verifier);
108
ONE_STEP("ISO: attach")
111
ONE_STEP("provideFile(/INDEX.gz)")
112
mm.provideFile(iso, Pathname("/INDEX.gz"));
118
ONE_STEP("SRC: release(ejectDev=\"/dev/device\")")
119
mm.release(src);//! \todo add the device argument once mm.getDevices() is ready
121
catch(const MediaException &e)
124
ERR << "ONE: HUH? Eject hasn't worked?!" << std::endl;
132
ONE_STEP("SRC: close()")
135
catch(const MediaException &e)
138
ERR << "SRC: HUH? Close hasn't worked?!" << std::endl;
142
ONE_STEP("ISO: RELEASE")
147
catch(const MediaException &e)
149
ERR << "Catched media exception..." << std::endl;
155
ERR << "Catched *unknown* exception" << std::endl;
159
// vim: set ts=2 sts=2 sw=2 ai et: