File tree Expand file tree Collapse file tree 1 file changed +76
-0
lines changed Expand file tree Collapse file tree 1 file changed +76
-0
lines changed Original file line number Diff line number Diff line change 1+ here=` pwd`
2+ if test $? -ne 0; then exit 2; fi
3+ tmp=/tmp/$$
4+ mkdir $tmp
5+ if test $? -ne 0; then exit 2; fi
6+ cd $tmp
7+ if test $? -ne 0; then exit 2; fi
8+
9+ fail ()
10+ {
11+ echo " FAILED" 1>&2
12+ cd $here
13+ chmod -R u+w $tmp
14+ rm -rf $tmp
15+ exit 1
16+ }
17+
18+ pass ()
19+ {
20+ echo " PASSED" 1>&2
21+ cd $here
22+ chmod -R u+w $tmp
23+ rm -rf $tmp
24+ exit 0
25+ }
26+
27+ trap " fail" 1 2 3 15
28+ export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
29+
30+ # Test against regression of bug found in RESTProcess of overloaded
31+ # functions where a partial override of overloaded base class occurs.
32+
33+ cat > source.h << EOF
34+ #include <string>
35+ using std::string;
36+ struct Base
37+ {
38+ string m_x;
39+ virtual string x() const {return m_x;}
40+ virtual string x(const string& x) {return m_x=x;}
41+ };
42+
43+ struct Derived: public Base
44+ {
45+ using Base::x;
46+ bool xCalled=false;
47+ string x(const string& x) override {xCalled=true; return m_x=x;}
48+ };
49+ EOF
50+
51+ cat > source.cc << EOF
52+ #include "source.h"
53+ #include "source.cd"
54+ #include "pythonBuffer.h"
55+ #include "classdesc_epilogue.h"
56+
57+ Derived derived;
58+ CLASSDESC_ADD_GLOBAL(derived);
59+ CLASSDESC_PYTHON_MODULE(module);
60+ EOF
61+
62+ $here /classdesc -overload -typeName RESTProcess json_pack json_unpack < source.h > source.cd
63+ if test $? -ne 0; then fail; fi
64+
65+ g++ -I$here -I$here /json5_parser/json5_parser ` pkg-config --cflags python3` -fPIC -shared -o module.so source.cc ` pkg-config --libs python3` -lboost_system
66+ if test $? -ne 0; then fail; fi
67+
68+ python3 << EOF
69+ from module import derived
70+ derived.x("hello")
71+ assert derived.xCalled()
72+ assert derived.x()=="hello"
73+ EOF
74+ if test $? -ne 0; then fail; fi
75+
76+ pass
You can’t perform that action at this time.
0 commit comments