Skip to content

Commit

Permalink
Reduce files
Browse files Browse the repository at this point in the history
  • Loading branch information
akawashiro committed Jul 24, 2024
1 parent 76cc538 commit 1e293e7
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 40 deletions.
2 changes: 0 additions & 2 deletions feature_unit_tests/user-defined-exception-g++/fuga.cc
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#include "fuga.h"

struct CustomException {};

void throw_exception_fuga() {
throw CustomException();
}
Expand Down
2 changes: 2 additions & 0 deletions feature_unit_tests/user-defined-exception-g++/fuga.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
#include <iostream>
#include <stdexcept>

struct CustomException {};

void throw_exception_fuga();
void catch_exception_fuga();
20 changes: 0 additions & 20 deletions feature_unit_tests/user-defined-exception-g++/hoge.cc

This file was deleted.

6 changes: 0 additions & 6 deletions feature_unit_tests/user-defined-exception-g++/hoge.h

This file was deleted.

13 changes: 5 additions & 8 deletions feature_unit_tests/user-defined-exception-g++/main.cc
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
#include "hoge.h"
#include "fuga.h"

int main() {
std::cout << "catch_exception" << std::endl;
catch_exception_hoge();

std::cout << "throw_exception" << std::endl;
catch_exception_fuga();
try {
throw_exception_hoge();
} catch (std::exception& e) {
std::cout << e.what() << std::endl;
throw_exception_fuga();
} catch (CustomException& e) {
std::cout << "Caught CustomException" << std::endl;
}
}
9 changes: 5 additions & 4 deletions feature_unit_tests/user-defined-exception-g++/test.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
#! /bin/bash -eu

g++ -fPIC -shared -o libfuga.so -Wl,-soname,libfuga.so fuga.cc
g++ -fPIC -shared -o libhoge.so.original -Wl,-soname,libhoge.so hoge.cc libfuga.so
g++ main.cc -o main.out libhoge.so.original libfuga.so
LD_LIBRARY_PATH=. $(git rev-parse --show-toplevel)/build/sold -i libhoge.so.original -o libhoge.so.soldout --section-headers --check-output
g++ main.cc -o main.out libfuga.so
LD_LIBRARY_PATH=. $(git rev-parse --show-toplevel)/build/sold -i libfuga.so.original -o libfuga.so.soldout --section-headers --check-output

cp libfuga.so libfuga.so.original
# Use sold
ln -sf libhoge.so.soldout libhoge.so
# Use original
ln -sf libhoge.so.original libhoge.so
# ln -sf libhoge.so.original libhoge.so
ln -sf libfuga.so.soldout libfuga.so

LD_LIBRARY_PATH=. ./main.out

0 comments on commit 1e293e7

Please sign in to comment.