Skip to content

Commit

Permalink
update Makefile test
Browse files Browse the repository at this point in the history
  • Loading branch information
rask24 committed Feb 12, 2024
1 parent 02c9e97 commit e342846
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,7 @@ leak: $(NAME)

releak: fclean leak

test: test_clean test_main

test_main: all $(GTEST_OBJ) $(TEST_OBJ)
test: all $(GTEST_OBJ) $(TEST_OBJ)
@echo "$(BLUE)\ntest linking$(RESET)"
@$(CXX) -L $(LIBFT_DIR) -lft -lpthread $(OBJ_FILTER_MAIN) $(TEST_OBJ) $(GTEST_OBJ) -o $(TEST_NAME)
./$(TEST_NAME)
Expand All @@ -121,6 +119,8 @@ test_clean:
@echo "$(BLUE)test cleaning$(RESET)"
@$(RM) -r $(TEST_BUILD_DIR)

retest: test_clean test

$(TEST_BUILD_DIR)/%.o: $(TEST_DIR)/%.cpp
@mkdir -p $(@D)
@$(CXX) $(CXXFLAGS) -I $(TEST_DIR) $(INCLUDE) -c $< -o $@
Expand Down
18 changes: 9 additions & 9 deletions test/test_push_b_segmented.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,17 +119,17 @@ static void segmented_test_main2() {
}

TEST(push_b_segmented, case2) {
// // save stdout
// int stdout_copy = dup(STDOUT_FILENO);
// // redirect stdout to /dev/null
// int dev_null = open("/dev/null", O_WRONLY);
// dup2(dev_null, 1);
// close(dev_null);
// save stdout
int stdout_copy = dup(STDOUT_FILENO);
// redirect stdout to /dev/null
int dev_null = open("/dev/null", O_WRONLY);
dup2(dev_null, 1);
close(dev_null);

// execute test
segmented_test_main2();

// // revert stdout
// dup2(stdout_copy, STDOUT_FILENO);
// close(stdout_copy);
// revert stdout
dup2(stdout_copy, STDOUT_FILENO);
close(stdout_copy);
}

0 comments on commit e342846

Please sign in to comment.